Flutter Engine
The Flutter Engine
Texture.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 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 skgpu_graphite_Texture_DEFINED
9#define skgpu_graphite_Texture_DEFINED
10
11#include "include/core/SkSize.h"
15
16namespace skgpu {
17class MutableTextureState;
18class RefCntedCallback;
19enum class Budgeted : bool;
20};
21
22namespace skgpu::graphite {
23
24class Texture : public Resource {
25public:
26 ~Texture() override;
27
28 int numSamples() const { return fInfo.numSamples(); }
29 Mipmapped mipmapped() const { return fInfo.mipmapped(); }
30
31 SkISize dimensions() const { return fDimensions; }
32 const TextureInfo& textureInfo() const { return fInfo; }
33
35
36 const char* getResourceType() const override { return "Texture"; }
37
38#if defined(GRAPHITE_TEST_UTILS)
39 const Texture* asTexture() const override { return this; }
40#endif
41
42protected:
43 Texture(const SharedContext*,
45 const TextureInfo& info,
49
51
52 void invokeReleaseProc() override;
53
54 void onDumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump,
55 const char* dumpName) const override;
56
57private:
58 SkISize fDimensions;
59 TextureInfo fInfo;
60 sk_sp<MutableTextureState> fMutableState;
61 sk_sp<RefCntedCallback> fReleaseCallback;
62};
63
64} // namespace skgpu::graphite
65
66#endif // skgpu_graphite_Texture_DEFINED
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
Mipmapped mipmapped() const
Definition: TextureInfo.h:79
uint32_t numSamples() const
Definition: TextureInfo.h:78
void onDumpMemoryStatistics(SkTraceMemoryDump *traceMemoryDump, const char *dumpName) const override
Definition: Texture.cpp:46
void invokeReleaseProc() override
Definition: Texture.cpp:36
Mipmapped mipmapped() const
Definition: Texture.h:29
SkISize dimensions() const
Definition: Texture.h:31
Texture(const SharedContext *, SkISize dimensions, const TextureInfo &info, sk_sp< MutableTextureState > mutableState, Ownership, skgpu::Budgeted)
Definition: Texture.cpp:19
int numSamples() const
Definition: Texture.h:28
const char * getResourceType() const override
Definition: Texture.h:36
MutableTextureState * mutableState() const
Definition: Texture.cpp:44
void setReleaseCallback(sk_sp< RefCntedCallback >)
Definition: Texture.cpp:32
const TextureInfo & textureInfo() const
Definition: Texture.h:32
Definition: GpuTools.h:21
Budgeted
Definition: GpuTypes.h:35
Mipmapped
Definition: GpuTypes.h:53
Definition: SkSize.h:16