| Index: src/gpu/gl/GrGLPath.cpp
|
| diff --git a/src/gpu/gl/GrGLPath.cpp b/src/gpu/gl/GrGLPath.cpp
|
| index 6417e684f9f61b985f1061ed7c8d47adcc7efdb4..496961723d0f93a5bbe8c6fdcb84d46f32264ce7 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();
|
| @@ -168,29 +169,49 @@ void GrGLPath::InitPathObject(GrGLGpu* gpu,
|
| GR_GL_CALL(gpu->glInterface(), PathCommands(pathID, 0, NULL, 0, GR_GL_FLOAT, NULL));
|
| }
|
|
|
| - if (stroke.needToApply()) {
|
| - SkASSERT(!stroke.isHairlineStyle());
|
| + const SkStrokeRec& strokeRec = stroke.getStrokeRec();
|
| + if (strokeRec.needToApply()) {
|
| + SkASSERT(!strokeRec.isHairlineStyle());
|
| GR_GL_CALL(gpu->glInterface(),
|
| - PathParameterf(pathID, GR_GL_PATH_STROKE_WIDTH, SkScalarToFloat(stroke.getWidth())));
|
| + PathParameterf(pathID, GR_GL_PATH_STROKE_WIDTH, SkScalarToFloat(strokeRec.getWidth())));
|
| GR_GL_CALL(gpu->glInterface(),
|
| - PathParameterf(pathID, GR_GL_PATH_MITER_LIMIT, SkScalarToFloat(stroke.getMiter())));
|
| - GrGLenum join = join_to_gl_join(stroke.getJoin());
|
| + PathParameterf(pathID, GR_GL_PATH_MITER_LIMIT, SkScalarToFloat(strokeRec.getMiter())));
|
| + GrGLenum join = join_to_gl_join(strokeRec.getJoin());
|
| GR_GL_CALL(gpu->glInterface(), PathParameteri(pathID, GR_GL_PATH_JOIN_STYLE, join));
|
| - GrGLenum cap = cap_to_gl_cap(stroke.getCap());
|
| + GrGLenum cap = cap_to_gl_cap(strokeRec.getCap());
|
| GR_GL_CALL(gpu->glInterface(), PathParameteri(pathID, GR_GL_PATH_END_CAPS, cap));
|
| }
|
| }
|
|
|
| -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)) {
|
|
|
| - InitPathObject(gpu, fPathID, fSkPath, stroke);
|
| + // Convert a dashing to either a stroke or a fill.
|
| + const SkPath* skPath = &origSkPath;
|
| + SkTLazy<SkPath> tmpPath;
|
| + const GrStrokeInfo* stroke = &origStroke;
|
| + GrStrokeInfo tmpStroke(origStroke, false);
|
|
|
| - if (stroke.needToApply()) {
|
| + if (stroke->isDashed()) {
|
| + if (stroke->applyDash(tmpPath.init(), &tmpStroke, *skPath)) {
|
| + skPath = tmpPath.get();
|
| + stroke = &tmpStroke;
|
| + }
|
| + }
|
| +
|
| + InitPathObject(gpu, fPathID, *skPath, *stroke);
|
| +
|
| + const SkStrokeRec& strokeRec = stroke->getStrokeRec();
|
| + fShouldStroke = strokeRec.needToApply();
|
| + fShouldFill = stroke->isFillStyle() ||
|
| + strokeRec.getStyle() == SkStrokeRec::kStrokeAndFill_Style;
|
| +
|
| + if (fShouldStroke) {
|
| // FIXME: try to account for stroking, without rasterizing the stroke.
|
| - fBounds.outset(stroke.getWidth(), stroke.getWidth());
|
| + fBounds.outset(strokeRec.getWidth(), strokeRec.getWidth());
|
| }
|
| +
|
| this->registerWithCache();
|
| }
|
|
|
|
|