Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
BackendTextureImageFactory.h
Go to the documentation of this file.
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
12#include "include/gpu/GrTypes.h"
13
14class SkColorSpace;
15class SkImage;
16class SkPixmap;
17struct SkISize;
18
19#ifdef SK_GANESH
20class GrDirectContext;
21#endif
22
23#ifdef SK_GRAPHITE
24namespace skgpu::graphite {
25 class Recorder;
26}
27using Origin = skgpu::Origin; // TODO: Can we migrate Ganesh to use this?
28#endif
29
30namespace sk_gpu_test {
31
35
36#ifdef SK_GANESH
37/**
38 * Creates a backend texture with pixmap contents and wraps it in a SkImage that safely deletes
39 * the texture when it goes away. Unlike using makeTextureImage() on a non-GPU image, this will
40 * fail rather than fallback if the pixmaps's color type doesn't map to a supported texture format.
41 * For testing purposes the texture can be made renderable to exercise different code paths for
42 * renderable textures/formats.
43 */
44sk_sp<SkImage> MakeBackendTextureImage(GrDirectContext*,
45 const SkPixmap&,
48 Protected = Protected::kNo);
49
50/** Creates a solid color image. */
51sk_sp<SkImage> MakeBackendTextureImage(GrDirectContext*,
52 const SkImageInfo& info,
54 Mipmapped = Mipmapped::kNo,
55 Renderable = Renderable::kNo,
57 Protected isProtected = Protected::kNo);
58#endif // SK_GANESH
59
60#ifdef SK_GRAPHITE
61/*
62 * Graphite versions of MakeBackendTextureImage
63 */
64sk_sp<SkImage> MakeBackendTextureImage(skgpu::graphite::Recorder*,
65 const SkPixmap&,
68 Origin,
69 Protected = Protected::kNo);
70
71/** Creates a solid color image. */
72sk_sp<SkImage> MakeBackendTextureImage(skgpu::graphite::Recorder*,
73 const SkImageInfo&,
77 Origin,
78 Protected = Protected::kNo);
79
80#endif // SK_GRAPHITE
81
82} // namespace sk_gpu_test
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
GrSurfaceOrigin
Definition GrTypes.h:147
@ kTopLeft_GrSurfaceOrigin
Definition GrTypes.h:148
Renderable
Definition GpuTypes.h:69
Mipmapped
Definition GpuTypes.h:53
Protected
Definition GpuTypes.h:61