Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrTextureGenerator.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 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#ifndef GrTextureGenerator_DEFINED
9#define GrTextureGenerator_DEFINED
10
12#include "include/gpu/GrTypes.h"
14
15#include <cstdint>
16
19enum class GrImageTexGenPolicy : int;
20namespace skgpu { enum class Mipmapped : bool; }
21struct SkImageInfo;
22
24public:
25 bool isTextureGenerator() const final { return true; }
26
27 /**
28 * If the generator can natively/efficiently return its pixels as a GPU image (backed by a
29 * texture) this will return that image. If not, this will return NULL.
30 *
31 * Regarding the GrRecordingContext parameter:
32 *
33 * It must be non-NULL. The generator should only succeed if:
34 * - its internal context is the same
35 * - it can somehow convert its texture into one that is valid for the provided context.
36 *
37 * If the mipmapped parameter is kYes, the generator should try to create a TextureProxy that
38 * at least has the mip levels allocated and the base layer filled in. If this is not possible,
39 * the generator is allowed to return a non mipped proxy, but this will have some additional
40 * overhead in later allocating mips and copying of the base layer.
41 *
42 * GrImageTexGenPolicy determines whether or not a new texture must be created (and its budget
43 * status) or whether this may (but is not required to) return a pre-existing texture that is
44 * retained by the generator (kDraw).
45 */
47 const SkImageInfo& info,
48 skgpu::Mipmapped mipmapped,
50
51 // External clients should override GrExternalTextureGenerator instead of trying to implement
52 // this (which uses private Skia types)
55
56 // Most internal SkImageGenerators produce textures and views that use kTopLeft_GrSurfaceOrigin.
57 // If the generator may produce textures with different origins (e.g.
58 // GrAHardwareBufferImageGenerator) it should override this function to return the correct
59 // origin. Implementations should be thread-safe.
61
62protected:
63 GrTextureGenerator(const SkImageInfo& info, uint32_t uniqueId = kNeedNewImageUniqueID);
64};
65
66#endif // GrTextureGenerator_DEFINED
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
#define SK_API
Definition SkAPI.h:35
GrImageTexGenPolicy
Definition SkGr.h:141
@ kNeedNewImageUniqueID
Type::kYUV Type::kRGBA() int(0.7 *637)
virtual GrSurfaceOrigin origin() const
bool isTextureGenerator() const final
virtual GrSurfaceProxyView onGenerateTexture(GrRecordingContext *, const SkImageInfo &, skgpu::Mipmapped, GrImageTexGenPolicy)=0
Mipmapped
Definition GpuTypes.h:53