Index: gm/tileimagefilter.cpp |
diff --git a/gm/tileimagefilter.cpp b/gm/tileimagefilter.cpp |
index 7d1a3f08c3dd39a0ff47d3ea1ccd6fe81b5fcf4b..1d58def66bdcf25945ded8eb685186a0d1bd8dd7 100644 |
--- a/gm/tileimagefilter.cpp |
+++ b/gm/tileimagefilter.cpp |
@@ -5,11 +5,12 @@ |
* found in the LICENSE file. |
*/ |
-#include "gm.h" |
-#include "SkColorMatrixFilter.h" |
+#include "Checkerboard.h" |
+#include "SkBitmapSource.h" |
#include "SkColorFilterImageFilter.h" |
+#include "SkColorMatrixFilter.h" |
#include "SkTileImageFilter.h" |
-#include "SkBitmapSource.h" |
+#include "gm.h" |
#define WIDTH 400 |
#define HEIGHT 100 |
@@ -41,27 +42,6 @@ protected: |
canvas.drawText(str, strlen(str), SkIntToScalar(10), SkIntToScalar(45), 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); |
} |
@@ -69,7 +49,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); |