OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Checkerboard.h" | 8 #include "sk_tool_utils.h" |
9 #include "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
10 #include "SkOffsetImageFilter.h" | 10 #include "SkOffsetImageFilter.h" |
11 #include "gm.h" | 11 #include "gm.h" |
12 | 12 |
13 #define WIDTH 600 | 13 #define WIDTH 600 |
14 #define HEIGHT 100 | 14 #define HEIGHT 100 |
15 #define MARGIN 12 | 15 #define MARGIN 12 |
16 | 16 |
17 namespace skiagm { | 17 namespace skiagm { |
18 | 18 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 canvas->drawRect(clipRect, strokePaint); | 66 canvas->drawRect(clipRect, strokePaint); |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 virtual void onDraw(SkCanvas* canvas) { | 70 virtual void onDraw(SkCanvas* canvas) { |
71 if (!fInitialized) { | 71 if (!fInitialized) { |
72 make_bitmap(); | 72 make_bitmap(); |
73 | 73 |
74 fCheckerboard.allocN32Pixels(80, 80); | 74 fCheckerboard.allocN32Pixels(80, 80); |
75 SkCanvas checkerboardCanvas(fCheckerboard); | 75 SkCanvas checkerboardCanvas(fCheckerboard); |
76 sk_tools::DrawCheckerboard(&checkerboardCanvas, 0xFFA0A0A0, 0xFF4040
40, 8); | 76 sk_tool_utils::draw_checkerboard(&checkerboardCanvas, 0xFFA0A0A0, 0x
FF404040, 8); |
77 | 77 |
78 fInitialized = true; | 78 fInitialized = true; |
79 } | 79 } |
80 canvas->clear(0x00000000); | 80 canvas->clear(0x00000000); |
81 SkPaint paint; | 81 SkPaint paint; |
82 | 82 |
83 for (int i = 0; i < 4; i++) { | 83 for (int i = 0; i < 4; i++) { |
84 SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap; | 84 SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap; |
85 SkIRect cropRect = SkIRect::MakeXYWH(i * 12, | 85 SkIRect cropRect = SkIRect::MakeXYWH(i * 12, |
86 i * 8, | 86 i * 8, |
(...skipping 22 matching lines...) Expand all Loading... |
109 SkBitmap fBitmap, fCheckerboard; | 109 SkBitmap fBitmap, fCheckerboard; |
110 bool fInitialized; | 110 bool fInitialized; |
111 }; | 111 }; |
112 | 112 |
113 ////////////////////////////////////////////////////////////////////////////// | 113 ////////////////////////////////////////////////////////////////////////////// |
114 | 114 |
115 static GM* MyFactory(void*) { return new OffsetImageFilterGM; } | 115 static GM* MyFactory(void*) { return new OffsetImageFilterGM; } |
116 static GMRegistry reg(MyFactory); | 116 static GMRegistry reg(MyFactory); |
117 | 117 |
118 } | 118 } |
OLD | NEW |