Revert "Revert "Revert "Pass bounds into draw calls in path renderers."""
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 17 May 2013 18:01:38 +0000 (18:01 +0000)
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 17 May 2013 18:01:38 +0000 (18:01 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@9181 2bbb7eff-a529-9590-31e7-b0007b416f81

src/gpu/GrAAConvexPathRenderer.cpp
src/gpu/GrAAHairLinePathRenderer.cpp
src/gpu/GrDefaultPathRenderer.cpp
src/gpu/GrPathRenderer.cpp
src/gpu/GrPathRenderer.h

index 93404b44a3eb4103ba5ba83274c494815b4dc3b6..fc6cae68c62298fc26430154ae6c9090f47f2bf7 100644 (file)
@@ -660,9 +660,6 @@ bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath,
     SkSTArray<kPreallocDrawCnt, Draw, true> draws;
     create_vertices(segments, fanPt, &draws, verts, idxs);
 
-    SkRect devBounds;
-    GetPathDevBounds(origPath, drawState->getRenderTarget(), adcd.getOriginalMatrix(), &devBounds);
-
     int vOffset = 0;
     for (int i = 0; i < draws.count(); ++i) {
         const Draw& draw = draws[i];
@@ -670,8 +667,7 @@ bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath,
                             vOffset,  // start vertex
                             0,        // start index
                             draw.fVertexCnt,
-                            draw.fIndexCnt,
-                            &devBounds);
+                            draw.fIndexCnt);
         vOffset += draw.fVertexCnt;
     }
 
index 498283dfad614e8121071ae7f075986fae3d0b48..da54ed643c1d99a990791cd19848a78e45a82747 100644 (file)
@@ -791,7 +791,6 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
 
     GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kPreserve_ASRInit);
     GrDrawState* drawState = target->drawState();
-    const SkMatrix originalVM = drawState->getViewMatrix();
 
     GrDrawState::AutoDeviceCoordDraw adcd;
     // createGeom transforms the geometry to device space when the matrix does not have
@@ -817,9 +816,6 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
     GrEffectRef* hairLineEffect = HairLineEdgeEffect::Create();
     GrEffectRef* hairQuadEffect = HairQuadEdgeEffect::Create();
 
-    SkRect devBounds;
-    GetPathDevBounds(path, drawState->getRenderTarget(), originalVM, &devBounds);
-
     target->setIndexSourceToBuffer(fLinesIndexBuffer);
     int lines = 0;
     int nBufLines = fLinesIndexBuffer->maxQuads();
@@ -830,8 +826,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
                             kVertsPerLineSeg*lines,    // startV
                             0,                         // startI
                             kVertsPerLineSeg*n,        // vCount
-                            kIdxsPerLineSeg*n,
-                            &devBounds);        // iCount
+                            kIdxsPerLineSeg*n);        // iCount
         lines += n;
     }
 
@@ -844,8 +839,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
                             4 * lineCnt + kVertsPerQuad*quads, // startV
                             0,                                 // startI
                             kVertsPerQuad*n,                   // vCount
-                            kIdxsPerQuad*n,                    // iCount
-                            &devBounds);
+                            kIdxsPerQuad*n);                   // iCount
         quads += n;
     }
     target->resetIndexSource();
index 87deb9c4068c418a7c0ab5bac4a64b9504dea3be..43809ed6a34b25cd586dbd35e62057e3cdeec9d4 100644 (file)
@@ -445,9 +445,7 @@ bool GrDefaultPathRenderer::internalDrawPath(const SkPath& path,
         }
     }
 
-    SkRect devBounds;
-    GetPathDevBounds(path, drawState->getRenderTarget(), viewM, &devBounds);
-
+    {
     for (int p = 0; p < passCount; ++p) {
         drawState->setDrawFace(drawFace[p]);
         if (NULL != passes[p]) {
@@ -462,8 +460,10 @@ bool GrDefaultPathRenderer::internalDrawPath(const SkPath& path,
             GrDrawState::AutoDeviceCoordDraw adcd;
             if (reverse) {
                 GrAssert(NULL != drawState->getRenderTarget());
-                // draw over the dev bounds (which will be the whole dst surface for inv fill).
-                bounds = devBounds;
+                // draw over the whole world.
+                bounds.setLTRB(0, 0,
+                               SkIntToScalar(drawState->getRenderTarget()->width()),
+                               SkIntToScalar(drawState->getRenderTarget()->height()));
                 SkMatrix vmi;
                 // mapRect through persp matrix may not be correct
                 if (!drawState->getViewMatrix().hasPerspective() &&
@@ -483,12 +483,13 @@ bool GrDefaultPathRenderer::internalDrawPath(const SkPath& path,
             }
             if (indexCnt) {
                 target->drawIndexed(primType, 0, 0,
-                                    vertexCnt, indexCnt, &devBounds);
+                                    vertexCnt, indexCnt);
             } else {
-                target->drawNonIndexed(primType, 0, vertexCnt, &devBounds);
+                target->drawNonIndexed(primType, 0, vertexCnt);
             }
         }
     }
+    }
     return true;
 }
 
index e88db22b30d7958b15ae9d5fa21edad1bacb03cc..e0d2682bcd379b33b5a31c721474279b8faf915b 100644 (file)
@@ -12,15 +12,3 @@ SK_DEFINE_INST_COUNT(GrPathRenderer)
 
 GrPathRenderer::GrPathRenderer() {
 }
-
-void GrPathRenderer::GetPathDevBounds(const SkPath& path,
-                                      int devW, int devH,
-                                      const SkMatrix& matrix,
-                                      SkRect* bounds) {
-    if (path.isInverseFillType()) {
-        *bounds = SkRect::MakeWH(SkIntToScalar(devW), SkIntToScalar(devH));
-        return;
-    }
-    *bounds = path.getBounds();
-    matrix.mapRect(bounds);
-}
index 3d4c993c5287669a69db770b4c4cc77c02d5cf12..ebd464ffb3af6585e63b7c2401d33eecec7189cd 100644 (file)
@@ -1,4 +1,4 @@
-  
+
 /*
  * Copyright 2011 Google Inc.
  *
@@ -173,22 +173,6 @@ protected:
         this->drawPath(path, stroke, target, false);
     }
 
-    // Helper for getting the device bounds of a path. Inverse filled paths will have bounds set
-    // by devSize. Non-inverse path bounds will not necessarily be clipped to devSize.
-    static void GetPathDevBounds(const SkPath& path,
-                                 int devW,
-                                 int devH,
-                                 const SkMatrix& matrix,
-                                 SkRect* bounds);
-
-    // Helper version that gets the dev width and height from a GrSurface.
-    static void GetPathDevBounds(const SkPath& path,
-                                 const GrSurface* device,
-                                 const SkMatrix& matrix,
-                                 SkRect* bounds) {
-        GetPathDevBounds(path, device->width(), device->height(), matrix, bounds);
-    }
-
 private:
 
     typedef GrRefCnt INHERITED;