diff options
author | Cary Clark <caryclark@google.com> | 2017-04-28 15:35:12 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-28 20:41:04 +0000 |
commit | 2a475eae622adc1e8fa29206be1eaf862c23548e (patch) | |
tree | 6bad5dbe2ef7aad1c7e657df6bd8cfe3a752c5fd /tests/DrawTextTest.cpp | |
parent | ec138b40ba940ab0d76b5550ee2c5505629c5293 (diff) |
add drawString helper to canvas
Many tests and examples use drawText with
a guess of how long the text is in bytes,
or a call to strlen(). Add a helper to
SkCanvas to simplify these examples.
Add another helper for SkString.
R=reed@google.com
Change-Id: I0204a31e938f065606f08ee7cd9a6b36db791ee2
Reviewed-on: https://skia-review.googlesource.com/13642
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'tests/DrawTextTest.cpp')
-rw-r--r-- | tests/DrawTextTest.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/DrawTextTest.cpp b/tests/DrawTextTest.cpp index a98b36f321..2f8fe056eb 100644 --- a/tests/DrawTextTest.cpp +++ b/tests/DrawTextTest.cpp @@ -120,11 +120,11 @@ DEF_TEST(DrawText_weirdCoordinates, r) { SkScalar oddballs[] = { 0.0f, (float)INFINITY, (float)NAN, 34359738368.0f }; for (auto x : oddballs) { - canvas->drawText("a", 1, +x, 0.0f, SkPaint()); - canvas->drawText("a", 1, -x, 0.0f, SkPaint()); + canvas->drawString("a", +x, 0.0f, SkPaint()); + canvas->drawString("a", -x, 0.0f, SkPaint()); } for (auto y : oddballs) { - canvas->drawText("a", 1, 0.0f, +y, SkPaint()); - canvas->drawText("a", 1, 0.0f, -y, SkPaint()); + canvas->drawString("a", 0.0f, +y, SkPaint()); + canvas->drawString("a", 0.0f, -y, SkPaint()); } } |