Minor code cleanup (left over from prior CL)
This was requested in https://codereview.chromium.org/1309543012/ (Add new GM to directly exercise perspective bitmap drawing)
Review URL: https://codereview.chromium.org/1320673011
diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp
index 80994a6..e09c0ab 100644
--- a/gm/xfermodeimagefilter.cpp
+++ b/gm/xfermodeimagefilter.cpp
@@ -29,19 +29,6 @@
return SkString("xfermodeimagefilter");
}
- void make_bitmap() {
- fBitmap.allocN32Pixels(80, 80);
- SkCanvas canvas(fBitmap);
- canvas.clear(0x00000000);
- SkPaint paint;
- paint.setAntiAlias(true);
- sk_tool_utils::set_portable_typeface(&paint);
- paint.setColor(0xD000D000);
- paint.setTextSize(SkIntToScalar(96));
- const char* str = "e";
- canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65), paint);
- }
-
SkISize onISize() override {
return SkISize::Make(WIDTH, HEIGHT);
}
@@ -66,13 +53,13 @@
}
void onOnceBeforeDraw() override {
- make_bitmap();
+ fBitmap = sk_tool_utils::create_string_bitmap(80, 80, 0xD000D000, 15, 65, 96, "e");
- fCheckerboard.allocN32Pixels(80, 80);
- SkCanvas checkerboardCanvas(fCheckerboard);
- sk_tool_utils::draw_checkerboard(&checkerboardCanvas,
- sk_tool_utils::color_to_565(0xFFA0A0A0),
- sk_tool_utils::color_to_565(0xFF404040), 8);
+ fCheckerboard = sk_tool_utils::create_checkerboard_bitmap(
+ 80, 80,
+ sk_tool_utils::color_to_565(0xFFA0A0A0),
+ sk_tool_utils::color_to_565(0xFF404040),
+ 8);
}
void onDraw(SkCanvas* canvas) override {