Flutter Engine
The Flutter Engine
Texture.cpp
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
9
16
17namespace skgpu::graphite {
18
19Texture::Texture(const SharedContext* sharedContext,
20 SkISize dimensions,
21 const TextureInfo& info,
22 sk_sp<MutableTextureState> mutableState,
23 Ownership ownership,
24 skgpu::Budgeted budgeted)
25 : Resource(sharedContext, ownership, budgeted, ComputeSize(dimensions, info))
26 , fDimensions(dimensions)
27 , fInfo(info)
28 , fMutableState(std::move(mutableState)) {}
29
31
33 fReleaseCallback = std::move(releaseCallback);
34}
35
37 if (fReleaseCallback) {
38 // Depending on the ref count of fReleaseCallback this may or may not actually trigger
39 // the ReleaseProc to be called.
40 fReleaseCallback.reset();
41 }
42}
43
44MutableTextureState* Texture::mutableState() const { return fMutableState.get(); }
45
47 const char* dumpName) const {
48 SkString dimensionsStr;
49 dimensionsStr.printf("(%dx%d)", fDimensions.width(), fDimensions.height());
50 traceMemoryDump->dumpStringValue(dumpName, "dimensions", dimensionsStr.c_str());
51 traceMemoryDump->dumpStringValue(dumpName, "textureInfo", fInfo.toString().c_str());
52}
53
54} // namespace skgpu::graphite
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
const char * c_str() const
Definition: SkString.h:133
virtual void dumpStringValue(const char *, const char *, const char *)
void onDumpMemoryStatistics(SkTraceMemoryDump *traceMemoryDump, const char *dumpName) const override
Definition: Texture.cpp:46
void invokeReleaseProc() override
Definition: Texture.cpp:36
Texture(const SharedContext *, SkISize dimensions, const TextureInfo &info, sk_sp< MutableTextureState > mutableState, Ownership, skgpu::Budgeted)
Definition: Texture.cpp:19
MutableTextureState * mutableState() const
Definition: Texture.cpp:44
void setReleaseCallback(sk_sp< RefCntedCallback >)
Definition: Texture.cpp:32
size_t ComputeSize(SkISize dimensions, const TextureInfo &info)
Budgeted
Definition: GpuTypes.h:35
Definition: ref_ptr.h:256
Definition: SkSize.h:16
constexpr int32_t width() const
Definition: SkSize.h:36
constexpr int32_t height() const
Definition: SkSize.h:37