Start to propagate constness of GrPipelineBuilder up the stack
authorjoshualitt <joshualitt@chromium.org>
Mon, 13 Jul 2015 15:08:25 +0000 (08:08 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 13 Jul 2015 15:08:25 +0000 (08:08 -0700)
BUG=skia:

Review URL: https://codereview.chromium.org/1229143007

30 files changed:
gm/beziereffects.cpp
gm/constcolorprocessor.cpp
gm/convexpolyeffect.cpp
gm/rrects.cpp
gm/texturedomaineffect.cpp
gm/yuvtorgbeffect.cpp
src/gpu/GrAAConvexPathRenderer.cpp
src/gpu/GrAADistanceFieldPathRenderer.cpp
src/gpu/GrAAHairLinePathRenderer.cpp
src/gpu/GrAALinearizingConvexPathRenderer.cpp
src/gpu/GrAARectRenderer.cpp
src/gpu/GrAARectRenderer.h
src/gpu/GrClipMaskManager.cpp
src/gpu/GrDashLinePathRenderer.cpp
src/gpu/GrDefaultPathRenderer.cpp
src/gpu/GrDrawContext.cpp
src/gpu/GrDrawTarget.cpp
src/gpu/GrDrawTarget.h
src/gpu/GrGpu.h
src/gpu/GrOvalRenderer.cpp
src/gpu/GrSWMaskHelper.cpp
src/gpu/GrSoftwarePathRenderer.cpp
src/gpu/GrStencilAndCoverPathRenderer.cpp
src/gpu/GrTessellatingPathRenderer.cpp
src/gpu/GrTest.cpp
src/gpu/effects/GrDashingEffect.cpp
src/gpu/effects/GrDashingEffect.h
src/gpu/gl/GrGLGpu.cpp
src/gpu/gl/GrGLGpu.h
tests/GLProgramsTest.cpp

index 384889f0c50c74e7c895fca3425c66279601675c..5e00608fa7d7ad41740b43800173a42f7535c0ca 100644 (file)
@@ -229,7 +229,7 @@ protected:
                     SkAutoTUnref<GrBatch> batch(
                             BezierCubicOrConicTestBatch::Create(gp, geometry, klmEqs, klmSigns[c]));
 
-                    tt.target()->drawBatch(&pipelineBuilder, batch);
+                    tt.target()->drawBatch(pipelineBuilder, batch);
                 }
                 ++col;
                 if (numCols == col) {
@@ -374,7 +374,7 @@ protected:
                     SkAutoTUnref<GrBatch> batch(
                             BezierCubicOrConicTestBatch::Create(gp, geometry, klmEqs, 1.f));
 
-                    tt.target()->drawBatch(&pipelineBuilder, batch);
+                    tt.target()->drawBatch(pipelineBuilder, batch);
                 }
                 ++col;
                 if (numCols == col) {
@@ -612,7 +612,7 @@ protected:
 
                     SkAutoTUnref<GrBatch> batch(BezierQuadTestBatch::Create(gp, geometry, DevToUV));
 
-                    tt.target()->drawBatch(&pipelineBuilder, batch);
+                    tt.target()->drawBatch(pipelineBuilder, batch);
                 }
                 ++col;
                 if (numCols == col) {
index 661a5ea8a4b142c97d02f03da8cdff03f61715e7..e763305f3b4a94c10885fd7de742fa7757943d5e 100644 (file)
@@ -115,7 +115,7 @@ protected:
                     GrPipelineBuilder pipelineBuilder(grPaint, rt, clip);
                     pipelineBuilder.addColorProcessor(fp);
 
-                    tt.target()->drawSimpleRect(&pipelineBuilder,
+                    tt.target()->drawSimpleRect(pipelineBuilder,
                                                 grPaint.getColor(),
                                                 viewMatrix,
                                                 renderRect);
index b27f7c20393d6565503e40785de986c28fcefb6e..2c77bceb0ac43fe352e2776ffe8ba514d6f6dab8 100644 (file)
@@ -195,7 +195,7 @@ protected:
 
                 SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geometry));
 
-                tt.target()->drawBatch(&pipelineBuilder, batch);
+                tt.target()->drawBatch(pipelineBuilder, batch);
 
                 x += SkScalarCeilToScalar(path->getBounds().width() + 10.f);
             }
@@ -244,7 +244,7 @@ protected:
 
                 SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geometry));
 
-                tt.target()->drawBatch(&pipelineBuilder, batch);
+                tt.target()->drawBatch(pipelineBuilder, batch);
 
                 x += SkScalarCeilToScalar(rect.width() + 10.f);
             }
index d8d62c4fec95609a8f8e37bfc8f9cf25bd1fc9d6..a2a63086b7e9e1cfb8c12d3bd0df92be7c13f91e 100644 (file)
@@ -120,7 +120,7 @@ protected:
                             SkRect bounds = rrect.getBounds();
                             bounds.outset(2.f, 2.f);
 
