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 | |
| 8 | #include "include/core/SkRefCnt.h" |
| 9 | #include "include/gpu/GrTypes.h" |
| 10 | |
Adlai Holler | 2940538 | 2020-07-20 16:02:05 -0400 | [diff] [blame] | 11 | class GrDirectContext; |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 12 | class SkImage; |
| 13 | class SkPixmap; |
| 14 | |
| 15 | namespace sk_gpu_test { |
| 16 | /** |
| 17 | * Creates a backend texture with pixmap contents and wraps it in a SkImage that safely deletes |
| 18 | * the texture when it goes away. Unlike using makeTextureImage() on a non-GPU image, this will |
| 19 | * fail rather than fallback if the pixmaps's color type doesn't map to a supported texture format. |
| 20 | * For testing purposes the texture can be made renderable to exercise different code paths for |
| 21 | * renderable textures/formats. |
| 22 | */ |
Brian Salomon | 4efaf5e | 2020-10-12 21:30:00 +0000 | [diff] [blame] | 23 | sk_sp<SkImage> MakeBackendTextureImage(GrDirectContext*, const SkPixmap&, |
| 24 | GrRenderable, GrSurfaceOrigin); |
Brian Salomon | 63a0a75 | 2020-06-26 13:32:09 -0400 | [diff] [blame] | 25 | } // namespace sk_gpu_test |