Index: src/gpu/gl/GrGLPath.cpp |
diff --git a/src/gpu/gl/GrGLPath.cpp b/src/gpu/gl/GrGLPath.cpp |
index 6417e684f9f61b985f1061ed7c8d47adcc7efdb4..6d04f0b7226f87803323f3c95a638a65ca708c51 100644 |
--- a/src/gpu/gl/GrGLPath.cpp |
+++ b/src/gpu/gl/GrGLPath.cpp |
@@ -91,7 +91,8 @@ inline void points_to_coords(const SkPoint points[], size_t first_point, size_t |
void GrGLPath::InitPathObject(GrGLGpu* gpu, |
GrGLuint pathID, |
const SkPath& skPath, |
- const SkStrokeRec& stroke) { |
+ const GrStrokeInfo& stroke) { |
+ SkASSERT(!stroke.isDashed()); |
if (!skPath.isEmpty()) { |
int verbCnt = skPath.countVerbs(); |
int pointCnt = skPath.countPoints(); |
@@ -181,16 +182,33 @@ void GrGLPath::InitPathObject(GrGLGpu* gpu, |
} |
} |
-GrGLPath::GrGLPath(GrGLGpu* gpu, const SkPath& path, const SkStrokeRec& stroke) |
- : INHERITED(gpu, path, stroke), |
+GrGLPath::GrGLPath(GrGLGpu* gpu, const SkPath& origSkPath, const GrStrokeInfo& origStroke) |
+ : INHERITED(gpu, origSkPath, origStroke), |
fPathID(gpu->glPathRendering()->genPaths(1)) { |
+ // Convert a dashing to either a stroke or a fill. |
+ const SkPath* skPath = &origSkPath; |
+ SkTLazy<SkPath> tmpPath; |
+ const GrStrokeInfo* stroke = &origStroke; |
+ GrStrokeInfo tmpStroke(SkStrokeRec::kFill_InitStyle); |
+ |
+ if (stroke->isDashed()) { |
+ if (stroke->applyDashToPath(tmpPath.init(), &tmpStroke, *skPath)) { |
+ skPath = tmpPath.get(); |
+ stroke = &tmpStroke; |
+ } |
+ } |
- InitPathObject(gpu, fPathID, fSkPath, stroke); |
+ InitPathObject(gpu, fPathID, *skPath, *stroke); |
- if (stroke.needToApply()) { |
+ fShouldStroke = stroke->needToApply(); |
+ fShouldFill = stroke->isFillStyle() || |
+ stroke->getStyle() == SkStrokeRec::kStrokeAndFill_Style; |
+ |
+ if (fShouldStroke) { |
// FIXME: try to account for stroking, without rasterizing the stroke. |
- fBounds.outset(stroke.getWidth(), stroke.getWidth()); |
+ fBounds.outset(stroke->getWidth(), stroke->getWidth()); |
} |
+ |
this->registerWithCache(); |
} |