aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathRendererChain.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-10 19:10:17 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-10 19:10:17 +0000
commit45a15f551b5b3c6c747d8eaf6466b7d3b76a8fae (patch)
tree49c9fd68caf3a90c7ed5a1ac89f418d6ce7b4afb /src/gpu/GrPathRendererChain.cpp
parent6f9286202831dd807daf9b1e39271da8f390210e (diff)
Modifications to GrPatherRenderer(Chain) interfaces to support clip mask manager.
R=robertphillips@google.com Review URL: https://codereview.appspot.com/6904069 git-svn-id: http://skia.googlecode.com/svn/trunk@6741 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrPathRendererChain.cpp')
-rw-r--r--src/gpu/GrPathRendererChain.cpp38
1 files changed, 33 insertions, 5 deletions
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 8ccafcfe37..6cb45fa10f 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -15,10 +15,9 @@
SK_DEFINE_INST_COUNT(GrPathRendererChain)
-GrPathRendererChain::GrPathRendererChain(GrContext* context, UsageFlags flags)
+GrPathRendererChain::GrPathRendererChain(GrContext* context)
: fInit(false)
- , fOwner(context)
- , fFlags(flags) {
+ , fOwner(context) {
}
GrPathRendererChain::~GrPathRendererChain() {
@@ -36,12 +35,41 @@ GrPathRenderer* GrPathRendererChain::addPathRenderer(GrPathRenderer* pr) {
GrPathRenderer* GrPathRendererChain::getPathRenderer(const SkPath& path,
const SkStroke& stroke,
const GrDrawTarget* target,
- bool antiAlias) {
+ DrawType drawType,
+ StencilSupport* stencilSupport) {
if (!fInit) {
this->init();
}
+ bool antiAlias = (kColorAntiAlias_DrawType == drawType ||
+ kStencilAndColorAntiAlias_DrawType == drawType);
+
+ GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport <
+ GrPathRenderer::kStencilOnly_StencilSupport);
+ GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport <
+ GrPathRenderer::kNoRestriction_StencilSupport);
+ GrPathRenderer::StencilSupport minStencilSupport;
+ if (kStencilOnly_DrawType == drawType) {
+ minStencilSupport = GrPathRenderer::kStencilOnly_StencilSupport;
+ } else if (kStencilAndColor_DrawType == drawType ||
+ kStencilAndColorAntiAlias_DrawType == drawType) {
+ minStencilSupport = GrPathRenderer::kNoRestriction_StencilSupport;
+ } else {
+ minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport;
+ }
+
+
for (int i = 0; i < fChain.count(); ++i) {
if (fChain[i]->canDrawPath(path, stroke, target, antiAlias)) {
+ if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
+ GrPathRenderer::StencilSupport support = fChain[i]->getStencilSupport(path,
+ stroke,
+ target);
+ if (support < minStencilSupport) {
+ continue;
+ } else if (NULL != stencilSupport) {
+ *stencilSupport = support;
+ }
+ }
return fChain[i];
}
}
@@ -53,7 +81,7 @@ void GrPathRendererChain::init() {
GrGpu* gpu = fOwner->getGpu();
bool twoSided = gpu->getCaps().twoSidedStencilSupport();
bool wrapOp = gpu->getCaps().stencilWrapOpsSupport();
- GrPathRenderer::AddPathRenderers(fOwner, fFlags, this);
+ GrPathRenderer::AddPathRenderers(fOwner, this);
this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer,
(twoSided, wrapOp)))->unref();
fInit = true;