diff options
author | Leon Scroggins <scroggo@google.com> | 2017-02-17 22:48:51 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-17 22:49:03 +0000 |
commit | e005edd3a5deb602beec59f59cdc8b14d3764d58 (patch) | |
tree | 79f88cfdeebefb4eb201853ecd72e04a53ee96ca /gm/texteffects.cpp | |
parent | cc3c2ed9940e408b3155c073825ae9e1ca3387c5 (diff) |
Revert "hide deprecated underline and strikethru"
This reverts commit a01bf9ab748836fc4bf271bd5024151bf1ce2e88.
Reason for revert: Breaking Android merge. They access setUnderlineText on their <shudder> subclass of SkPaint.
Original change's description:
> hide deprecated underline and strikethru
>
> BUG=skia:6250
>
> Change-Id: I85395e4960b16ab91237a74ff35e5b7588965512
> Reviewed-on: https://skia-review.googlesource.com/8600
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
>
TBR=bungeman@google.com,reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:6250
Change-Id: If55f69f061dc4439ca2faa62807a9c5694ebbeb4
Reviewed-on: https://skia-review.googlesource.com/8687
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'gm/texteffects.cpp')
-rw-r--r-- | gm/texteffects.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gm/texteffects.cpp b/gm/texteffects.cpp index e74d7a97f5..c4c389a065 100644 --- a/gm/texteffects.cpp +++ b/gm/texteffects.cpp @@ -195,6 +195,38 @@ 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); +} + static SkPath create_underline(const SkTDArray<SkScalar>& intersections, SkScalar last, SkScalar finalPos, SkScalar uPos, SkScalar uWidth, SkScalar textSize) { |