Index: gm/colorwheel.cpp |
diff --git a/gm/colorwheel.cpp b/gm/colorwheel.cpp |
index f74eaf6a9874720fdbf428156a9dd248bf3dabf2..8cf94646e5c9766d095c1906a3dd9e9eebb6b025 100644 |
--- a/gm/colorwheel.cpp |
+++ b/gm/colorwheel.cpp |
@@ -5,29 +5,12 @@ |
* found in the LICENSE file. |
*/ |
+#include "Checkerboard.h" |
#include "Resources.h" |
#include "SkData.h" |
#include "gm.h" |
#include "sk_tool_utils.h" |
-static void checkerboard( |
- SkCanvas* canvas, int w, int h, int size, SkColor c1, SkColor c2) { |
- SkAutoCanvasRestore autoCanvasRestore(canvas, true); |
- canvas->clipRect(SkRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h))); |
- canvas->drawColor(c1); |
- SkPaint paint; |
- paint.setColor(c2); |
- SkScalar s = SkIntToScalar(size); |
- for (int y = 0; y < h; y += size) { |
- SkScalar ty = SkIntToScalar(y); |
- bool oddRow = (y % (2 * size)) != 0; |
- for (int x = oddRow ? size : 0; x < w; x += (2 * size)) { |
- SkScalar tx = SkIntToScalar(x); |
- canvas->drawRect(SkRect::MakeXYWH(tx, ty, s, s), paint); |
- } |
- } |
-} |
- |
static void draw_bitmap(SkCanvas* canvas, const char* resource, int x, int y) { |
SkBitmap bitmap; |
if (GetResourceAsBitmap(resource, &bitmap)) { |
@@ -48,8 +31,7 @@ static void draw_bitmap(SkCanvas* canvas, const char* resource, int x, int y) { |
background and compression artifacts. |
*/ |
DEF_SIMPLE_GM(colorwheel, canvas, 256, 256) { |
- canvas->clear(SK_ColorWHITE); |
- checkerboard(canvas, 256, 556, 8, 0xFF999999, 0xFF666666); |
+ sk_tools::DrawCheckerboard(canvas); |
draw_bitmap(canvas, "color_wheel.png", 0, 0); // top left |
draw_bitmap(canvas, "color_wheel.gif", 128, 0); // top right |
draw_bitmap(canvas, "color_wheel.webp", 0, 128); // bottom left |