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 "sk_tool_utils.h" | 9 #include "sk_tool_utils.h" |
10 #include "SkArithmeticMode.h" | 10 #include "SkArithmeticMode.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 SkString onShortName() override { | 28 SkString onShortName() override { |
29 return SkString("xfermodeimagefilter"); | 29 return SkString("xfermodeimagefilter"); |
30 } | 30 } |
31 | 31 |
32 void make_bitmap() { | 32 void make_bitmap() { |
33 fBitmap.allocN32Pixels(80, 80); | 33 fBitmap.allocN32Pixels(80, 80); |
34 SkCanvas canvas(fBitmap); | 34 SkCanvas canvas(fBitmap); |
35 canvas.clear(0x00000000); | 35 canvas.clear(0x00000000); |
36 SkPaint paint; | 36 SkPaint paint; |
37 paint.setAntiAlias(true); | 37 paint.setAntiAlias(true); |
38 sk_tool_utils::set_portable_typeface(&paint); | 38 sk_tool_utils::set_portable_typeface_always(&paint); |
39 paint.setColor(0xD000D000); | 39 paint.setColor(0xD000D000); |
40 paint.setTextSize(SkIntToScalar(96)); | 40 paint.setTextSize(SkIntToScalar(96)); |
41 const char* str = "e"; | 41 const char* str = "e"; |
42 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65),
paint); | 42 canvas.drawText(str, strlen(str), SkIntToScalar(15), SkIntToScalar(65),
paint); |
43 } | 43 } |
44 | 44 |
45 SkISize onISize() override { | 45 SkISize onISize() override { |
46 return SkISize::Make(WIDTH, HEIGHT); | 46 return SkISize::Make(WIDTH, HEIGHT); |
47 } | 47 } |
48 | 48 |
(...skipping 14 matching lines...) Expand all Loading... |
63 canvas->clipRect(rect); | 63 canvas->clipRect(rect); |
64 canvas->drawPaint(paint); | 64 canvas->drawPaint(paint); |
65 canvas->restore(); | 65 canvas->restore(); |
66 } | 66 } |
67 | 67 |
68 void onOnceBeforeDraw() override { | 68 void onOnceBeforeDraw() override { |
69 make_bitmap(); | 69 make_bitmap(); |
70 | 70 |
71 fCheckerboard.allocN32Pixels(80, 80); | 71 fCheckerboard.allocN32Pixels(80, 80); |
72 SkCanvas checkerboardCanvas(fCheckerboard); | 72 SkCanvas checkerboardCanvas(fCheckerboard); |
73 sk_tool_utils::draw_checkerboard(&checkerboardCanvas, 0xFFA0A0A0, 0xFF40
4040, 8); | 73 sk_tool_utils::draw_checkerboard(&checkerboardCanvas, |
| 74 sk_tool_utils::color_to_565(0xFFA0A0A0), |
| 75 sk_tool_utils::color_to_565(0xFF404040), 8); |
74 } | 76 } |
75 | 77 |
76 void onDraw(SkCanvas* canvas) override { | 78 void onDraw(SkCanvas* canvas) override { |
77 canvas->clear(SK_ColorBLACK); | 79 canvas->clear(SK_ColorBLACK); |
78 SkPaint paint; | 80 SkPaint paint; |
79 | 81 |
80 const struct { | 82 const struct { |
81 SkXfermode::Mode fMode; | 83 SkXfermode::Mode fMode; |
82 const char* fLabel; | 84 const char* fLabel; |
83 } gModes[] = { | 85 } gModes[] = { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 private: | 203 private: |
202 SkBitmap fBitmap, fCheckerboard; | 204 SkBitmap fBitmap, fCheckerboard; |
203 typedef GM INHERITED; | 205 typedef GM INHERITED; |
204 }; | 206 }; |
205 | 207 |
206 ////////////////////////////////////////////////////////////////////////////// | 208 ////////////////////////////////////////////////////////////////////////////// |
207 | 209 |
208 DEF_GM( return new XfermodeImageFilterGM; ); | 210 DEF_GM( return new XfermodeImageFilterGM; ); |
209 | 211 |
210 } | 212 } |
OLD | NEW |