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 "sk_tool_utils.h" | 8 #include "sk_tool_utils.h" |
9 #include "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
10 #include "SkColorFilterImageFilter.h" | 10 #include "SkColorFilterImageFilter.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_tool_utils::draw_checkerboard(&checkerboardCanvas, 0xFFA0A0A0, 0x
FF404040, 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(SK_ColorBLACK); |
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), |
66 SkIntToScalar(bitmap->width()/(i+1
)), | 66 SkIntToScalar(bitmap->width()/(i+1
)), |
67 SkIntToScalar(bitmap->height()/(i+
1))); | 67 SkIntToScalar(bitmap->height()/(i+
1))); |
68 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(i * 8), | 68 SkRect dstRect = SkRect::MakeXYWH(SkIntToScalar(i * 8), |
69 SkIntToScalar(i * 4), | 69 SkIntToScalar(i * 4), |
(...skipping 43 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 |