Index: gm/offsetimagefilter.cpp |
diff --git a/gm/offsetimagefilter.cpp b/gm/offsetimagefilter.cpp |
index 3dafed8823ef498a798a99d8b59797d511e6e55d..2e80a96e34fcc08a71b50cd254e08bd9d73e4d13 100644 |
--- a/gm/offsetimagefilter.cpp |
+++ b/gm/offsetimagefilter.cpp |
@@ -5,9 +5,10 @@ |
* found in the LICENSE file. |
*/ |
-#include "gm.h" |
-#include "SkOffsetImageFilter.h" |
+#include "Checkerboard.h" |
#include "SkBitmapSource.h" |
+#include "SkOffsetImageFilter.h" |
+#include "gm.h" |
#define WIDTH 600 |
#define HEIGHT 100 |
@@ -39,27 +40,6 @@ protected: |
canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65), paint); |
} |
- void make_checkerboard() { |
- fCheckerboard.allocN32Pixels(80, 80); |
- SkCanvas canvas(fCheckerboard); |
- canvas.clear(0x00000000); |
- SkPaint darkPaint; |
- darkPaint.setColor(0xFF404040); |
- SkPaint lightPaint; |
- lightPaint.setColor(0xFFA0A0A0); |
- for (int y = 0; y < 80; y += 16) { |
- for (int x = 0; x < 80; x += 16) { |
- canvas.save(); |
- canvas.translate(SkIntToScalar(x), SkIntToScalar(y)); |
- canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); |
- canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint); |
- canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint); |
- canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); |
- canvas.restore(); |
- } |
- } |
- } |
- |
virtual SkISize onISize() { |
return SkISize::Make(WIDTH, HEIGHT); |
} |
@@ -90,7 +70,11 @@ protected: |
virtual void onDraw(SkCanvas* canvas) { |
if (!fInitialized) { |
make_bitmap(); |
- make_checkerboard(); |
+ |
+ fCheckerboard.allocN32Pixels(80, 80); |
+ SkCanvas checkerboardCanvas(fCheckerboard); |
+ sk_tools::DrawCheckerboard(&checkerboardCanvas, 0xFFA0A0A0, 0xFF404040, 8); |
+ |
fInitialized = true; |
} |
canvas->clear(0x00000000); |