aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-08 13:45:09 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-08 13:45:09 +0000
commiteb928ea49a1c8a72ba3e01f64452b20713232059 (patch)
treea9a8f308ba2b672b8496e1088fb7f1ebd3bc705a /src
parent2b57dc6bb241a6627c4375ee54b73039983d03da (diff)
Proposed fix to new stroking/path render selection system
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrContext.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 30b75ad377..9d80ebc548 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1063,24 +1063,15 @@ void GrContext::drawPath(const GrPaint& paint, const SkPath& path, const SkStrok
return;
}
- const SkPath* pathPtr = &path;
- SkPath tmpPath;
- SkStrokeRec strokeRec(stroke);
- if (!strokeRec.isHairlineStyle()) {
- if (strokeRec.applyToPath(&tmpPath, *pathPtr)) {
- pathPtr = &tmpPath;
- strokeRec.setFillStyle();
- }
- }
-
SkRect ovalRect;
- if (!pathPtr->isInverseFillType() && pathPtr->isOval(&ovalRect)) {
- SkScalar width = strokeRec.isHairlineStyle() ? 0 : -SK_Scalar1;
+ if ((stroke.isHairlineStyle() || stroke.isFillStyle()) && !path.isInverseFillType() &&
+ path.isOval(&ovalRect)) {
+ SkScalar width = stroke.isHairlineStyle() ? 0 : -SK_Scalar1;
this->drawOval(paint, ovalRect, width);
return;
}
- this->internalDrawPath(paint, *pathPtr, strokeRec);
+ this->internalDrawPath(paint, path, stroke);
}
void GrContext::internalDrawPath(const GrPaint& paint, const SkPath& path, const SkStrokeRec& stroke) {
@@ -1109,7 +1100,25 @@ void GrContext::internalDrawPath(const GrPaint& paint, const SkPath& path, const
GrPathRendererChain::DrawType type = prAA ? GrPathRendererChain::kColorAntiAlias_DrawType :
GrPathRendererChain::kColor_DrawType;
- GrPathRenderer* pr = this->getPathRenderer(path, stroke, target, true, type);
+ const SkPath* pathPtr = &path;
+ SkPath tmpPath;
+ SkStrokeRec strokeRec(stroke);
+
+ // Try a 1st time without stroking the path and without allowing the SW renderer
+ GrPathRenderer* pr = this->getPathRenderer(*pathPtr, strokeRec, target, false, type);
+
+ if (NULL == pr) {
+ if (!strokeRec.isHairlineStyle()) {
+ // It didn't work the 1st time, so try again with the stroked path
+ if (strokeRec.applyToPath(&tmpPath, *pathPtr)) {
+ pathPtr = &tmpPath;
+ strokeRec.setFillStyle();
+ }
+ }
+ // This time, allow SW renderer
+ pr = this->getPathRenderer(*pathPtr, strokeRec, target, true, type);
+ }
+
if (NULL == pr) {
#if GR_DEBUG
GrPrintf("Unable to find path renderer compatible with path.\n");
@@ -1117,7 +1126,7 @@ void GrContext::internalDrawPath(const GrPaint& paint, const SkPath& path, const
return;
}
- pr->drawPath(path, stroke, target, prAA);
+ pr->drawPath(*pathPtr, strokeRec, target, prAA);
}
////////////////////////////////////////////////////////////////////////////////