Index: gm/xfermodeimagefilter.cpp |
diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp |
index ac5fa5e4b21cf873b7b681fe696742cc3158cb61..b90543ffb45345b3fbb7320b81a7e9ae7f055fb7 100644 |
--- a/gm/xfermodeimagefilter.cpp |
+++ b/gm/xfermodeimagefilter.cpp |
@@ -6,6 +6,7 @@ |
*/ |
#include "gm.h" |
+#include "Checkerboard.h" |
#include "SkArithmeticMode.h" |
#include "SkOffsetImageFilter.h" |
#include "SkXfermodeImageFilter.h" |
@@ -41,27 +42,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(); |
- } |
- } |
- } |
- |
SkISize onISize() SK_OVERRIDE { |
return SkISize::Make(WIDTH, HEIGHT); |
} |
@@ -87,7 +67,10 @@ protected: |
void onOnceBeforeDraw() SK_OVERRIDE { |
make_bitmap(); |
- make_checkerboard(); |
+ |
+ fCheckerboard.allocN32Pixels(80, 80); |
+ SkCanvas checkerboardCanvas(fCheckerboard); |
+ sk_tools::DrawCheckerboard(&checkerboardCanvas, 0xFFA0A0A0, 0xFF404040, 8); |
} |
void onDraw(SkCanvas* canvas) SK_OVERRIDE { |