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 "SkColorFilterImageFilter.h" | 10 #include "SkColorFilterImageFilter.h" |
11 #include "SkColorMatrixFilter.h" | 11 #include "SkColorMatrixFilter.h" |
12 #include "SkTileImageFilter.h" | 12 #include "SkTileImageFilter.h" |
13 #include "gm.h" | 13 #include "gm.h" |
14 | 14 |
15 #define WIDTH 400 | 15 #define WIDTH 400 |
16 #define HEIGHT 100 | 16 #define HEIGHT 100 |
17 #define MARGIN 12 | 17 #define MARGIN 12 |
18 | 18 |
(...skipping 26 matching lines...) Expand all Loading... |
45 virtual SkISize onISize() { | 45 virtual SkISize onISize() { |
46 return SkISize::Make(WIDTH, HEIGHT); | 46 return SkISize::Make(WIDTH, HEIGHT); |
47 } | 47 } |
48 | 48 |
49 virtual void onDraw(SkCanvas* canvas) { | 49 virtual void onDraw(SkCanvas* canvas) { |
50 if (!fInitialized) { | 50 if (!fInitialized) { |
51 make_bitmap(); | 51 make_bitmap(); |
52 | 52 |
53 fCheckerboard.allocN32Pixels(80, 80); | 53 fCheckerboard.allocN32Pixels(80, 80); |
54 SkCanvas checkerboardCanvas(fCheckerboard); | 54 SkCanvas checkerboardCanvas(fCheckerboard); |
55 sk_tools::DrawCheckerboard(&checkerboardCanvas, 0xFFA0A0A0, 0xFF4040
40, 8); | 55 sk_tool_utils::draw_checkerboard(&checkerboardCanvas, 0xFFA0A0A0, 0x
FF404040, 8); |
56 | 56 |
57 fInitialized = true; | 57 fInitialized = true; |
58 } | 58 } |
59 canvas->clear(0x00000000); | 59 canvas->clear(0x00000000); |
60 | 60 |
61 int x = 0, y = 0; | 61 int x = 0, y = 0; |
62 for (size_t i = 0; i < 4; i++) { | 62 for (size_t i = 0; i < 4; i++) { |
63 SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap; | 63 SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap; |
64 SkRect srcRect = SkRect::MakeXYWH(SkIntToScalar(bitmap->width()/4), | 64 SkRect srcRect = SkRect::MakeXYWH(SkIntToScalar(bitmap->width()/4), |
65 SkIntToScalar(bitmap->height()/4), | 65 SkIntToScalar(bitmap->height()/4), |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 SkBitmap fBitmap, fCheckerboard; | 113 SkBitmap fBitmap, fCheckerboard; |
114 bool fInitialized; | 114 bool fInitialized; |
115 }; | 115 }; |
116 | 116 |
117 ////////////////////////////////////////////////////////////////////////////// | 117 ////////////////////////////////////////////////////////////////////////////// |
118 | 118 |
119 static GM* MyFactory(void*) { return new TileImageFilterGM; } | 119 static GM* MyFactory(void*) { return new TileImageFilterGM; } |
120 static GMRegistry reg(MyFactory); | 120 static GMRegistry reg(MyFactory); |
121 | 121 |
122 } | 122 } |
OLD | NEW |