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

Unified Diff: src/core/SkDraw.cpp

Issue 1491843006: add support for capped hairlines (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add comment Created 5 years 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
« no previous file with comments | « include/core/SkPathRef.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index e1a49d39b4a582265dda15c430ffbf95578bc297..6c7d38aee9eac9ae80110b13a2f4e0123e1ba969 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1132,9 +1132,41 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
}
} else { // hairline
if (paint->isAntiAlias()) {
+ switch (paint->getStrokeCap()) {
+ case SkPaint::kButt_Cap:
+ proc = SkScan::AntiHairPath;
+ break;
+ case SkPaint::kSquare_Cap:
+ proc = SkScan::AntiHairSquarePath;
+ break;
+ case SkPaint::kRound_Cap:
+ proc = SkScan::AntiHairRoundPath;
+ break;
+ default:
+ proc SK_INIT_TO_AVOID_WARNING;
+ SkDEBUGFAIL("unknown paint cap type");
+ }
+#ifdef SK_SUPPORT_LEGACY_HAIR_IGNORES_CAPS
proc = SkScan::AntiHairPath;
+#endif
} else {
+ switch (paint->getStrokeCap()) {
+ case SkPaint::kButt_Cap:
+ proc = SkScan::HairPath;
+ break;
+ case SkPaint::kSquare_Cap:
+ proc = SkScan::HairSquarePath;
+ break;
+ case SkPaint::kRound_Cap:
+ proc = SkScan::HairRoundPath;
+ break;
+ default:
+ proc SK_INIT_TO_AVOID_WARNING;
+ SkDEBUGFAIL("unknown paint cap type");
+ }
+#ifdef SK_SUPPORT_LEGACY_HAIR_IGNORES_CAPS
proc = SkScan::HairPath;
+#endif
}
}
proc(*devPathPtr, *fRC, blitter);
« no previous file with comments | « include/core/SkPathRef.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698