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/SkColor.h" 9 #include "include/core/SkRefCnt.h" 10 #include "include/gpu/GrTypes.h" 11 12 class GrDirectContext; 13 class SkColorSpace; 14 class SkImage; 15 class SkPixmap; 16 struct SkISize; 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 */ 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 39 } // namespace sk_gpu_test 40