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>
diff --git a/samplecode/SampleFilter2.cpp b/samplecode/SampleFilter2.cpp
index 9b2298a..e6134bd 100644
--- a/samplecode/SampleFilter2.cpp
+++ b/samplecode/SampleFilter2.cpp
@@ -89,7 +89,7 @@
s.appendS32(paint.isDither());
s.append(" filter=");
s.appendS32(paint.getFilterQuality() != kNone_SkFilterQuality);
- canvas->drawText(s.c_str(), s.size(), x + W/2,
+ canvas->drawString(s, x + W/2,
y - p.getTextSize(), p);
}
if (k+j == 2) {
@@ -99,7 +99,7 @@
SkString s;
s.append(" depth=");
s.appendS32(fBitmaps[i].colorType() == kRGB_565_SkColorType ? 16 : 32);
- canvas->drawText(s.c_str(), s.size(), x + W + SkIntToScalar(4),
+ canvas->drawString(s, x + W + SkIntToScalar(4),
y + H/2, p);
}
}