21 : fDimensions(dimensions), fInfo(
info), fBudgeted(budgeted), fVolatile(
Volatile::
kNo) {
26 : fDimensions(
texture->dimensions())
28 , fBudgeted(
texture->budgeted())
34TextureProxy::TextureProxy(
SkISize dimensions,
35 const TextureInfo& textureInfo,
39 : fDimensions(dimensions)
42 , fVolatile(isVolatile)
48TextureProxy::~TextureProxy() {}
51 SkASSERT(!this->isFullyLazy() || this->isInstantiated());
52 return this->isInstantiated() ? fTexture->dimensions() : fDimensions;
55bool TextureProxy::isLazy()
const {
56 return SkToBool(fLazyInstantiateCallback);
59bool TextureProxy::isFullyLazy()
const {
60 bool result = fDimensions.width() < 0;
66bool TextureProxy::isVolatile()
const {
69 return fVolatile == Volatile::kYes;
72bool TextureProxy::isProtected()
const {
73 return fInfo.isProtected() == Protected::kYes;
76size_t TextureProxy::uninstantiatedGpuMemorySize()
const {
102 fTexture = fLazyInstantiateCallback(resourceProvider);
106 SkDEBUGCODE(this->validateTexture(fTexture.get()));
112 if (textureProxy->
isLazy()) {
116 return textureProxy->
instantiate(resourceProvider);
119void TextureProxy::deinstantiate() {
120 SkASSERT(fVolatile == Volatile::kYes &&
SkToBool(fLazyInstantiateCallback));
130 return fTexture.get();
138 if (dimensions.
width() < 1 || dimensions.
height() < 1 ||
146 if (budgeted == Budgeted::kNo) {
149 if (!proxy->instantiate(resourceProvider)) {
163 if (dimensions.
width() < 1 || dimensions.
height() < 1 ||
191 "proxy->fInfo[%s] incompatible with texture->fInfo[%s]",
192 fInfo.toString().c_str(),
193 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.
static constexpr bool SkToBool(const T &x)
int maxTextureSize() const
sk_sp< Texture > findOrCreateScratchTexture(SkISize, const TextureInfo &, skgpu::Budgeted)
bool instantiate(ResourceProvider *)
std::function< sk_sp< Texture >(ResourceProvider *)> LazyInstantiateCallback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
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