Index: gm/imagefiltersclipped.cpp |
diff --git a/gm/imagefiltersclipped.cpp b/gm/imagefiltersclipped.cpp |
index beb2e0977a6f1a7f4512179539a05cf683bff315..259342cc277cae6f0aaa2a7e7c71adb78eaa2eab 100644 |
--- a/gm/imagefiltersclipped.cpp |
+++ b/gm/imagefiltersclipped.cpp |
@@ -5,19 +5,20 @@ |
* found in the LICENSE file. |
*/ |
-#include "gm.h" |
-#include "SkColor.h" |
+#include "Checkerboard.h" |
#include "SkBitmapSource.h" |
#include "SkBlurImageFilter.h" |
+#include "SkColor.h" |
#include "SkDisplacementMapEffect.h" |
#include "SkDropShadowImageFilter.h" |
#include "SkGradientShader.h" |
+#include "SkMatrixImageFilter.h" |
#include "SkMorphologyImageFilter.h" |
#include "SkOffsetImageFilter.h" |
#include "SkPerlinNoiseShader.h" |
#include "SkRectShaderImageFilter.h" |
-#include "SkMatrixImageFilter.h" |
#include "SkScalar.h" |
+#include "gm.h" |
#define RESIZE_FACTOR_X SkIntToScalar(2) |
#define RESIZE_FACTOR_Y SkIntToScalar(5) |
@@ -40,27 +41,6 @@ protected: |
return SkISize::Make(860, 500); |
} |
- void make_checkerboard() { |
- fCheckerboard.allocN32Pixels(64, 64); |
- SkCanvas canvas(fCheckerboard); |
- canvas.clear(0x00000000); |
- SkPaint darkPaint; |
- darkPaint.setColor(0xFF404040); |
- SkPaint lightPaint; |
- lightPaint.setColor(0xFFA0A0A0); |
- for (int y = 0; y < 64; y += 16) { |
- for (int x = 0; x < 64; 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(); |
- } |
- } |
- } |
- |
void make_gradient_circle(int width, int height) { |
SkScalar x = SkIntToScalar(width / 2); |
SkScalar y = SkIntToScalar(height / 2); |
@@ -82,7 +62,10 @@ protected: |
void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
if (!fInitialized) { |
- this->make_checkerboard(); |
+ fCheckerboard.allocN32Pixels(64, 64); |
+ SkCanvas checkerboardCanvas(fCheckerboard); |
+ sk_tools::DrawCheckerboard(&checkerboardCanvas, 0xFFA0A0A0, 0xFF404040, 8); |
+ |
this->make_gradient_circle(64, 64); |
fInitialized = true; |
} |