-                            tt.target()->drawSimpleRect(&pipelineBuilder,
+                            tt.target()->drawSimpleRect(pipelineBuilder,
                                                         0xff000000,
                                                         SkMatrix::I(),
                                                         bounds);
index 471360428d382d3225200aff71117b5689fc4a12..ed74dd7227f6320454af37fd53b329a6302e6afc 100644 (file)
@@ -130,7 +130,7 @@ protected:
                     pipelineBuilder.setRenderTarget(rt);
                     pipelineBuilder.addColorProcessor(fp);
 
-                    tt.target()->drawSimpleRect(&pipelineBuilder,
+                    tt.target()->drawSimpleRect(pipelineBuilder,
                                                 GrColor_WHITE,
                                                 viewMatrix,
                                                 renderRect);
index 0da1b2411642fa13e370b1f326883dbfcafeb2ec..fff00748eda40e0305b19e0345cb8ee17ad02d44 100644 (file)
@@ -124,7 +124,7 @@ protected:
                     viewMatrix.setTranslate(x, y);
                     pipelineBuilder.setRenderTarget(rt);
                     pipelineBuilder.addColorProcessor(fp);
-                    tt.target()->drawSimpleRect(&pipelineBuilder,
+                    tt.target()->drawSimpleRect(pipelineBuilder,
                                                 GrColor_WHITE,
                                                 viewMatrix,
                                                 renderRect);
index 2d4694cb84af2227856632e8e1139d26bd9b9676..fed6a7afd7451c32605bf82f0dfeb17708dc51cc 100644 (file)
@@ -1001,7 +1001,7 @@ bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target,
     geometry.fPath = path;
 
     SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
-    target->drawBatch(pipelineBuilder, batch);
+    target->drawBatch(*pipelineBuilder, batch);
 
     return true;
 
index c11c641f57116739f241a4d21b385077393f0453..ca0f4e3d651a9eda7939c756eed95a55b0eb2390 100755 (executable)
@@ -583,7 +583,7 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(GrDrawTarget* target,
 
     SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color, viewMatrix,
                                                                  fAtlas, &fPathCache, &fPathList));
-    target->drawBatch(pipelineBuilder, batch);
+    target->drawBatch(*pipelineBuilder, batch);
 
     return true;
 }
index 14770b85317e48b71f2c7c56c162cf656f5aa8b9..8a0c9a4f57fac4625ebb1f09340e8c40d7b662d3 100644 (file)
@@ -983,7 +983,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
 
     SkAutoTUnref<GrBatch> batch(create_hairline_batch(color, viewMatrix, path, stroke,
                                                       devClipBounds));
-    target->drawBatch(pipelineBuilder, batch);
+    target->drawBatch(*pipelineBuilder, batch);
 
     return true;
 }
index f9174cedeb6eea087ab8025a6f22c67b6d6f9af6..31d61a42574b5ba5c4c5003dbd50aa081a640e57 100644 (file)
@@ -318,7 +318,7 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(GrDrawTarget* target,
     geometry.fMiterLimit = stroke.getMiter();
 
     SkAutoTUnref<GrBatch> batch(AAFlatteningConvexPathBatch::Create(geometry));
-    target->drawBatch(pipelineBuilder, batch);
+    target->drawBatch(*pipelineBuilder, batch);
 
     return true;
 }
