Removed SoftwarePathRenderer from GrContext's path renderer chain
http://codereview.appspot.com/6221065/ git-svn-id: http://skia.googlecode.com/svn/trunk@4036 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
87baf8985a
commit
72176b2d38
@ -32,6 +32,7 @@ class GrResourceCache;
|
||||
class GrStencilBuffer;
|
||||
class GrVertexBuffer;
|
||||
class GrVertexBufferAllocPool;
|
||||
class GrSoftwarePathRenderer;
|
||||
|
||||
class GR_API GrContext : public GrRefCnt {
|
||||
public:
|
||||
@ -695,7 +696,8 @@ public:
|
||||
GrPathRenderer* getPathRenderer(const SkPath& path,
|
||||
GrPathFill fill,
|
||||
const GrDrawTarget* target,
|
||||
bool antiAlias);
|
||||
bool antiAlias,
|
||||
bool allowSW);
|
||||
|
||||
private:
|
||||
// used to keep track of when we need to flush the draw buffer
|
||||
@ -712,6 +714,7 @@ private:
|
||||
GrFontCache* fFontCache;
|
||||
|
||||
GrPathRendererChain* fPathRendererChain;
|
||||
GrSoftwarePathRenderer* fSoftwarePathRenderer;
|
||||
|
||||
GrVertexBufferAllocPool* fDrawBufferVBAllocPool;
|
||||
GrIndexBufferAllocPool* fDrawBufferIBAllocPool;
|
||||
|
@ -20,6 +20,5 @@ void GrPathRenderer::AddPathRenderers(GrContext* ctx,
|
||||
chain->addPathRenderer(pr)->unref();
|
||||
}
|
||||
chain->addPathRenderer(new GrAAConvexPathRenderer())->unref();
|
||||
chain->addPathRenderer(new GrSoftwarePathRenderer(ctx))->unref();
|
||||
}
|
||||
}
|
||||
|
@ -393,9 +393,6 @@ void setup_boolean_blendcoeffs(GrDrawState* drawState, SkRegion::Op op) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool draw_path(GrContext* context,
|
||||
GrGpu* gpu,
|
||||
@ -403,7 +400,7 @@ bool draw_path(GrContext* context,
|
||||
GrPathFill fill,
|
||||
bool doAA) {
|
||||
|
||||
GrPathRenderer* pr = context->getPathRenderer(path, fill, gpu, doAA);
|
||||
GrPathRenderer* pr = context->getPathRenderer(path, fill, gpu, doAA, true);
|
||||
if (NULL == pr) {
|
||||
return false;
|
||||
}
|
||||
@ -411,7 +408,8 @@ bool draw_path(GrContext* context,
|
||||
pr->drawPath(path, fill, NULL, gpu, 0, doAA);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool GrClipMaskManager::drawClipShape(GrGpu* gpu,
|
||||
@ -796,7 +794,8 @@ bool GrClipMaskManager::createStencilClipMask(GrGpu* gpu,
|
||||
fill = GrNonInvertedFill(fill);
|
||||
clipPath = &clipCopy.getPath(c);
|
||||
pr = this->getContext()->getPathRenderer(*clipPath,
|
||||
fill, gpu, false);
|
||||
fill, gpu, false,
|
||||
true);
|
||||
if (NULL == pr) {
|
||||
fClipMaskInStencil = false;
|
||||
gpu->setClip(clipCopy); // restore to the original
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "GrPathRenderer.h"
|
||||
#include "GrPathUtils.h"
|
||||
#include "GrResourceCache.h"
|
||||
#include "GrSoftwarePathRenderer.h"
|
||||
#include "GrStencilBuffer.h"
|
||||
#include "GrTextStrike.h"
|
||||
#include "SkTLazy.h"
|
||||
@ -82,6 +83,7 @@ GrContext::~GrContext() {
|
||||
GrSafeUnref(fAAStrokeRectIndexBuffer);
|
||||
fGpu->unref();
|
||||
GrSafeUnref(fPathRendererChain);
|
||||
GrSafeUnref(fSoftwarePathRenderer);
|
||||
fDrawState->unref();
|
||||
}
|
||||
|
||||
@ -98,6 +100,7 @@ void GrContext::contextDestroyed() {
|
||||
// a path renderer may be holding onto resources that
|
||||
// are now unusable
|
||||
GrSafeSetNull(fPathRendererChain);
|
||||
GrSafeSetNull(fSoftwarePathRenderer);
|
||||
|
||||
delete fDrawBuffer;
|
||||
fDrawBuffer = NULL;
|
||||
@ -129,6 +132,7 @@ void GrContext::freeGpuResources() {
|
||||
fFontCache->freeAll();
|
||||
// a path renderer may be holding onto resources
|
||||
GrSafeSetNull(fPathRendererChain);
|
||||
GrSafeSetNull(fSoftwarePathRenderer);
|
||||
}
|
||||
|
||||
size_t GrContext::getGpuTextureCacheBytes() const {
|
||||
@ -1454,7 +1458,7 @@ void GrContext::internalDrawPath(const GrPaint& paint, const SkPath& path,
|
||||
prAA = false;
|
||||
}
|
||||
|
||||
GrPathRenderer* pr = this->getPathRenderer(path, fill, target, prAA);
|
||||
GrPathRenderer* pr = this->getPathRenderer(path, fill, target, prAA, true);
|
||||
if (NULL == pr) {
|
||||
#if GR_DEBUG
|
||||
GrPrintf("Unable to find path renderer compatible with path.\n");
|
||||
@ -1916,15 +1920,35 @@ GrDrawTarget* GrContext::prepareToDraw(const GrPaint& paint,
|
||||
return target;
|
||||
}
|
||||
|
||||
/*
|
||||
* This method finds a path renderer that can draw the specified path on
|
||||
* the provided target.
|
||||
* 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 SkPath& path,
|
||||
GrPathFill fill,
|
||||
const GrDrawTarget* target,
|
||||
bool antiAlias) {
|
||||
bool antiAlias,
|
||||
bool allowSW) {
|
||||
if (NULL == fPathRendererChain) {
|
||||
fPathRendererChain =
|
||||
new GrPathRendererChain(this, GrPathRendererChain::kNone_UsageFlag);
|
||||
}
|
||||
return fPathRendererChain->getPathRenderer(path, fill, target, antiAlias);
|
||||
|
||||
GrPathRenderer* pr = fPathRendererChain->getPathRenderer(path, fill,
|
||||
target,
|
||||
antiAlias);
|
||||
|
||||
if (NULL == pr && allowSW) {
|
||||
if (NULL == fSoftwarePathRenderer) {
|
||||
fSoftwarePathRenderer = new GrSoftwarePathRenderer(this);
|
||||
}
|
||||
|
||||
pr = fSoftwarePathRenderer;
|
||||
}
|
||||
|
||||
return pr;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -1992,6 +2016,7 @@ GrContext::GrContext(GrGpu* gpu) {
|
||||
fGpu->setDrawState(fDrawState);
|
||||
|
||||
fPathRendererChain = NULL;
|
||||
fSoftwarePathRenderer = NULL;
|
||||
|
||||
fTextureCache = new GrResourceCache(MAX_TEXTURE_CACHE_COUNT,
|
||||
MAX_TEXTURE_CACHE_BYTES);
|
||||
|
Loading…
Reference in New Issue
Block a user