diff options
author | robertphillips <robertphillips@google.com> | 2015-11-24 05:36:02 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-24 05:36:02 -0800 |
commit | 514450cb695279e44af8b30c19e9d866e2eeb818 (patch) | |
tree | 37d5c80f16a01c94f513b3a4af9c69359dfa69cb /src | |
parent | b68ce74bd197a9ca4becd53cbcfee825b8d08e0e (diff) |
Clarify when oval & rrects get devolved to paths in SkGpuDevice/GrDrawContext boundary
The GrDrawContext drawOval and drawRRect methods are only called from SkGpuDevice so there is no value in delaying the conversion to a path when dashing is involved.
Review URL: https://codereview.chromium.org/1470103002
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrDrawContext.cpp | 16 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 46 |
2 files changed, 17 insertions, 45 deletions
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp index 51d057e8f5..9da4ea806e 100644 --- a/src/gpu/GrDrawContext.cpp +++ b/src/gpu/GrDrawContext.cpp @@ -466,13 +466,7 @@ void GrDrawContext::drawRRect(const GrClip& clip, return; } - if (strokeInfo.isDashed()) { - SkPath path; - path.setIsVolatile(true); - path.addRRect(rrect); - this->drawPath(clip, paint, viewMatrix, path, strokeInfo); - return; - } + SkASSERT(!strokeInfo.isDashed()); // this should've been devolved to a path in SkGpuDevice AutoCheckFlush acf(fDrawingManager); @@ -545,13 +539,7 @@ void GrDrawContext::drawOval(const GrClip& clip, return; } - if (strokeInfo.isDashed()) { - SkPath path; - path.setIsVolatile(true); - path.addOval(oval); - this->drawPath(clip, paint, viewMatrix, path, strokeInfo); - return; - } + SkASSERT(!strokeInfo.isDashed()); // this should've been devolved to a path in SkGpuDevice AutoCheckFlush acf(fDrawingManager); diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 9b6a5304d2..b8630e5555 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -567,19 +567,7 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, } - bool usePath = false; - - if (paint.getMaskFilter()) { - usePath = true; - } else { - const SkPathEffect* pe = paint.getPathEffect(); - if (pe && !strokeInfo.isDashed()) { - usePath = true; - } - } - - - if (usePath) { + if (paint.getMaskFilter() || paint.getPathEffect()) { SkPath path; path.setIsVolatile(true); path.addRRect(rect); @@ -587,6 +575,8 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, return; } + SkASSERT(!strokeInfo.isDashed()); + fDrawContext->drawRRect(fClip, grPaint, *draw.fMatrix, rect, strokeInfo); } @@ -621,33 +611,24 @@ void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, ///////////////////////////////////////////////////////////////////////////// -void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, - const SkPaint& paint) { +void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) { GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawOval", fContext); CHECK_FOR_ANNOTATION(paint); CHECK_SHOULD_DRAW(draw); - GrStrokeInfo strokeInfo(paint); - - bool usePath = false; - // some basic reasons we might need to call drawPath... - if (paint.getMaskFilter()) { - // The RRect path can handle special case blurring - SkRRect rr = SkRRect::MakeOval(oval); - return this->drawRRect(draw, rr, paint); - } else { - const SkPathEffect* pe = paint.getPathEffect(); - if (pe && !strokeInfo.isDashed()) { - usePath = true; - } - } - - if (usePath) { + // Presumably the path effect warps this to something other than an oval + if (paint.getPathEffect()) { SkPath path; path.setIsVolatile(true); path.addOval(oval); this->drawPath(draw, path, paint, nullptr, true); return; + } + + if (paint.getMaskFilter()) { + // The RRect path can handle special case blurring + SkRRect rr = SkRRect::MakeOval(oval); + return this->drawRRect(draw, rr, paint); } GrPaint grPaint; @@ -655,6 +636,9 @@ void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, return; } + GrStrokeInfo strokeInfo(paint); + SkASSERT(!strokeInfo.isDashed()); + fDrawContext->drawOval(fClip, grPaint, *draw.fMatrix, oval, strokeInfo); } |