aboutsummaryrefslogtreecommitdiff
path: root/gm/tilemodes_scaled.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gm/tilemodes_scaled.cpp')
-rw-r--r--gm/tilemodes_scaled.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/gm/tilemodes_scaled.cpp b/gm/tilemodes_scaled.cpp
index 78c7641a18..9366927d39 100644
--- a/gm/tilemodes_scaled.cpp
+++ b/gm/tilemodes_scaled.cpp
@@ -77,6 +77,9 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
+ SkPaint textPaint;
+ SkFont font(sk_tool_utils::create_portable_typeface(), 12);
+
float scale = 32.f/kPOTSize;
int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize;
@@ -99,7 +102,6 @@ protected:
SkScalar y = SkIntToScalar(24);
SkScalar x = SkIntToScalar(10)/scale;
- SkFont font(sk_tool_utils::create_portable_typeface());
for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
SkString str;
@@ -138,14 +140,8 @@ protected:
x += r.width() * 4 / 3;
}
}
- {
- SkPaint p;
- SkString str;
- p.setAntiAlias(true);
- sk_tool_utils::set_portable_typeface(&p);
- str.printf("%s, %s", gColorTypeNames[i], gFilterNames[j]);
- canvas->drawString(str, scale*x, scale*(y + r.height() * 2 / 3), p);
- }
+ canvas->drawString(SkStringPrintf("%s, %s", gColorTypeNames[i], gFilterNames[j]),
+ scale * x, scale * (y + r.height() * 2 / 3), font, textPaint);
y += r.height() * 4 / 3;
}