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

Unified Diff: src/core/SkDraw.cpp

Issue 284763010: fix the rendering error for drawPosText_asPaths (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: also fix the rendering error for text with path effects Created 6 years, 7 months 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 | « no previous file | src/core/SkPaint.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 24c80557168c8019adfb54f62e361520960b2c15..dc4a4a40bb887350ba771b38a3a6674b837db1b8 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1900,6 +1900,18 @@ void SkDraw::drawPosText_asPaths(const char text[], size_t byteLength,
SkAutoGlyphCache autoCache(paint, NULL, NULL);
SkGlyphCache* cache = autoCache.getCache();
+ // After SkGlyphCache is detached, the path effect should be set to NULL in
+ // SkPaint. And the path for text will be filled, so SkPaint should be set
+ // to fill style, w/ the exception of hairline stroked text w/o path effect.
+ if (origPaint.getStyle() == SkPaint::kStroke_Style &&
+ origPaint.getStrokeWidth() == 0 && origPaint.getPathEffect() == NULL) {
+ paint.setStyle(SkPaint::kStroke_Style);
+ } else {
+ paint.setStyle(SkPaint::kFill_Style);
+ }
+
+ paint.setPathEffect(NULL);
+
const char* stop = text + byteLength;
AlignProc_scalar alignProc = pick_align_proc_scalar(paint.getTextAlign());
TextMapState tms(SkMatrix::I(), constY);
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698