blob: 289f268818a6e020b7010c789c2682c06d374c3b [file] [log] [blame]
Brian Salomon63a0a752020-06-26 13:32:09 -04001/*
2 * Copyright 2020 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Brian Salomon72050802020-10-12 20:45:06 -04008#include "include/core/SkColor.h"
Brian Salomon63a0a752020-06-26 13:32:09 -04009#include "include/core/SkRefCnt.h"
10#include "include/gpu/GrTypes.h"
11
Adlai Holler29405382020-07-20 16:02:05 -040012class GrDirectContext;
Brian Salomon72050802020-10-12 20:45:06 -040013class SkColorSpace;
Brian Salomon63a0a752020-06-26 13:32:09 -040014class SkImage;
15class SkPixmap;
Brian Salomon72050802020-10-12 20:45:06 -040016struct SkISize;
Brian Salomon63a0a752020-06-26 13:32:09 -040017
18namespace sk_gpu_test {
19/**
20 * Creates a backend texture with pixmap contents and wraps it in a SkImage that safely deletes
21 * the texture when it goes away. Unlike using makeTextureImage() on a non-GPU image, this will
22 * fail rather than fallback if the pixmaps's color type doesn't map to a supported texture format.
23 * For testing purposes the texture can be made renderable to exercise different code paths for
24 * renderable textures/formats.
25 */
Brian Salomon72050802020-10-12 20:45:06 -040026sk_sp<SkImage> MakeBackendTextureImage(GrDirectContext*,
27 const SkPixmap&,
28 GrRenderable,
29 GrSurfaceOrigin);
30
31/** Creates an image of with a solid color. */
32sk_sp<SkImage> MakeBackendTextureImage(GrDirectContext*,
33 const SkImageInfo& info,
34 SkColor4f,
35 GrMipmapped = GrMipmapped::kNo,
36 GrRenderable = GrRenderable::kNo,
37 GrSurfaceOrigin = GrSurfaceOrigin::kTopLeft_GrSurfaceOrigin);
38
Brian Salomon63a0a752020-06-26 13:32:09 -040039} // namespace sk_gpu_test