index 64f587fce3623d82e8179b2aad7915fd3614c651..f59b61125bf229dd4ae6f29eb1e437904ab1b645 100644 (file)
@@ -314,7 +314,7 @@ enum CoverageAttribType {
 }
 
 void GrAARectRenderer::GeometryFillAARect(GrDrawTarget* target,
-                                          GrPipelineBuilder* pipelineBuilder,
+                                          const GrPipelineBuilder& pipelineBuilder,
                                           GrColor color,
                                           const SkMatrix& viewMatrix,
                                           const SkRect& rect,
@@ -331,7 +331,7 @@ void GrAARectRenderer::GeometryFillAARect(GrDrawTarget* target,
 }
 
 void GrAARectRenderer::StrokeAARect(GrDrawTarget* target,
-                                    GrPipelineBuilder* pipelineBuilder,
+                                    const GrPipelineBuilder& pipelineBuilder,
                                     GrColor color,
                                     const SkMatrix& viewMatrix,
                                     const SkRect& rect,
@@ -773,7 +773,7 @@ private:
 };
 
 void GrAARectRenderer::GeometryStrokeAARect(GrDrawTarget* target,
-                                            GrPipelineBuilder* pipelineBuilder,
+                                            const GrPipelineBuilder& pipelineBuilder,
                                             GrColor color,
                                             const SkMatrix& viewMatrix,
                                             const SkRect& devOutside,
@@ -792,7 +792,7 @@ void GrAARectRenderer::GeometryStrokeAARect(GrDrawTarget* target,
 }
 
 void GrAARectRenderer::FillAANestedRects(GrDrawTarget* target,
-                                         GrPipelineBuilder* pipelineBuilder,
+                                         const GrPipelineBuilder& pipelineBuilder,
                                          GrColor color,
                                          const SkMatrix& viewMatrix,
                                          const SkRect rects[2]) {
index 8f426716625f35aa4f0d6d1c3156a4a9b92cb685..6115439ad7fce2a7b244ef67de540d23cb782d07 100644 (file)
@@ -27,7 +27,7 @@ public:
     // between them by passing in stroke (==NULL means fill).
 
     static void FillAARect(GrDrawTarget* target,
-                           GrPipelineBuilder* pipelineBuilder,
+                           const GrPipelineBuilder& pipelineBuilder,
                            GrColor color,
                            const SkMatrix& viewMatrix,
                            const SkRect& rect,
@@ -36,7 +36,7 @@ public:
     }
 
     static void StrokeAARect(GrDrawTarget*,
-                             GrPipelineBuilder*,
+                             const GrPipelineBuilder&,
                              GrColor,
                              const SkMatrix& viewMatrix,
                              const SkRect& rect,
@@ -45,7 +45,7 @@ public:
 
     // First rect is outer; second rect is inner
     static void FillAANestedRects(GrDrawTarget*,
-                                  GrPipelineBuilder*,
+                                  const GrPipelineBuilder&,
                                   GrColor,
                                   const SkMatrix& viewMatrix,
                                   const SkRect rects[2]);
@@ -54,14 +54,14 @@ private:
     GrAARectRenderer();
 
     static void GeometryFillAARect(GrDrawTarget*,
-                                   GrPipelineBuilder*,
+                                   const GrPipelineBuilder&,
                                    GrColor,
                                    const SkMatrix& viewMatrix,
                                    const SkRect& rect,
                                    const SkRect& devRect);
 
     static void GeometryStrokeAARect(GrDrawTarget*,
-                                     GrPipelineBuilder*,
+                                     const GrPipelineBuilder&,
                                      GrColor,
                                      const SkMatrix& viewMatrix,
                                      const SkRect& devOutside,
index 208581e6ff706dbdaaad3a63a1117fd2f756586a..d7501c3adf4b8ca9b76096a99eba202ed70d8559 100644 (file)
@@ -409,10 +409,10 @@ bool GrClipMaskManager::drawElement(GrPipelineBuilder* pipelineBuilder,
                 SkRect devRect = element->getRect();
                 viewMatrix.mapRect(&devRect);
 
-                fClipTarget->drawAARect(pipelineBuilder, color, viewMatrix,
+                fClipTarget->drawAARect(*pipelineBuilder, color, viewMatrix,
                                         element->getRect(), devRect);
             } else {
-                fClipTarget->drawSimpleRect(pipelineBuilder, color, viewMatrix,
+                fClipTarget->drawSimpleRect(*pipelineBuilder, color, viewMatrix,
                                             element->getRect());
             }
             return true;
@@ -492,7 +492,7 @@ void GrClipMaskManager::mergeMask(GrPipelineBuilder* pipelineBuilder,
                                       GrTextureParams::kNone_FilterMode))->unref();
 
     // The color passed in here does not matter since the coverageSetOpXP won't read it.
-    fClipTarget->drawSimpleRect(pipelineBuilder,
+    fClipTarget->drawSimpleRect(*pipelineBuilder,
                                 GrColor_WHITE,
                                 SkMatrix::I(),
                                 SkRect::Make(dstBound));
@@ -686,7 +686,7 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
                 backgroundPipelineBuilder.setStencil(kDrawOutsideElement);
 
                 // The color passed in here does not matter since the coverageSetOpXP won't read it.
-                fClipTarget->drawSimpleRect(&backgroundPipelineBuilder, GrColor_WHITE, translate,
+                fClipTarget->drawSimpleRect(backgroundPipelineBuilder, GrColor_WHITE, translate,
                                             clipSpaceIBounds);
             }
         } else {
@@ -823,7 +823,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
                     *pipelineBuilder.stencil() = gDrawToStencil;
 
                     // We need this AGP until everything is in GrBatch
-                    fClipTarget->drawSimpleRect(&pipelineBuilder,
+                    fClipTarget->drawSimpleRect(pipelineBuilder,
                                                 GrColor_WHITE,
                                                 viewMatrix,
                                                 element->getRect());
@@ -850,7 +850,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
                 if (canDrawDirectToClip) {
                     if (Element::kRect_Type == element->getType()) {
                         // We need this AGP until everything is in GrBatch
-                        fClipTarget->drawSimpleRect(&pipelineBuilder,
+                        fClipTarget->drawSimpleRect(pipelineBuilder,
                                                     GrColor_WHITE,
                                                     viewMatrix,
                                                     element->getRect());
@@ -861,7 +861,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
                 } else {
                     // The view matrix is setup to do clip space -> stencil space translation, so
                     // draw rect in clip space.
-                    fClipTarget->drawSimpleRect(&pipelineBuilder,
+                    fClipTarget->drawSimpleRect(pipelineBuilder,
                                                 GrColor_WHITE,
                                                 viewMatrix,
                                                 SkRect::Make(clipSpaceIBounds));
index c27e61b70fe779d1c4b02a418c362b7f0d84aafe..17c189028b0280d0d73db24b85d7e6deb8f2797f 100644 (file)
@@ -32,6 +32,6 @@ bool GrDashLinePathRenderer::onDrawPath(GrDrawTarget* target,
                                         bool useAA) {
     SkPoint pts[2];
     SkAssertResult(path.isLine(pts));
-    return GrDashingEffect::DrawDashLine(target, pipelineBuilder, color,
+    return GrDashingEffect::DrawDashLine(target, *pipelineBuilder, color,
                                          viewMatrix, pts, useAA, stroke);
 }
index 2431696d068511a2c8ceb2e06d293a0c054a95e1..e02e082b56a71627080d9d81b418b2c899700784 100644 (file)
@@ -678,7 +678,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
             }
             const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() :
                                                                                viewMatrix;
-            target->drawBWRect(pipelineBuilder, color, viewM, bounds, NULL, &localMatrix);
+            target->drawBWRect(*pipelineBuilder, color, viewM, bounds, NULL, &localMatrix);
         } else {
             if (passCount > 1) {
                 pipelineBuilder->setDisableColorXPFactory();
@@ -692,7 +692,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
             SkAutoTUnref<GrBatch> batch(DefaultPathBatch::Create(geometry, newCoverage, viewMatrix,
                                                                  isHairline, devBounds));
 
-            target->drawBatch(pipelineBuilder, batch);
+            target->drawBatch(*pipelineBuilder, batch);
         }
     }
     return true;
index 0c00b3212801f83ba90bed14d657dfc5a76fd3ad..2f04a02651c91b90f8cb01d218d5cd93aa3490a9 100644 (file)
@@ -116,7 +116,7 @@ void GrDrawContext::drawPaths(GrPipelineBuilder* pipelineBuilder,
                               int /*GrDrawTarget::PathTransformType*/ transformType,
                               int count,
                               int /*GrPathRendering::FillType*/ fill) {
-    fDrawTarget->drawPaths(pipelineBuilder, pathProc, pathRange,
+    fDrawTarget->drawPaths(*pipelineBuilder, pathProc, pathRange,
                            indices, (GrDrawTarget::PathIndexType) indexType,
                            transformValues,
                            (GrDrawTarget::PathTransformType) transformType,
@@ -192,7 +192,7 @@ void GrDrawContext::drawPaint(GrRenderTarget* rt,
         }
 
         GrPipelineBuilder pipelineBuilder(*paint, rt, clip);
-        fDrawTarget->drawBWRect(&pipelineBuilder,
+        fDrawTarget->drawBWRect(pipelineBuilder,
                                 paint->getColor(),
                                 SkMatrix::I(),
                                 r,
@@ -487,7 +487,7 @@ void GrDrawContext::drawRect(GrRenderTarget* rt,
     if (doAA) {
         if (width >= 0) {
             GrAARectRenderer::StrokeAARect(fDrawTarget,
-                                           &pipelineBuilder,
+                                           pipelineBuilder,
                                            color,
                                            viewMatrix,
                                            rect,
@@ -496,7 +496,7 @@ void GrDrawContext::drawRect(GrRenderTarget* rt,
         } else {
             // filled AA rect
             GrAARectRenderer::FillAARect(fDrawTarget,
-                                         &pipelineBuilder,
+                                         pipelineBuilder,
                                          color,
                                          viewMatrix,
                                          rect,
@@ -521,10 +521,10 @@ void GrDrawContext::drawRect(GrRenderTarget* rt,
         // is enabled because it can cause ugly artifacts.
         pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_Flag,
                                  snapToPixelCenters);
-        fDrawTarget->drawBatch(&pipelineBuilder, batch);
+        fDrawTarget->drawBatch(pipelineBuilder, batch);
     } else {
         // filled BW rect
-        fDrawTarget->drawSimpleRect(&pipelineBuilder, color, viewMatrix, rect);
+        fDrawTarget->drawSimpleRect(pipelineBuilder, color, viewMatrix, rect);
     }
 }
 
@@ -542,7 +542,7 @@ void GrDrawContext::drawNonAARectToRect(GrRenderTarget* rt,
     }
 
     GrPipelineBuilder pipelineBuilder(paint, rt, clip);
-    fDrawTarget->drawBWRect(&pipelineBuilder,
+    fDrawTarget->drawBWRect(pipelineBuilder,
                             paint.getColor(),
                             viewMatrix,
                             rectToDraw,
@@ -861,7 +861,7 @@ void GrDrawContext::drawVertices(GrRenderTarget* rt,
                                                           indexCount, colors, texCoords,
                                                           bounds));
 
-    fDrawTarget->drawBatch(&pipelineBuilder, batch);
+    fDrawTarget->drawBatch(pipelineBuilder, batch);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1075,7 +1075,7 @@ void GrDrawContext::drawPath(GrRenderTarget* rt,
             SkRect rects[2];
 
             if (is_nested_rects(viewMatrix, path, strokeInfo, rects)) {
-                GrAARectRenderer::FillAANestedRects(fDrawTarget, &pipelineBuilder, color,
+                GrAARectRenderer::FillAANestedRects(fDrawTarget, pipelineBuilder, color,
                                                     viewMatrix, rects);
                 return;
             }
@@ -1188,7 +1188,7 @@ bool GrDrawContext::prepareToDraw(GrRenderTarget* rt) {
 }
 
 void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrBatch* batch) {
-    fDrawTarget->drawBatch(pipelineBuilder, batch);
+    fDrawTarget->drawBatch(*pipelineBuilder, batch);
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
index 4763ca73844dae7e0223ade938cb153ca6d88a41..ba06c66e8b063c542cb523d53174204ce9d8e9d2 100644 (file)
@@ -126,9 +126,7 @@ void GrDrawTarget::flush() {
     this->reset();
 }
 
-void GrDrawTarget::drawBatch(GrPipelineBuilder* pipelineBuilder,
-                             GrBatch* batch) {
-    SkASSERT(pipelineBuilder);
+void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrBatch* batch) {
     // TODO some kind of checkdraw, but not at this level
 
     // Setup clip
@@ -189,14 +187,13 @@ void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType f
     this->clipMaskManager()->adjustPathStencilParams(sb, outStencilSettings);
 }
 
-void GrDrawTarget::stencilPath(GrPipelineBuilder* pipelineBuilder,
+void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
                                const GrPathProcessor* pathProc,
                                const GrPath* path,
                                GrPathRendering::FillType fill) {
     // TODO: extract portions of checkDraw that are relevant to path stenciling.
     SkASSERT(path);
     SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
-    SkASSERT(pipelineBuilder);
 
     // Setup clip
     GrScissorState scissorState;
@@ -209,21 +206,20 @@ void GrDrawTarget::stencilPath(GrPipelineBuilder* pipelineBuilder,
 
     // set stencil settings for path
     GrStencilSettings stencilSettings;
-    GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
+    GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
     GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
     this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
 
-    this->onStencilPath(*pipelineBuilder, pathProc, path, scissorState, stencilSettings);
+    this->onStencilPath(pipelineBuilder, pathProc, path, scissorState, stencilSettings);
 }
 
-void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder,
+void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder,
                             const GrPathProcessor* pathProc,
                             const GrPath* path,
                             GrPathRendering::FillType fill) {
     // TODO: extract portions of checkDraw that are relevant to path rendering.
     SkASSERT(path);
     SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
-    SkASSERT(pipelineBuilder);
 
     SkRect devBounds = path->getBounds();
     pathProc->viewMatrix().mapRect(&devBounds);
@@ -239,7 +235,7 @@ void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder,
 
     // set stencil settings for path
     GrStencilSettings stencilSettings;
-    GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
+    GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
     GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
     this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
 
@@ -252,7 +248,7 @@ void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder,
     this->onDrawPath(pathProc, path, stencilSettings, pipelineInfo);
 }
 
-void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
+void GrDrawTarget::drawPaths(const GrPipelineBuilder& pipelineBuilder,
                              const GrPathProcessor* pathProc,
                              const GrPathRange* pathRange,
                              const void* indices,
@@ -266,7 +262,6 @@ void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
     SkASSERT(indices);
     SkASSERT(0 == reinterpret_cast<long>(indices) % GrPathRange::PathIndexSizeInBytes(indexType));
     SkASSERT(transformValues);
-    SkASSERT(pipelineBuilder);
 
     // Setup clip
     GrScissorState scissorState;
@@ -279,7 +274,7 @@ void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
 
     // set stencil settings for path
     GrStencilSettings stencilSettings;
-    GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
+    GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
     GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
     this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
 
@@ -296,18 +291,18 @@ void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
                       transformType, count, stencilSettings, pipelineInfo);
 }
 
-void GrDrawTarget::drawBWRect(GrPipelineBuilder* pipelineBuilder,
-                            GrColor color,
-                            const SkMatrix& viewMatrix,
-                            const SkRect& rect,
-                            const SkRect* localRect,
-                            const SkMatrix* localMatrix) {
+void GrDrawTarget::drawBWRect(const GrPipelineBuilder& pipelineBuilder,
+                              GrColor color,
+                              const SkMatrix& viewMatrix,
+                              const SkRect& rect,
+                              const SkRect* localRect,
+                              const SkMatrix* localMatrix) {
    SkAutoTUnref<GrBatch> batch(GrRectBatch::Create(color, viewMatrix, rect, localRect,
                                                    localMatrix));
    this->drawBatch(pipelineBuilder, batch);
 }
 
-void GrDrawTarget::drawAARect(GrPipelineBuilder* pipelineBuilder,
+void GrDrawTarget::drawAARect(const GrPipelineBuilder& pipelineBuilder,
                               GrColor color,
                               const SkMatrix& viewMatrix,
                               const SkRect& rect,
@@ -333,7 +328,7 @@ void GrDrawTarget::clear(const SkIRect* rect,
         GrPipelineBuilder pipelineBuilder;
         pipelineBuilder.setRenderTarget(renderTarget);
 
-        this->drawSimpleRect(&pipelineBuilder, color, SkMatrix::I(), *rect);
+        this->drawSimpleRect(pipelineBuilder, color, SkMatrix::I(), *rect);
     } else {       
         this->onClear(rect, color, canIgnoreRect, renderTarget);
     }
@@ -466,12 +461,12 @@ void GrDrawTarget::setupPipeline(const PipelineInfo& pipelineInfo,
 }
 ///////////////////////////////////////////////////////////////////////////////
 
-GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder,
+GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder& pipelineBuilder,
                                          GrScissorState* scissor,
                                          const GrPrimitiveProcessor* primProc,
                                          const SkRect* devBounds,
                                          GrDrawTarget* target)
-    : fPipelineBuilder(pipelineBuilder)
+    : fPipelineBuilder(&pipelineBuilder)
     , fScissor(scissor) {
     fColorPOI = fPipelineBuilder->colorProcInfo(primProc);
     fCoveragePOI = fPipelineBuilder->coverageProcInfo(primProc);
@@ -481,12 +476,12 @@ GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder,
     }
 }
 
-GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder,
+GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder& pipelineBuilder,
                                          GrScissorState* scissor,
                                          const GrBatch* batch,
                                          const SkRect* devBounds,
                                          GrDrawTarget* target)
-    : fPipelineBuilder(pipelineBuilder)
+    : fPipelineBuilder(&pipelineBuilder)
     , fScissor(scissor) {
     fColorPOI = fPipelineBuilder->colorProcInfo(batch);
     fCoveragePOI = fPipelineBuilder->coverageProcInfo(batch);
@@ -504,13 +499,13 @@ GrClipTarget::GrClipTarget(GrContext* context)
 }
 
 
-bool GrClipTarget::setupClip(GrPipelineBuilder* pipelineBuilder,
+bool GrClipTarget::setupClip(const GrPipelineBuilder& pipelineBuilder,
                              GrPipelineBuilder::AutoRestoreFragmentProcessors* arfp,
                              GrPipelineBuilder::AutoRestoreStencil* ars,
                              GrPipelineBuilder::AutoRestoreProcessorDataManager* arpdm,
                              GrScissorState* scissorState,
                              const SkRect* devBounds) {
-    return fClipMaskManager->setupClipping(*pipelineBuilder,
+    return fClipMaskManager->setupClipping(pipelineBuilder,
                                            arfp,
                                            ars,
                                            arpdm,
index 634a492e161941f2fb3a103201c3495b7186db68..2265f614b174e4e6aeecd786df29bd044e96c464 100644 (file)
@@ -66,7 +66,7 @@ public:
      */
     const GrCaps* caps() const { return fCaps; }
 
-    void drawBatch(GrPipelineBuilder*, GrBatch*);
+    void drawBatch(const GrPipelineBuilder&, GrBatch*);
 
     /**
      * Draws path into the stencil buffer. The fill must be either even/odd or
@@ -74,14 +74,14 @@ public:
      * on the GrPipelineBuilder (if possible in the 3D API).  Note, we will never have an inverse
      * fill with stencil path
      */
-    void stencilPath(GrPipelineBuilder*, const GrPathProcessor*, const GrPath*,
+    void stencilPath(const GrPipelineBuilder&, const GrPathProcessor*, const GrPath*,
                      GrPathRendering::FillType);
 
     /**
      * Draws a path. Fill must not be a hairline. It will respect the HW
      * antialias flag on the GrPipelineBuilder (if possible in the 3D API).
      */
-    void drawPath(GrPipelineBuilder*, const GrPathProcessor*, const GrPath*,
+    void drawPath(const GrPipelineBuilder&, const GrPathProcessor*, const GrPath*,
                   GrPathRendering::FillType);
 
     /**
@@ -97,7 +97,7 @@ public:
      * @param count           Number of paths to draw
      * @param fill            Fill type for drawing all the paths
      */
-    void drawPaths(GrPipelineBuilder*,
+    void drawPaths(const GrPipelineBuilder&,
                    const GrPathProcessor*,
                    const GrPathRange* pathRange,
                    const void* indices,
@@ -118,7 +118,7 @@ public:
      *                    that rectangle before it is input to GrCoordTransforms that read local
      *                    coordinates
      */
-    void drawBWRect(GrPipelineBuilder* pipelineBuilder,
+    void drawBWRect(const GrPipelineBuilder& pipelineBuilder,
                     GrColor color,
                     const SkMatrix& viewMatrix,
                     const SkRect& rect,
@@ -128,17 +128,17 @@ public:
     /**
      * Helper for drawRect when the caller doesn't need separate local rects or matrices.
      */
-    void drawSimpleRect(GrPipelineBuilder* ds, GrColor color, const SkMatrix& viewM,
+    void drawSimpleRect(const GrPipelineBuilder& ds, GrColor color, const SkMatrix& viewM,
                         const SkRect& rect) {
         this->drawBWRect(ds, color, viewM, rect, NULL, NULL);
     }
-    void drawSimpleRect(GrPipelineBuilder* ds, GrColor color, const SkMatrix& viewM,
+    void drawSimpleRect(const GrPipelineBuilder& ds, GrColor color, const SkMatrix& viewM,
                         const SkIRect& irect) {
         SkRect rect = SkRect::Make(irect);
         this->drawBWRect(ds, color, viewM, rect, NULL, NULL);
     }
 
-    void drawAARect(GrPipelineBuilder* pipelineBuilder,
+    void drawAARect(const GrPipelineBuilder& pipelineBuilder,
                     GrColor color,
                     const SkMatrix& viewMatrix,
                     const SkRect& rect,
@@ -221,11 +221,11 @@ protected:
                                  const SkRect* drawBounds);
 
     struct PipelineInfo {
-        PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor,
+        PipelineInfo(const GrPipelineBuilder& pipelineBuilder, GrScissorState* scissor,
                      const GrPrimitiveProcessor* primProc,
                      const SkRect* devBounds, GrDrawTarget* target);
 
-        PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor,
+        PipelineInfo(const GrPipelineBuilder& pipelineBuilder, GrScissorState* scissor,
                      const GrBatch* batch, const SkRect* devBounds,
                      GrDrawTarget* target);
 
@@ -237,7 +237,7 @@ protected:
 
         bool mustSkipDraw() const { return (NULL == fPipelineBuilder); }
 
-        GrPipelineBuilder*          fPipelineBuilder;
+        const GrPipelineBuilder*    fPipelineBuilder;
         GrScissorState*             fScissor;
         GrProcOptInfo               fColorPOI; 
         GrProcOptInfo               fCoveragePOI; 
@@ -287,7 +287,7 @@ private:
                                            const GrStencilAttachment*,
                                            GrStencilSettings*);
     virtual GrClipMaskManager* clipMaskManager() = 0;
-    virtual bool setupClip(GrPipelineBuilder*,
+    virtual bool setupClip(const GrPipelineBuilder&,
                            GrPipelineBuilder::AutoRestoreFragmentProcessors*,
                            GrPipelineBuilder::AutoRestoreStencil*,
                            GrPipelineBuilder::AutoRestoreProcessorDataManager*,
@@ -340,7 +340,7 @@ protected:
 private:
     GrClipMaskManager* clipMaskManager() override { return fClipMaskManager; }
 
-    bool setupClip(GrPipelineBuilder*,
+    bool setupClip(const GrPipelineBuilder&,
                    GrPipelineBuilder::AutoRestoreFragmentProcessors*,
                    GrPipelineBuilder::AutoRestoreStencil*,
                    GrPipelineBuilder::AutoRestoreProcessorDataManager*,
index 0ce6bea4e63ea813db3ae41c7e2d0054d92e19c1..b8bec3a6096cccf635d48eeca2cc443024d67904 100644 (file)
@@ -245,7 +245,7 @@ public:
      * efficiently succeed. It should only succeed if it can allow copySurface to perform a copy
      * that would be more effecient than drawing the src to a dst render target.
      */
-    virtual bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) = 0;
+    virtual bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const = 0;
 
     // After the client interacts directly with the 3D context state the GrGpu
     // must resync its internal state and assumptions about 3D context state.
index 0d7da2ebcf798b273f2c38f84c6179785c0327f3..a34027cd1da719c0b51fc6905a3c06e6db8385b3 100644 (file)
@@ -832,7 +832,7 @@ void GrOvalRenderer::DrawCircle(GrDrawTarget* target,
                                 const SkStrokeRec& stroke) {
     SkAutoTUnref<GrBatch> batch(create_circle_batch(color, viewMatrix, useCoverageAA, circle,
                                                     stroke));
-    target->drawBatch(pipelineBuilder, batch);
+    target->drawBatch(*pipelineBuilder, batch);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1092,7 +1092,7 @@ bool GrOvalRenderer::DrawEllipse(GrDrawTarget* target,
         return false;
     }
 
-    target->drawBatch(pipelineBuilder, batch);
+    target->drawBatch(*pipelineBuilder, batch);
     return true;
 }
 
@@ -1336,7 +1336,7 @@ bool GrOvalRenderer::DrawDIEllipse(GrDrawTarget* target,
     if (!batch) {
         return false;
     }
-    target->drawBatch(pipelineBuilder, batch);
+    target->drawBatch(*pipelineBuilder, batch);
     return true;
 }
 
@@ -1444,7 +1444,7 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target,
     if (applyAA) {
         bounds.outset(SK_ScalarHalf, SK_ScalarHalf);
     }
-    target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), bounds, NULL, &invert);
+    target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), bounds, NULL, &invert);
     return true;
 }
 
@@ -1979,7 +1979,7 @@ bool GrOvalRenderer::DrawRRect(GrDrawTarget* target,
         return false;
     }
 
-    target->drawBatch(pipelineBuilder, batch);
+    target->drawBatch(*pipelineBuilder, batch);
     return true;
 }
 
index 28071d2f44b2e9168af4edcea59072a023a62b0f..0e0a5413d272b84cd1efcb9c59657850c7e2323c 100644 (file)
@@ -374,5 +374,5 @@ void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
                                                        GrTextureParams::kNone_FilterMode,
                                                        kDevice_GrCoordSet))->unref();
 
-    target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), dstRect, NULL, &invert);
+    target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), dstRect, NULL, &invert);
 }
index 3d5bc3e6561be7dc2e5f390763a27d7697e26bd1..5389a9bcb6b21921d6b7d0183567567d3910c341 100644 (file)
@@ -94,22 +94,22 @@ void draw_around_inv_path(GrDrawTarget* target,
     if (devClipBounds.fTop < devPathBounds.fTop) {
         rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
                   devClipBounds.fRight, devPathBounds.fTop);
-        target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
+        target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
     }
     if (devClipBounds.fLeft < devPathBounds.fLeft) {
         rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
                   devPathBounds.fLeft, devPathBounds.fBottom);
-        target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
+        target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
     }
     if (devClipBounds.fRight > devPathBounds.fRight) {
         rect.iset(devPathBounds.fRight, devPathBounds.fTop,
                   devClipBounds.fRight, devPathBounds.fBottom);
-        target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
+        target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
     }
     if (devClipBounds.fBottom > devPathBounds.fBottom) {
         rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
                   devClipBounds.fRight, devClipBounds.fBottom);
-        target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
+        target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
     }
 }
 
index 248730bde17430c7fc5b8eaa31721fa140ccbc31..fb373606e7e0df3fcc0c4e86c95c2d261c31530a 100644 (file)
@@ -98,7 +98,7 @@ void GrStencilAndCoverPathRenderer::onStencilPath(GrDrawTarget* target,
     SkASSERT(!path.isInverseFillType());
     SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE, viewMatrix));
     SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, stroke));
-    target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
+    target->stencilPath(*pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
 }
 
 bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
@@ -134,7 +134,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
 
         // fake inverse with a stencil and cover
         SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE, viewMatrix));
-        target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
+        target->stencilPath(*pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
 
         SkMatrix invert = SkMatrix::I();
         SkRect bounds =
@@ -154,7 +154,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
             }
         }
         const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : viewMatrix;
-        target->drawBWRect(pipelineBuilder, color, viewM, bounds, NULL, &invert);
+        target->drawBWRect(*pipelineBuilder, color, viewM, bounds, NULL, &invert);
     } else {
         GR_STATIC_CONST_SAME_STENCIL(kStencilPass,
             kZero_StencilOp,
@@ -166,7 +166,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
 
         pipelineBuilder->setStencil(kStencilPass);
         SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatrix));
-        target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
+        target->drawPath(*pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
     }
 
     pipelineBuilder->stencil()->setDisabled();
index de5dcab8ab9c2ca683d72c9eb6b4fb028be28950..f420372ca516c708c89d1ea6152ea02b94903f11 100644 (file)
@@ -1511,7 +1511,7 @@ bool GrTessellatingPathRenderer::onDrawPath(GrDrawTarget* target,
     }
     vmi.mapRect(&clipBounds);
     SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM, clipBounds));
-    target->drawBatch(pipelineBuilder, batch);
+    target->drawBatch(*pipelineBuilder, batch);
 
     return true;
 }
index 5a3c014413a1ac0ac4ae67af39806e123d1001de..b070d8412a2cdfb5302d8628b5e941ee3d44baea 100644 (file)
@@ -166,7 +166,7 @@ public:
                      const SkIRect& srcRect,
                      const SkIPoint& dstPoint) override { return false; };
 
-    bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) override {
+    bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override {
         return false;
     }
 
index 26a2506b834ab2a3efa124036d944d7d3e5404dc..18cd3d12ac35e73ab5d380110ef0cc44252ea3ed 100644 (file)
@@ -728,11 +728,12 @@ static GrBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const Sk
 }
 
 bool GrDashingEffect::DrawDashLine(GrDrawTarget* target,
-                                   GrPipelineBuilder* pipelineBuilder, GrColor color,
+                                   const GrPipelineBuilder& pipelineBuilder, GrColor color,
                                    const SkMatrix& viewMatrix, const SkPoint pts[2],
                                    bool useAA, const GrStrokeInfo& strokeInfo) {
-    SkAutoTUnref<GrBatch> batch(create_batch(color, viewMatrix, pts, useAA, strokeInfo,
-                                    pipelineBuilder->getRenderTarget()->isUnifiedMultisampled()));
+    SkAutoTUnref<GrBatch> batch(
+            create_batch(color, viewMatrix, pts, useAA, strokeInfo,
+                         pipelineBuilder.getRenderTarget()->isUnifiedMultisampled()));
     if (!batch) {
         return false;
     }
index 05b1c9020542a2e6e9534f44390cde5f1079e7fc..7d0d006f1b56e93ff287cf11dd11ee28cd063c9a 100644 (file)
@@ -20,7 +20,7 @@ class GrPipelineBuilder;
 class GrStrokeInfo;
 
 namespace GrDashingEffect {
-    bool DrawDashLine(GrDrawTarget*, GrPipelineBuilder*, GrColor,
+    bool DrawDashLine(GrDrawTarget*, const GrPipelineBuilder&, GrColor,
                       const SkMatrix& viewMatrix, const SkPoint pts[2], bool useAA,
                       const GrStrokeInfo& strokeInfo);
     bool CanDrawDashLine(const SkPoint pts[2], const GrStrokeInfo& strokeInfo,
index e185ef01a56c11e760b07006c82ef8748b188e4a..7320d2e30eeeb0b8d1bf04aa1e930547977ca2e5 100644 (file)
@@ -2676,7 +2676,7 @@ void GrGLGpu::unbindTextureFromFBO(GrGLenum fboTarget) {
                                                          0));
 }
 
-bool GrGLGpu::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) {
+bool GrGLGpu::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const {
     // If the src is a texture, we can implement the blit as a draw assuming the config is
     // renderable.
     if (src->asTexture() && this->caps()->isConfigRenderable(src->config(), false)) {
index 368bda17974da63ff36417d761ca713ecb336352..baafea3f1ee97e00ef29ca263741b850c9d890e7 100644 (file)
@@ -70,7 +70,7 @@ public:
                                    size_t rowBytes) const override;
     bool fullReadPixelsIsFasterThanPartial() const override;
 
-    bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) override;
+    bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override;
 
     // These functions should be used to bind GL objects. They track the GL state and skip redundant
     // bindings. Making the equivalent glBind calls directly will confuse the state tracking.
index 7eb5315166fd468947f10663ccf1da5a8e99bc37..d21ae5d4cd8f0d16ca4d13ec48a8b54a7ed364cb 100644 (file)
@@ -251,7 +251,7 @@ bool GrDrawTarget::programUnitTest(GrContext* context, int maxStages) {
         set_random_state(&pipelineBuilder, &random);
         set_random_stencil(&pipelineBuilder, &random);
 
-        this->drawBatch(&pipelineBuilder, batch);
+        this->drawBatch(pipelineBuilder, batch);
     }
 
     // Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes)