aboutsummaryrefslogtreecommitdiffhomepage
path: root/gpu/src/GrGpu.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-19 15:42:31 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-19 15:42:31 +0000
commit3008519e9f977cd60194841d558a4f45c28e9833 (patch)
tree7b78cc819df914fc17e26ce3888bdee81349c1b6 /gpu/src/GrGpu.cpp
parentb0951405962926cc649d8cf1eabe19f747c4bf6d (diff)
Use a prioritized list of path renderers in Gr.
Diffstat (limited to 'gpu/src/GrGpu.cpp')
-rw-r--r--gpu/src/GrGpu.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/gpu/src/GrGpu.cpp b/gpu/src/GrGpu.cpp
index cde851d49f..7744e6a129 100644
--- a/gpu/src/GrGpu.cpp
+++ b/gpu/src/GrGpu.cpp
@@ -40,8 +40,7 @@ GrGpu::GrGpu()
, fGeomPoolStateStack(&fGeoSrcStateStackStorage)
, fQuadIndexBuffer(NULL)
, fUnitSquareVertexBuffer(NULL)
- , fDefaultPathRenderer(NULL)
- , fClientPathRenderer(NULL)
+ , fPathRendererChain(NULL)
, fContextIsDirty(true)
, fResourceHead(NULL) {
@@ -62,8 +61,6 @@ GrGpu::GrGpu()
GrGpu::~GrGpu() {
this->releaseResources();
- GrSafeUnref(fDefaultPathRenderer);
- GrSafeUnref(fClientPathRenderer);
}
void GrGpu::abandonResources() {
@@ -81,6 +78,8 @@ void GrGpu::abandonResources() {
fVertexPool = NULL;
delete fIndexPool;
fIndexPool = NULL;
+ // in case path renderer has any GrResources, start from scratch
+ GrSafeSetNull(fPathRendererChain);
}
void GrGpu::releaseResources() {
@@ -98,6 +97,8 @@ void GrGpu::releaseResources() {
fVertexPool = NULL;
delete fIndexPool;
fIndexPool = NULL;
+ // in case path renderer has any GrResources, start from scratch
+ GrSafeSetNull(fPathRendererChain);
}
void GrGpu::insertResource(GrResource* resource) {
@@ -521,6 +522,11 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) {
fill = NonInvertedFill(fill);
clipPath = &clip.getPath(c);
pr = this->getClipPathRenderer(*clipPath, fill);
+ if (NULL == pr) {
+ fClipInStencil = false;
+ fClip = clip;
+ return false;
+ }
canRenderDirectToStencil =
!pr->requiresStencilPass(this, *clipPath, fill);
arp.set(pr, this, clipPath, fill, NULL);
@@ -602,18 +608,12 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) {
GrPathRenderer* GrGpu::getClipPathRenderer(const GrPath& path,
GrPathFill fill) {
- if (NULL != fClientPathRenderer &&
- fClientPathRenderer->canDrawPath(path, fill)) {
- return fClientPathRenderer;
- } else {
- if (NULL == fDefaultPathRenderer) {
- fDefaultPathRenderer =
- new GrDefaultPathRenderer(this->supportsTwoSidedStencil(),
- this->supportsStencilWrapOps());
- }
- GrAssert(fDefaultPathRenderer->canDrawPath(path, fill));
- return fDefaultPathRenderer;
+ if (NULL == fPathRendererChain) {
+ fPathRendererChain =
+ new GrPathRendererChain(this->getContext(),
+ GrPathRendererChain::kNonAAOnly_UsageFlag);
}
+ return fPathRendererChain->getPathRenderer(this, path, fill);
}