Cosmetic portion of reverted "Fix ClipMaskManager's SW-fallback logic" CL
authorrobertphillips <robertphillips@google.com>
Tue, 27 Oct 2015 14:53:35 +0000 (07:53 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 27 Oct 2015 14:53:35 +0000 (07:53 -0700)
This CL isolates the cosmetic portion so the functional portion is clearer. It relies on https://codereview.chromium.org/1412883005/ (Fix ClipMaskManager's SW-fallback logic (take 2))

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

include/gpu/GrContext.h
include/gpu/GrPathRendererChain.h
src/gpu/GrClipMaskManager.cpp
src/gpu/GrContext.cpp
src/gpu/GrDrawContext.cpp
src/gpu/GrPathRendererChain.cpp

index b886560..1e160c6 100644 (file)
@@ -334,7 +334,7 @@ public:
     void getTestTarget(GrTestTarget*);
 
     GrPathRenderer* getPathRenderer(
-                    const GrPipelineBuilder*,
+                    const GrPipelineBuilder&,
                     const SkMatrix& viewMatrix,
                     const SkPath& path,
                     const GrStrokeInfo& stroke,
index a50160f..98441ce 100644 (file)
@@ -56,7 +56,7 @@ public:
         whether the path can be rendered with arbitrary stencil rules or not. See comments on
         StencilSupport in GrPathRenderer.h. */
     GrPathRenderer* getPathRenderer(const GrShaderCaps* shaderCaps,
-                                    const GrPipelineBuilder*,
+                                    const GrPipelineBuilder&,
                                     const SkMatrix& viewMatrix,
                                     const SkPath& path,
                                     const GrStrokeInfo& stroke,
index 5c493aa..2847f09 100644 (file)
@@ -87,7 +87,7 @@ static bool path_needs_SW_renderer(GrContext* context,
         }
     
         // the 'false' parameter disallows use of the SW path renderer
-        GrPathRenderer* pr = context->getPathRenderer(&pipelineBuilder, viewMatrix, path,
+        GrPathRenderer* pr = context->getPathRenderer(pipelineBuilder, viewMatrix, path,
                                                       stroke, false, type);
         if (tryStencilFirst && !pr) {
             // If the path can't be stenciled, createAlphaClipMask falls back to color rendering
@@ -96,7 +96,7 @@ static bool path_needs_SW_renderer(GrContext* context,
                             ? GrPathRendererChain::kColorAntiAlias_DrawType
                             : GrPathRendererChain::kColor_DrawType;  
 
-            pr = context->getPathRenderer(&pipelineBuilder, viewMatrix, path, stroke, false, type);
+            pr = context->getPathRenderer(pipelineBuilder, viewMatrix, path, stroke, false, type);
         }
 
         if (prOut) {
@@ -127,8 +127,7 @@ bool GrClipMaskManager::useSWOnlyPath(const GrPipelineBuilder& pipelineBuilder,
 
     // Set the matrix so that rendered clip elements are transformed to mask space from clip
     // space.
-    SkMatrix translate;
-    translate.setTranslate(clipToMaskOffset);
+    const SkMatrix translate = SkMatrix::MakeTrans(clipToMaskOffset.fX, clipToMaskOffset.fY);
 
     for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.get(); iter.next()) {
         const Element* element = iter.get();
@@ -452,7 +451,7 @@ bool GrClipMaskManager::drawElement(GrPipelineBuilder* pipelineBuilder,
                 GrPathRendererChain::DrawType type;
                 type = element->isAA() ? GrPathRendererChain::kColorAntiAlias_DrawType :
                                          GrPathRendererChain::kColor_DrawType;
-                pr = this->getContext()->getPathRenderer(pipelineBuilder, viewMatrix,
+                pr = this->getContext()->getPathRenderer(*pipelineBuilder, viewMatrix,
                                                          path, stroke, false, type);
             }
             if (nullptr == pr) {
@@ -494,7 +493,7 @@ bool GrClipMaskManager::canStencilAndDrawElement(GrPipelineBuilder* pipelineBuil
         GrPathRendererChain::DrawType type = element->isAA() ?
             GrPathRendererChain::kStencilAndColorAntiAlias_DrawType :
             GrPathRendererChain::kStencilAndColor_DrawType;
-        *pr = this->getContext()->getPathRenderer(pipelineBuilder, SkMatrix::I(), path,
+        *pr = this->getContext()->getPathRenderer(*pipelineBuilder, SkMatrix::I(), path,
                                                   stroke, false, type);
         return SkToBool(*pr);
     }
@@ -595,8 +594,7 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
 
     // Set the matrix so that rendered clip elements are transformed to mask space from clip
     // space.
-    SkMatrix translate;
-    translate.setTranslate(clipToMaskOffset);
+    const SkMatrix translate = SkMatrix::MakeTrans(clipToMaskOffset.fX, clipToMaskOffset.fY);
 
     // The texture may be larger than necessary, this rect represents the part of the texture
     // we populate with a rasterization of the clip.
@@ -799,7 +797,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
                 if (fillInverted) {
                     clipPath.toggleInverseFillType();
                 }
-                pr = this->getContext()->getPathRenderer(&pipelineBuilder,
+                pr = this->getContext()->getPathRenderer(pipelineBuilder,
                                                          viewMatrix,
                                                          clipPath,
                                                          stroke,
index 081bc0a..04e1b8d 100644 (file)
@@ -541,7 +541,7 @@ void GrContext::flushSurfaceWrites(GrSurface* surface) {
  * Due to its expense, the software path renderer has split out so it can
  * can be individually allowed/disallowed via the "allowSW" boolean.
  */
-GrPathRenderer* GrContext::getPathRenderer(const GrPipelineBuilder* pipelineBuilder,
+GrPathRenderer* GrContext::getPathRenderer(const GrPipelineBuilder& pipelineBuilder,
                                            const SkMatrix& viewMatrix,
                                            const SkPath& path,
                                            const GrStrokeInfo& stroke,
index f52d7dc..d64273a 100644 (file)
@@ -691,7 +691,7 @@ void GrDrawContext::internalDrawPath(GrPipelineBuilder* pipelineBuilder,
     const GrStrokeInfo* strokeInfoPtr = &strokeInfo;
 
     // Try a 1st time without stroking the path and without allowing the SW renderer
-    GrPathRenderer* pr = fDrawingManager->getContext()->getPathRenderer(pipelineBuilder,
+    GrPathRenderer* pr = fDrawingManager->getContext()->getPathRenderer(*pipelineBuilder,
                                                                         viewMatrix, *pathPtr,
                                                                         *strokeInfoPtr, false,
                                                                         type);
@@ -707,7 +707,7 @@ void GrDrawContext::internalDrawPath(GrPipelineBuilder* pipelineBuilder,
             return;
         }
         strokeInfoPtr = &dashlessStrokeInfo;
-        pr = fDrawingManager->getContext()->getPathRenderer(pipelineBuilder, viewMatrix,
+        pr = fDrawingManager->getContext()->getPathRenderer(*pipelineBuilder, viewMatrix,
                                                             *pathPtr, *strokeInfoPtr,
                                                             false, type);
     }
@@ -732,7 +732,7 @@ void GrDrawContext::internalDrawPath(GrPipelineBuilder* pipelineBuilder,
         }
 
         // This time, allow SW renderer
-        pr = fDrawingManager->getContext()->getPathRenderer(pipelineBuilder, viewMatrix,
+        pr = fDrawingManager->getContext()->getPathRenderer(*pipelineBuilder, viewMatrix,
                                                             *pathPtr, *strokeInfoPtr,
                                                             true, type);
     }
index b1eb320..c6bc4c0 100644 (file)
@@ -40,7 +40,7 @@ GrPathRenderer* GrPathRendererChain::addPathRenderer(GrPathRenderer* pr) {
 }
 
 GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrShaderCaps* shaderCaps,
-                                                     const GrPipelineBuilder* pipelineBuilder,
+                                                     const GrPipelineBuilder& pipelineBuilder,
                                                      const SkMatrix& viewMatrix,
                                                      const SkPath& path,
                                                      const GrStrokeInfo& stroke,
@@ -70,7 +70,7 @@ GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrShaderCaps* shaderC
     for (int i = 0; i < fChain.count(); ++i) {
         GrPathRenderer::CanDrawPathArgs args;
         args.fShaderCaps = shaderCaps;
-        args.fPipelineBuilder = pipelineBuilder;
+        args.fPipelineBuilder = &pipelineBuilder;
         args.fViewMatrix = &viewMatrix;
         args.fPath = &path;
         args.fStroke = &stroke;