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

Unified Diff: gm/texteffects.cpp

Issue 1535793004: fix stroked text underline / strikethrough (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/texteffects.cpp
diff --git a/gm/texteffects.cpp b/gm/texteffects.cpp
index 53395f0732f2e22a42e50bd9779f2e35d3fce72e..1d4b98e950fdd16a12c7076c4a47d022010ea9e7 100644
--- a/gm/texteffects.cpp
+++ b/gm/texteffects.cpp
@@ -196,3 +196,35 @@ DEF_SIMPLE_GM(texteffects, canvas, 460, 680) {
canvas->restore();
}
+
+DEF_SIMPLE_GM(textunderstrike, canvas, 460, 680) {
+ canvas->clear(SK_ColorYELLOW);
+ SkPaint paint;
+ sk_tool_utils::set_portable_typeface(&paint);
+ paint.setTextSize(50);
+ paint.setStrokeWidth(5);
+ paint.setAntiAlias(true);
+
+ auto drawText = [&]() {
+ paint.setStyle(SkPaint::kFill_Style);
+ canvas->drawText("Hello", 5, 100, 50, paint);
+ paint.setStyle(SkPaint::kStroke_Style);
+ canvas->drawText("Hello", 5, 100, 100, paint);
+ canvas->translate(0, 100);
+ };
+
+ drawText();
+ paint.setUnderlineText(true);
+ drawText();
+ paint.setUnderlineText(false);
+ paint.setStrikeThruText(true);
+ drawText();
+ paint.setUnderlineText(true);
+ drawText();
+ paint.setColor(SK_ColorWHITE);
+ paint.setStyle(SkPaint::kStroke_Style);
+ canvas->drawText("Hello", 5, 100, 50, paint);
+ paint.setColor(SK_ColorBLUE);
+ paint.setStyle(SkPaint::kFill_Style);
+ canvas->drawText("Hello", 5, 100, 50, paint);
+}
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698