OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkShader.h" | 10 #include "SkShader.h" |
11 #include "SkXfermode.h" | 11 #include "SkXfermode.h" |
12 #include "SkColorPriv.h" | 12 #include "SkColorPriv.h" |
13 | 13 |
14 namespace skiagm { | 14 namespace skiagm { |
15 | 15 |
16 class Xfermodes2GM : public GM { | 16 class Xfermodes2GM : public GM { |
17 public: | 17 public: |
18 Xfermodes2GM() {} | 18 Xfermodes2GM() {} |
19 | 19 |
20 protected: | 20 protected: |
21 SkString onShortName() SK_OVERRIDE { | 21 SkString onShortName() override { |
22 return SkString("xfermodes2"); | 22 return SkString("xfermodes2"); |
23 } | 23 } |
24 | 24 |
25 SkISize onISize() SK_OVERRIDE { | 25 SkISize onISize() override { |
26 return SkISize::Make(455, 475); | 26 return SkISize::Make(455, 475); |
27 } | 27 } |
28 | 28 |
29 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 29 void onDraw(SkCanvas* canvas) override { |
30 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); | 30 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); |
31 | 31 |
32 const SkScalar w = SkIntToScalar(kSize); | 32 const SkScalar w = SkIntToScalar(kSize); |
33 const SkScalar h = SkIntToScalar(kSize); | 33 const SkScalar h = SkIntToScalar(kSize); |
34 | 34 |
35 SkPaint labelP; | 35 SkPaint labelP; |
36 labelP.setAntiAlias(true); | 36 labelP.setAntiAlias(true); |
37 sk_tool_utils::set_portable_typeface(&labelP); | 37 sk_tool_utils::set_portable_typeface(&labelP); |
38 labelP.setTextAlign(SkPaint::kCenter_Align); | 38 labelP.setTextAlign(SkPaint::kCenter_Align); |
39 | 39 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 #endif | 79 #endif |
80 x += w + SkIntToScalar(10); | 80 x += w + SkIntToScalar(10); |
81 if ((m % W) == W - 1) { | 81 if ((m % W) == W - 1) { |
82 x = 0; | 82 x = 0; |
83 y += h + SkIntToScalar(30); | 83 y += h + SkIntToScalar(30); |
84 } | 84 } |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 private: | 88 private: |
89 void onOnceBeforeDraw() SK_OVERRIDE { | 89 void onOnceBeforeDraw() override { |
90 static const uint32_t kCheckData[] = { | 90 static const uint32_t kCheckData[] = { |
91 SkPackARGB32(0xFF, 0x40, 0x40, 0x40), | 91 SkPackARGB32(0xFF, 0x40, 0x40, 0x40), |
92 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), | 92 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), |
93 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), | 93 SkPackARGB32(0xFF, 0xD0, 0xD0, 0xD0), |
94 SkPackARGB32(0xFF, 0x40, 0x40, 0x40) | 94 SkPackARGB32(0xFF, 0x40, 0x40, 0x40) |
95 }; | 95 }; |
96 SkBitmap bg; | 96 SkBitmap bg; |
97 bg.allocN32Pixels(2, 2, true); | 97 bg.allocN32Pixels(2, 2, true); |
98 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData)); | 98 memcpy(bg.getPixels(), kCheckData, sizeof(kCheckData)); |
99 | 99 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 typedef GM INHERITED; | 146 typedef GM INHERITED; |
147 }; | 147 }; |
148 | 148 |
149 ////////////////////////////////////////////////////////////////////////////// | 149 ////////////////////////////////////////////////////////////////////////////// |
150 | 150 |
151 static GM* MyFactory(void*) { return new Xfermodes2GM; } | 151 static GM* MyFactory(void*) { return new Xfermodes2GM; } |
152 static GMRegistry reg(MyFactory); | 152 static GMRegistry reg(MyFactory); |
153 | 153 |
154 } | 154 } |
OLD | NEW |