ovals now take a const GrPipelineBuilder
authorjoshualitt <joshualitt@chromium.org>
Mon, 13 Jul 2015 15:44:06 +0000 (08:44 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 13 Jul 2015 15:44:06 +0000 (08:44 -0700)
BUG=skia:

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

src/gpu/GrDrawContext.cpp
src/gpu/GrOvalRenderer.cpp
src/gpu/GrOvalRenderer.h

index 2f04a02..77a1867 100644 (file)
@@ -893,7 +893,7 @@ void GrDrawContext::drawRRect(GrRenderTarget*rt,
     GrPipelineBuilder pipelineBuilder(paint, rt, clip);
     GrColor color = paint.getColor();
     if (!GrOvalRenderer::DrawRRect(fDrawTarget,
-                                   &pipelineBuilder,
+                                   pipelineBuilder,
                                    color,
                                    viewMatrix,
                                    paint.isAntiAlias(),
@@ -928,7 +928,7 @@ void GrDrawContext::drawDRRect(GrRenderTarget* rt,
     GrPipelineBuilder pipelineBuilder(paint, rt, clip);
     GrColor color = paint.getColor();
     if (!GrOvalRenderer::DrawDRRect(fDrawTarget,
-                                    &pipelineBuilder,
+                                    pipelineBuilder,
                                     color,
                                     viewMatrix,
                                     paint.isAntiAlias(),
@@ -975,7 +975,7 @@ void GrDrawContext::drawOval(GrRenderTarget* rt,
     GrPipelineBuilder pipelineBuilder(paint, rt, clip);
     GrColor color = paint.getColor();
     if (!GrOvalRenderer::DrawOval(fDrawTarget,
-                                  &pipelineBuilder,
+                                  pipelineBuilder,
                                   color,
                                   viewMatrix,
                                   paint.isAntiAlias(),
@@ -1085,7 +1085,7 @@ void GrDrawContext::drawPath(GrRenderTarget* rt,
 
         if (isOval && !path.isInverseFillType()) {
             if (GrOvalRenderer::DrawOval(fDrawTarget,
-                                         &pipelineBuilder,
+                                         pipelineBuilder,
                                          color,
                                          viewMatrix,
                                          paint.isAntiAlias(),
index a34027c..89f6f5b 100644 (file)
@@ -593,14 +593,13 @@ GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(GrProcessorTestData* d) {
 ///////////////////////////////////////////////////////////////////////////////
 
 bool GrOvalRenderer::DrawOval(GrDrawTarget* target,
-                              GrPipelineBuilder* pipelineBuilder,
+                              const GrPipelineBuilder& pipelineBuilder,
                               GrColor color,
                               const SkMatrix& viewMatrix,
                               bool useAA,
                               const SkRect& oval,
-                              const SkStrokeRec& stroke)
-{
-    bool useCoverageAA = useAA && !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled();
+                              const SkStrokeRec& stroke) {
+    bool useCoverageAA = useAA && !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled();
 
     if (!useCoverageAA) {
         return false;
@@ -824,7 +823,7 @@ static GrBatch* create_circle_batch(GrColor color,
 }
 
 void GrOvalRenderer::DrawCircle(GrDrawTarget* target,
-                                GrPipelineBuilder* pipelineBuilder,
+                                const GrPipelineBuilder& pipelineBuilder,
                                 GrColor color,
                                 const SkMatrix& viewMatrix,
                                 bool useCoverageAA,
@@ -832,7 +831,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);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1080,7 +1079,7 @@ static GrBatch* create_ellipse_batch(GrColor color,
 }
 
 bool GrOvalRenderer::DrawEllipse(GrDrawTarget* target,
-                                 GrPipelineBuilder* pipelineBuilder,
+                                 const GrPipelineBuilder& pipelineBuilder,
                                  GrColor color,
                                  const SkMatrix& viewMatrix,
                                  bool useCoverageAA,
@@ -1092,7 +1091,7 @@ bool GrOvalRenderer::DrawEllipse(GrDrawTarget* target,
         return false;
     }
 
-    target->drawBatch(*pipelineBuilder, batch);
+    target->drawBatch(pipelineBuilder, batch);
     return true;
 }
 
@@ -1325,7 +1324,7 @@ static GrBatch* create_diellipse_batch(GrColor color,
 }
 
 bool GrOvalRenderer::DrawDIEllipse(GrDrawTarget* target,
-                                   GrPipelineBuilder* pipelineBuilder,
+                                   const GrPipelineBuilder& pipelineBuilder,
                                    GrColor color,
                                    const SkMatrix& viewMatrix,
                                    bool useCoverageAA,
@@ -1336,7 +1335,7 @@ bool GrOvalRenderer::DrawDIEllipse(GrDrawTarget* target,
     if (!batch) {
         return false;
     }
-    target->drawBatch(*pipelineBuilder, batch);
+    target->drawBatch(pipelineBuilder, batch);
     return true;
 }
 
@@ -1384,14 +1383,13 @@ static const GrIndexBuffer* ref_rrect_index_buffer(bool strokeOnly,
 }
 
 bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target,
-                                GrPipelineBuilder* pipelineBuilder,
+                                const GrPipelineBuilder& pipelineBuilder,
                                 GrColor color,
                                 const SkMatrix& viewMatrix,
                                 bool useAA,
                                 const SkRRect& origOuter,
                                 const SkRRect& origInner) {
-    bool applyAA = useAA &&
-                   !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled();
+    bool applyAA = useAA && !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled();
     GrPipelineBuilder::AutoRestoreFragmentProcessors arfp;
     if (!origInner.isEmpty()) {
         SkTCopyOnFirstWrite<SkRRect> inner(origInner);
@@ -1408,8 +1406,8 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target,
         if (NULL == fp) {
             return false;
         }
-        arfp.set(pipelineBuilder);
-        pipelineBuilder->addCoverageProcessor(fp)->unref();
+        arfp.set(&pipelineBuilder);
+        arfp.addCoverageProcessor(fp)->unref();
     }
 
     SkStrokeRec fillRec(SkStrokeRec::kFill_InitStyle);
@@ -1431,7 +1429,7 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target,
         return false;
     }
     if (!arfp.isSet()) {
-        arfp.set(pipelineBuilder);
+        arfp.set(&pipelineBuilder);
     }
 
     SkMatrix invert;
@@ -1439,12 +1437,12 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target,
         return false;
     }
 
-    pipelineBuilder->addCoverageProcessor(effect)->unref();
+    arfp.addCoverageProcessor(effect)->unref();
     SkRect bounds = outer->getBounds();
     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;
 }
 
@@ -1952,7 +1950,7 @@ static GrBatch* create_rrect_batch(GrColor color,
 }
 
 bool GrOvalRenderer::DrawRRect(GrDrawTarget* target,
-                               GrPipelineBuilder* pipelineBuilder,
+                               const GrPipelineBuilder& pipelineBuilder,
                                GrColor color,
                                const SkMatrix& viewMatrix,
                                bool useAA,
@@ -1963,7 +1961,7 @@ bool GrOvalRenderer::DrawRRect(GrDrawTarget* target,
                         stroke);
     }
 
-    bool useCoverageAA = useAA && !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled();
+    bool useCoverageAA = useAA && !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled();
 
     // only anti-aliased rrects for now
     if (!useCoverageAA) {
@@ -1979,7 +1977,7 @@ bool GrOvalRenderer::DrawRRect(GrDrawTarget* target,
         return false;
     }
 
-    target->drawBatch(*pipelineBuilder, batch);
+    target->drawBatch(pipelineBuilder, batch);
     return true;
 }
 
index d8d9e0c..d591ffe 100644 (file)
@@ -21,21 +21,21 @@ class SkStrokeRec;
 class GrOvalRenderer {
 public:
     static bool DrawOval(GrDrawTarget*,
-                         GrPipelineBuilder*,
+                         const GrPipelineBuilder&,
                          GrColor,
                          const SkMatrix& viewMatrix,
                          bool useAA,
                          const SkRect& oval,
                          const SkStrokeRec& stroke);
     static bool DrawRRect(GrDrawTarget*,
-                          GrPipelineBuilder*,
+                          const GrPipelineBuilder&,
                           GrColor,
                           const SkMatrix& viewMatrix,
                           bool useAA,
                           const SkRRect& rrect,
                           const SkStrokeRec& stroke);
     static bool DrawDRRect(GrDrawTarget* target,
-                           GrPipelineBuilder*,
+                           const GrPipelineBuilder&,
                            GrColor,
                            const SkMatrix& viewMatrix,
                            bool useAA,
@@ -46,21 +46,21 @@ private:
     GrOvalRenderer();
 
     static bool DrawEllipse(GrDrawTarget* target,
-                            GrPipelineBuilder*,
+                            const GrPipelineBuilder&,
                             GrColor,
                             const SkMatrix& viewMatrix,
                             bool useCoverageAA,
                             const SkRect& ellipse,
                             const SkStrokeRec& stroke);
     static bool DrawDIEllipse(GrDrawTarget* target,
-                              GrPipelineBuilder*,
+                              const GrPipelineBuilder&,
                               GrColor,
                               const SkMatrix& viewMatrix,
                               bool useCoverageAA,
                               const SkRect& ellipse,
                               const SkStrokeRec& stroke);
     static void DrawCircle(GrDrawTarget* target,
-                           GrPipelineBuilder*,
+                           const GrPipelineBuilder&,
                            GrColor,
                            const SkMatrix& viewMatrix,
                            bool useCoverageAA,