Revert "ccpr: Set atlas proxy size to draw bounds rather than backing size"

This reverts commit 46d0f9aad1e68b90774315ad09abe55dd8fe2fd9.

Reason for revert: Didn't switch to GrTexture size for clipping ops.

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>

TBR=robertphillips@google.com,csmartdalton@google.com

Change-Id: I9ea5f9939e7e7fe498a165a71a71b0a6e28cff6c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210424
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/ccpr/GrCCAtlas.cpp b/src/gpu/ccpr/GrCCAtlas.cpp
index 3cfb5d0..c3c8ed6 100644
--- a/src/gpu/ccpr/GrCCAtlas.cpp
+++ b/src/gpu/ccpr/GrCCAtlas.cpp
@@ -189,10 +189,6 @@
     SkASSERT(SkTMax(fHeight, fWidth) <= fMaxTextureSize);
     SkASSERT(fMaxTextureSize <= onFlushRP->caps()->maxRenderTargetSize());
 
-    // Finalize the content size of our proxy. The GPU can potentially make optimizations if it
-    // knows we only intend to write out a smaller sub-rectangle of the backing texture.
-    fTextureProxy->priv().setLazySize(fDrawBounds.width(), fDrawBounds.height());
-
     if (backingTexture) {
         SkASSERT(backingTexture->config() == kAlpha_half_GrPixelConfig);
         SkASSERT(backingTexture->width() == fWidth);
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
index 698ae4e..0c5002e 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
@@ -415,11 +415,7 @@
     for (const InstanceRange& range : fInstanceRanges) {
         SkASSERT(range.fEndInstanceIdx > baseInstance);
 
-        const GrTextureProxy* atlas = range.fAtlasProxy;
-        SkASSERT(atlas->isInstantiated());
-
-        GrCCPathProcessor pathProc(
-                atlas->peekTexture(), atlas->origin(), fViewMatrixIfUsingLocalCoords);
+        GrCCPathProcessor pathProc(range.fAtlasProxy, fViewMatrixIfUsingLocalCoords);
         GrTextureProxy* atlasProxy = range.fAtlasProxy;
         fixedDynamicState.fPrimitiveProcessorTextures = &atlasProxy;
         pathProc.drawPaths(flushState, pipeline, &fixedDynamicState, *resources, baseInstance,
diff --git a/src/gpu/ccpr/GrCCPathProcessor.cpp b/src/gpu/ccpr/GrCCPathProcessor.cpp
index 96d88a7..5ea9755 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPathProcessor.cpp
@@ -10,7 +10,6 @@
 #include "include/gpu/GrTexture.h"
 #include "src/gpu/GrGpuCommandBuffer.h"
 #include "src/gpu/GrOnFlushResourceProvider.h"
-#include "src/gpu/GrTexturePriv.h"
 #include "src/gpu/ccpr/GrCCPerFlushResources.h"
 #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
 #include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
@@ -79,13 +78,13 @@
     }
 }
 
-GrCCPathProcessor::GrCCPathProcessor(const GrTexture* atlasTexture, GrSurfaceOrigin atlasOrigin,
+GrCCPathProcessor::GrCCPathProcessor(const GrTextureProxy* atlas,
                                      const SkMatrix& viewMatrixIfUsingLocalCoords)
         : INHERITED(kGrCCPathProcessor_ClassID)
-        , fAtlasAccess(atlasTexture->texturePriv().textureType(), atlasTexture->config(),
-                       GrSamplerState::Filter::kNearest, GrSamplerState::WrapMode::kClamp)
-        , fAtlasSize(SkISize::Make(atlasTexture->width(), atlasTexture->height()))
-        , fAtlasOrigin(atlasOrigin) {
+        , fAtlasAccess(atlas->textureType(), atlas->config(), GrSamplerState::Filter::kNearest,
+                       GrSamplerState::WrapMode::kClamp)
+        , fAtlasSize(atlas->isize())
+        , fAtlasOrigin(atlas->origin()) {
     // TODO: Can we just assert that atlas has GrCCAtlas::kTextureOrigin and remove fAtlasOrigin?
     this->setInstanceAttributes(kInstanceAttribs, SK_ARRAY_COUNT(kInstanceAttribs));
     SkASSERT(this->instanceStride() == sizeof(Instance));
@@ -105,10 +104,10 @@
 private:
     void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& primProc,
                  FPCoordTransformIter&& transformIter) override {
-        const auto& proc = primProc.cast<GrCCPathProcessor>();
-        pdman.set2f(
-                fAtlasAdjustUniform, 1.0f / proc.fAtlasSize.fWidth, 1.0f / proc.fAtlasSize.fHeight);
-        this->setTransformDataHelper(proc.fLocalMatrix, pdman, &transformIter);
+        const GrCCPathProcessor& proc = primProc.cast<GrCCPathProcessor>();
+        pdman.set2f(fAtlasAdjustUniform, 1.0f / proc.atlasSize().fWidth,
+                    1.0f / proc.atlasSize().fHeight);
+        this->setTransformDataHelper(proc.localMatrix(), pdman, &transformIter);
     }
 
     GrGLSLUniformHandler::UniformHandle fAtlasAdjustUniform;
@@ -199,17 +198,17 @@
 
     // Convert to atlas coordinates in order to do our texture lookup.
     v->codeAppendf("float2 atlascoord = octocoord + float2(dev_to_atlas_offset);");
-    if (kTopLeft_GrSurfaceOrigin == proc.fAtlasOrigin) {
+    if (kTopLeft_GrSurfaceOrigin == proc.atlasOrigin()) {
         v->codeAppendf("%s.xy = atlascoord * %s;", texcoord.vsOut(), atlasAdjust);
     } else {
-        SkASSERT(kBottomLeft_GrSurfaceOrigin == proc.fAtlasOrigin);
+        SkASSERT(kBottomLeft_GrSurfaceOrigin == proc.atlasOrigin());
         v->codeAppendf("%s.xy = float2(atlascoord.x * %s.x, 1 - atlascoord.y * %s.y);",
                        texcoord.vsOut(), atlasAdjust, atlasAdjust);
     }
     v->codeAppendf("%s.z = wind * .5;", texcoord.vsOut());
 
     gpArgs->fPositionVar.set(kFloat2_GrSLType, "octocoord");
-    this->emitTransforms(v, varyingHandler, uniHandler, gpArgs->fPositionVar, proc.fLocalMatrix,
+    this->emitTransforms(v, varyingHandler, uniHandler, gpArgs->fPositionVar, proc.localMatrix(),
                          args.fFPCoordTransformHandler);
 
     // Fragment shader.
diff --git a/src/gpu/ccpr/GrCCPathProcessor.h b/src/gpu/ccpr/GrCCPathProcessor.h
index 642cbdc..0e2a22d 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.h
+++ b/src/gpu/ccpr/GrCCPathProcessor.h
@@ -61,10 +61,14 @@
     static sk_sp<const GrGpuBuffer> FindVertexBuffer(GrOnFlushResourceProvider*);
     static sk_sp<const GrGpuBuffer> FindIndexBuffer(GrOnFlushResourceProvider*);
 
-    GrCCPathProcessor(const GrTexture* atlasTexture, GrSurfaceOrigin atlasOrigin,
+    GrCCPathProcessor(const GrTextureProxy* atlas,
                       const SkMatrix& viewMatrixIfUsingLocalCoords = SkMatrix::I());
 
     const char* name() const override { return "GrCCPathProcessor"; }
+    const SkISize& atlasSize() const { return fAtlasSize; }
+    GrSurfaceOrigin atlasOrigin() const { return fAtlasOrigin; }
+    const SkMatrix& localMatrix() const { return fLocalMatrix; }
+
     void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
     GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
 
diff --git a/src/gpu/ccpr/GrCCPerFlushResources.cpp b/src/gpu/ccpr/GrCCPerFlushResources.cpp
index 567a778..ffec7fb 100644
--- a/src/gpu/ccpr/GrCCPerFlushResources.cpp
+++ b/src/gpu/ccpr/GrCCPerFlushResources.cpp
@@ -76,15 +76,12 @@
 
     void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
         SkASSERT(fSrcProxy);
-        auto srcProxy = fSrcProxy.get();
-        SkASSERT(srcProxy->isInstantiated());
-
-        GrCCPathProcessor pathProc(srcProxy->peekTexture(), srcProxy->origin());
-
-        GrPipeline pipeline(GrScissorTest::kDisabled, SkBlendMode::kSrc);
         GrPipeline::FixedDynamicState dynamicState;
+        auto srcProxy = fSrcProxy.get();
         dynamicState.fPrimitiveProcessorTextures = &srcProxy;
 
+        GrPipeline pipeline(GrScissorTest::kDisabled, SkBlendMode::kSrc);
+        GrCCPathProcessor pathProc(srcProxy);
         pathProc.drawPaths(flushState, pipeline, &dynamicState, *fResources, fBaseInstance,
                            fEndInstance, this->bounds());
     }