22 const TextureInfo&
info,
23 std::string_view label,
25 : fDimensions(dimensions)
34 : fDimensions(
texture->dimensions())
37 , fBudgeted(
texture->budgeted())
43TextureProxy::TextureProxy(
SkISize dimensions,
44 const TextureInfo& textureInfo,
48 : fDimensions(dimensions)
51 , fVolatile(isVolatile)
57TextureProxy::~TextureProxy() {}
60 SkASSERT(!this->isFullyLazy() || this->isInstantiated());
61 return this->isInstantiated() ? fTexture->dimensions() : fDimensions;
64bool TextureProxy::isLazy()
const {
65 return SkToBool(fLazyInstantiateCallback);
68bool TextureProxy::isFullyLazy()
const {
69 bool result = fDimensions.width() < 0;
75bool TextureProxy::isVolatile()
const {
78 return fVolatile == Volatile::kYes;
81bool TextureProxy::isProtected()
const {
85size_t TextureProxy::uninstantiatedGpuMemorySize()
const {
100 SkDEBUGCODE(this->validateTexture(fTexture.get()));
111 fTexture = fLazyInstantiateCallback(resourceProvider);
115 SkDEBUGCODE(this->validateTexture(fTexture.get()));
121 if (textureProxy->
isLazy()) {
125 return textureProxy->
instantiate(resourceProvider);
136 textureProxy->fLabel);
137 if (!textureProxy->fTexture) {
140 SkDEBUGCODE(textureProxy->validateTexture(textureProxy->fTexture.get()));
145void TextureProxy::deinstantiate() {
146 SkASSERT(fVolatile == Volatile::kYes &&
SkToBool(fLazyInstantiateCallback));
156 return fTexture.get();
163 std::string_view label,
165 if (dimensions.
width() < 1 || dimensions.
height() < 1 ||
176 if (budgeted == Budgeted::kNo) {
179 if (!proxy->instantiate(resourceProvider)) {
193 if (dimensions.
width() < 1 || dimensions.
height() < 1 ||
227 "proxy->fInfo[%s] incompatible with texture->fInfo[%s]",
228 fInfo.toString().c_str(),
229 texture->textureInfo().toString().c_str());
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define SkASSERTF(cond, fmt,...)
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
static constexpr bool SkToBool(const T &x)
int maxTextureSize() const
sk_sp< Texture > findOrCreateScratchTexture(SkISize, const TextureInfo &, std::string_view label, skgpu::Budgeted)
sk_sp< Texture > getScratchTexture(SkISize, const TextureInfo &, std::string_view label)
bool instantiate(ResourceProvider *)
SkISize dimensions() const
std::function< sk_sp< Texture >(ResourceProvider *)> LazyInstantiateCallback
const TextureInfo & textureInfo() const
bool isInstantiated() const
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
size_t ComputeSize(SkISize dimensions, const TextureInfo &info)
static constexpr SkISize Make(int32_t w, int32_t h)
constexpr int32_t width() const
constexpr int32_t height() const
GrSamplerState::WrapMode Wrap