Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 23712005: Add bevel-stroke support in GrAARectRenderer (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: fix small bugs Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/gpu/GrAARectRenderer.cpp ('K') | « src/gpu/GrContext.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 4041c411fc1391618b5238c3c85ddd83c13461c3..e656a7ec30aceca12395084ba46a3bb4b574cf2a 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -613,11 +613,12 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
SkScalar width = paint.getStrokeWidth();
/*
- We have special code for hairline strokes, miter-strokes, and fills.
- Anything else we just call our path code.
+ We have special code for hairline strokes, miter-strokes, bevel-stroke
+ and fills. Anything else we just call our path code.
*/
bool usePath = doStroke && width > 0 &&
- paint.getStrokeJoin() != SkPaint::kMiter_Join;
+ (paint.getStrokeJoin() == SkPaint::kRound_Join ||
+ (paint.getStrokeJoin() == SkPaint::kBevel_Join && rect.isEmpty()));
// another two reasons we might need to call drawPath...
if (paint.getMaskFilter() || paint.getPathEffect()) {
usePath = true;
@@ -633,12 +634,6 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
}
#endif
}
- // small miter limit means right angles show bevel...
- if (SkPaint::kMiter_Join == paint.getStrokeJoin() &&
- paint.getStrokeMiter() < SK_ScalarSqrt2)
- {
- usePath = true;
- }
// until we can both stroke and fill rectangles
if (paint.getStyle() == SkPaint::kStrokeAndFill_Style) {
usePath = true;
@@ -655,7 +650,13 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
return;
}
- fContext->drawRect(grPaint, rect, doStroke ? width : -1);
+
+ if (!doStroke) {
+ fContext->drawRect(grPaint, rect);
+ } else {
+ SkStrokeRec stroke(paint);
+ fContext->drawRect(grPaint, rect, &stroke);
+ }
}
///////////////////////////////////////////////////////////////////////////////
« src/gpu/GrAARectRenderer.cpp ('K') | « src/gpu/GrContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698