Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 1 | /* |
| 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 Salomon | 7205080 | 2020-10-12 20:45:06 -0400 | [diff] [blame] | 8 | #include "include/core/SkColor.h" |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 9 | #include "include/core/SkRefCnt.h" |
| 10 | #include "include/gpu/GrTypes.h" |
| 11 | |
Adlai Holler | 2940538 | 2020-07-20 16:02:05 -0400 | [diff] [blame] | 12 | class GrDirectContext; |
Brian Salomon | 7205080 | 2020-10-12 20:45:06 -0400 | [diff] [blame] | 13 | class SkColorSpace; |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 14 | class SkImage; |
| 15 | class SkPixmap; |
Brian Salomon | 7205080 | 2020-10-12 20:45:06 -0400 | [diff] [blame] | 16 | struct SkISize; |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 17 | |
| 18 | namespace 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 Salomon | 7205080 | 2020-10-12 20:45:06 -0400 | [diff] [blame] | 26 | sk_sp<SkImage> MakeBackendTextureImage(GrDirectContext*, |
| 27 | const SkPixmap&, |
| 28 | GrRenderable, |
| 29 | GrSurfaceOrigin); |
| 30 | |
| 31 | /** Creates an image of with a solid color. */ |
| 32 | sk_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 Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 39 | } // namespace sk_gpu_test |