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 "gm.h" | 8 #include "gm.h" |
9 #include "SkArithmeticMode.h" | 9 #include "SkArithmeticMode.h" |
10 #include "SkOffsetImageFilter.h" | 10 #include "SkOffsetImageFilter.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 this->setBGColor(0xFF000000); | 23 this->setBGColor(0xFF000000); |
24 } | 24 } |
25 | 25 |
26 protected: | 26 protected: |
27 virtual SkString onShortName() SK_OVERRIDE { | 27 virtual SkString onShortName() SK_OVERRIDE { |
28 return SkString("xfermodeimagefilter"); | 28 return SkString("xfermodeimagefilter"); |
29 } | 29 } |
30 | 30 |
31 void make_bitmap() { | 31 void make_bitmap() { |
32 fBitmap.allocN32Pixels(80, 80); | 32 fBitmap.allocN32Pixels(80, 80); |
33 SkBitmapDevice device(fBitmap); | 33 SkCanvas canvas(fBitmap); |
34 SkCanvas canvas(&device); | |
35 canvas.clear(0x00000000); | 34 canvas.clear(0x00000000); |
36 SkPaint paint; | 35 SkPaint paint; |
37 paint.setAntiAlias(true); | 36 paint.setAntiAlias(true); |
38 paint.setColor(0xD000D000); | 37 paint.setColor(0xD000D000); |
39 paint.setTextSize(SkIntToScalar(96)); | 38 paint.setTextSize(SkIntToScalar(96)); |
40 const char* str = "e"; | 39 const char* str = "e"; |
41 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65),
paint); | 40 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65),
paint); |
42 } | 41 } |
43 | 42 |
44 void make_checkerboard() { | 43 void make_checkerboard() { |
45 fCheckerboard.allocN32Pixels(80, 80); | 44 fCheckerboard.allocN32Pixels(80, 80); |
46 SkBitmapDevice device(fCheckerboard); | 45 SkCanvas canvas(fCheckerboard); |
47 SkCanvas canvas(&device); | |
48 canvas.clear(0x00000000); | 46 canvas.clear(0x00000000); |
49 SkPaint darkPaint; | 47 SkPaint darkPaint; |
50 darkPaint.setColor(0xFF404040); | 48 darkPaint.setColor(0xFF404040); |
51 SkPaint lightPaint; | 49 SkPaint lightPaint; |
52 lightPaint.setColor(0xFFA0A0A0); | 50 lightPaint.setColor(0xFFA0A0A0); |
53 for (int y = 0; y < 80; y += 16) { | 51 for (int y = 0; y < 80; y += 16) { |
54 for (int x = 0; x < 80; x += 16) { | 52 for (int x = 0; x < 80; x += 16) { |
55 canvas.save(); | 53 canvas.save(); |
56 canvas.translate(SkIntToScalar(x), SkIntToScalar(y)); | 54 canvas.translate(SkIntToScalar(x), SkIntToScalar(y)); |
57 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); | 55 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 private: | 219 private: |
222 SkBitmap fBitmap, fCheckerboard; | 220 SkBitmap fBitmap, fCheckerboard; |
223 typedef GM INHERITED; | 221 typedef GM INHERITED; |
224 }; | 222 }; |
225 | 223 |
226 ////////////////////////////////////////////////////////////////////////////// | 224 ////////////////////////////////////////////////////////////////////////////// |
227 | 225 |
228 DEF_GM( return new XfermodeImageFilterGM; ); | 226 DEF_GM( return new XfermodeImageFilterGM; ); |
229 | 227 |
230 } | 228 } |
OLD | NEW |