Index: gm/imagefiltersscaled.cpp |
diff --git a/gm/imagefiltersscaled.cpp b/gm/imagefiltersscaled.cpp |
index b419187ffff37be31cad7d4eeaaaae7b62d6f2df..084de00fbe5afe13ffb9167719ff94fd457e2d9b 100644 |
--- a/gm/imagefiltersscaled.cpp |
+++ b/gm/imagefiltersscaled.cpp |
@@ -5,20 +5,21 @@ |
* 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 "SkLightingImageFilter.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 SkIntToScalar(4) |
@@ -40,27 +41,6 @@ protected: |
return SkISize::Make(1428, 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: |
virtual void onDraw(SkCanvas* canvas) { |
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; |
} |