OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 | 8 |
9 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
10 | 10 |
11 #include "gm.h" | 11 #include "gm.h" |
12 | 12 |
13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
14 #include "GrContext.h" | 14 #include "GrContext.h" |
15 #include "SkColorPriv.h" | 15 #include "SkColorPriv.h" |
16 #include "effects/GrPorterDuffXferProcessor.h" | 16 #include "effects/GrPorterDuffXferProcessor.h" |
17 #include "effects/GrSimpleTextureEffect.h" | 17 #include "effects/GrSimpleTextureEffect.h" |
18 | 18 |
19 namespace skiagm { | 19 namespace skiagm { |
20 | 20 |
21 static const int S = 200; | 21 static const int S = 200; |
22 | 22 |
23 class TexDataGM : public GM { | 23 class TexDataGM : public GM { |
24 public: | 24 public: |
25 TexDataGM() { | 25 TexDataGM() { |
26 this->setBGColor(0xff000000); | 26 this->setBGColor(0xff000000); |
27 } | 27 } |
28 | 28 |
29 protected: | 29 protected: |
30 SkString onShortName() SK_OVERRIDE { | 30 SkString onShortName() override { |
31 return SkString("texdata"); | 31 return SkString("texdata"); |
32 } | 32 } |
33 | 33 |
34 SkISize onISize() SK_OVERRIDE { | 34 SkISize onISize() override { |
35 return SkISize::Make(2*S, 2*S); | 35 return SkISize::Make(2*S, 2*S); |
36 } | 36 } |
37 | 37 |
38 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 38 void onDraw(SkCanvas* canvas) override { |
39 GrRenderTarget* target = canvas->internal_private_accessTopLayerRenderTa
rget(); | 39 GrRenderTarget* target = canvas->internal_private_accessTopLayerRenderTa
rget(); |
40 GrContext* ctx = canvas->getGrContext(); | 40 GrContext* ctx = canvas->getGrContext(); |
41 if (ctx && target) { | 41 if (ctx && target) { |
42 SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S)); | 42 SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S)); |
43 static const int stride = 2 * S; | 43 static const int stride = 2 * S; |
44 static const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40); | 44 static const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40); |
45 static const SkPMColor white = SkPackARGB32(0xff, 0xff, 0xff, 0xff); | 45 static const SkPMColor white = SkPackARGB32(0xff, 0xff, 0xff, 0xff); |
46 static const SkPMColor red = SkPackARGB32(0x80, 0x80, 0x00, 0x00); | 46 static const SkPMColor red = SkPackARGB32(0x80, 0x80, 0x00, 0x00); |
47 static const SkPMColor blue = SkPackARGB32(0x80, 0x00, 0x00, 0x80); | 47 static const SkPMColor blue = SkPackARGB32(0x80, 0x00, 0x00, 0x80); |
48 static const SkPMColor green = SkPackARGB32(0x80, 0x00, 0x80, 0x00); | 48 static const SkPMColor green = SkPackARGB32(0x80, 0x00, 0x80, 0x00); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 }; | 136 }; |
137 | 137 |
138 ////////////////////////////////////////////////////////////////////////////// | 138 ////////////////////////////////////////////////////////////////////////////// |
139 | 139 |
140 static GM* MyFactory(void*) { return new TexDataGM; } | 140 static GM* MyFactory(void*) { return new TexDataGM; } |
141 static GMRegistry reg(MyFactory); | 141 static GMRegistry reg(MyFactory); |
142 | 142 |
143 } | 143 } |
144 | 144 |
145 #endif | 145 #endif |
OLD | NEW |