Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Unified Diff: gm/xfermodeimagefilter.cpp

Issue 834303005: Factor out checkerboard function in gm and sampleapp into tools. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rename to sk_tools::DrawCheckerboard Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/tileimagefilter.cpp ('k') | gyp/SampleApp.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « gm/tileimagefilter.cpp ('k') | gyp/SampleApp.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698