Tesselate path once for tiled offscreen AA
Review URL: http://codereview.appspot.com/4661062/
git-svn-id: http://skia.googlecode.com/svn/trunk@1777 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrGpu.cpp b/gpu/src/GrGpu.cpp
index 192d29b..62c96f5 100644
--- a/gpu/src/GrGpu.cpp
+++ b/gpu/src/GrGpu.cpp
@@ -24,9 +24,8 @@
#include "GrPathRenderer.h"
// probably makes no sense for this to be less than a page
-static const size_t VERTEX_POOL_VB_SIZE = 1 << 12;
-static const int VERTEX_POOL_VB_COUNT = 1;
-
+static const size_t VERTEX_POOL_VB_SIZE = 1 << 18;
+static const int VERTEX_POOL_VB_COUNT = 4;
////////////////////////////////////////////////////////////////////////////////
@@ -454,6 +453,7 @@
// with the existing clip.
for (int c = firstElement; c < count; ++c) {
GrPathFill fill;
+ bool fillInverted;
// enabled at bottom of loop
this->disableState(kModifyStencilClip_StateBit);
@@ -465,16 +465,20 @@
GrPathRenderer* pr = NULL;
const GrPath* clipPath = NULL;
+ GrPathRenderer::AutoClearPath arp;
if (kRect_ClipType == clip.getElementType(c)) {
canRenderDirectToStencil = true;
fill = kEvenOdd_PathFill;
+ fillInverted = false;
} else {
fill = clip.getPathFill(c);
+ fillInverted = IsFillInverted(fill);
+ fill = NonInvertedFill(fill);
clipPath = &clip.getPath(c);
- pr = this->getClipPathRenderer(*clipPath, NonInvertedFill(fill));
+ pr = this->getClipPathRenderer(*clipPath, fill);
canRenderDirectToStencil =
- !pr->requiresStencilPass(this, *clipPath,
- NonInvertedFill(fill));
+ !pr->requiresStencilPass(this, *clipPath, fill);
+ arp.set(pr, this, clipPath, fill, NULL);
}
GrSetOp op = firstElement == c ? kReplace_SetOp : clip.getOp(c);
@@ -489,7 +493,7 @@
GrStencilSettings::GetClipPasses(op,
canRenderDirectToStencil,
clipBit,
- IsFillInverted(fill),
+ fillInverted,
&passes, stencilSettings);
// draw the element to the client stencil bits if necessary
@@ -509,12 +513,9 @@
} else {
if (canRenderDirectToStencil) {
this->setStencil(gDrawToStencil);
- pr->drawPath(this, 0, *clipPath, NonInvertedFill(fill),
- NULL);
+ pr->drawPath(0);
} else {
- pr->drawPathToStencil(this, *clipPath,
- NonInvertedFill(fill),
- NULL);
+ pr->drawPathToStencil();
}
}
}
@@ -530,8 +531,7 @@
this->drawSimpleRect(clip.getRect(c), NULL, 0);
} else {
SET_RANDOM_COLOR
- GrAssert(!IsFillInverted(fill));
- pr->drawPath(this, 0, *clipPath, fill, NULL);
+ pr->drawPath(0);
}
} else {
SET_RANDOM_COLOR
@@ -558,7 +558,7 @@
GrPathRenderer* GrGpu::getClipPathRenderer(const GrPath& path,
GrPathFill fill) {
if (NULL != fClientPathRenderer &&
- fClientPathRenderer->canDrawPath(this, path, fill)) {
+ fClientPathRenderer->canDrawPath(path, fill)) {
return fClientPathRenderer;
} else {
if (NULL == fDefaultPathRenderer) {
@@ -566,7 +566,7 @@
new GrDefaultPathRenderer(this->supportsTwoSidedStencil(),
this->supportsStencilWrapOps());
}
- GrAssert(fDefaultPathRenderer->canDrawPath(this, path, fill));
+ GrAssert(fDefaultPathRenderer->canDrawPath(path, fill));
return fDefaultPathRenderer;
}
}