Reland "ccpr: Set atlas proxy size to draw bounds rather than backing size"
This is a reland of 46d0f9aad1e68b90774315ad09abe55dd8fe2fd9
Original change's description:
> ccpr: Set atlas proxy size to draw bounds rather than backing size
>
> Bug: skia:
> Change-Id: I6605754ecc5377b1c25847fdda478f8246979a2f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209808
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: skia:
Change-Id: Ic13317fd021843961989a79050735c225702ad45
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211181
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ccpr/GrCCClipPath.cpp b/src/gpu/ccpr/GrCCClipPath.cpp
index ca45ade..77de299 100644
--- a/src/gpu/ccpr/GrCCClipPath.cpp
+++ b/src/gpu/ccpr/GrCCClipPath.cpp
@@ -26,20 +26,23 @@
SkASSERT(!fHasAtlasTransform);
GrTextureProxy* textureProxy = fAtlas ? fAtlas->textureProxy() : nullptr;
+
if (!textureProxy || !textureProxy->instantiate(resourceProvider)) {
fAtlasScale = fAtlasTranslate = {0, 0};
SkDEBUGCODE(fHasAtlasTransform = true);
return {};
}
+ sk_sp<GrTexture> texture = sk_ref_sp(textureProxy->peekTexture());
+ SkASSERT(texture);
SkASSERT(kTopLeft_GrSurfaceOrigin == textureProxy->origin());
- fAtlasScale = {1.f / textureProxy->width(), 1.f / textureProxy->height()};
+ fAtlasScale = {1.f / texture->width(), 1.f / texture->height()};
fAtlasTranslate.set(fDevToAtlasOffset.fX * fAtlasScale.x(),
fDevToAtlasOffset.fY * fAtlasScale.y());
SkDEBUGCODE(fHasAtlasTransform = true);
- return sk_ref_sp(textureProxy->peekTexture());
+ return std::move(texture);
},
format, GrProxyProvider::Renderable::kYes, kTopLeft_GrSurfaceOrigin,
kAlpha_half_GrPixelConfig, caps);