OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 /** | 37 /** |
38 * Create a red & green stripes on black texture | 38 * Create a red & green stripes on black texture |
39 */ | 39 */ |
40 void createTexture() { | 40 void createTexture() { |
41 if (fTextureCreated) { | 41 if (fTextureCreated) { |
42 return; | 42 return; |
43 } | 43 } |
44 | 44 |
45 static const int xSize = 16; | 45 constexpr int xSize = 16; |
46 static const int ySize = 16; | 46 constexpr int ySize = 16; |
47 | 47 |
48 fTexture.allocN32Pixels(xSize, ySize); | 48 fTexture.allocN32Pixels(xSize, ySize); |
49 SkPMColor* addr = fTexture.getAddr32(0, 0); | 49 SkPMColor* addr = fTexture.getAddr32(0, 0); |
50 | 50 |
51 for (int y = 0; y < ySize; ++y) { | 51 for (int y = 0; y < ySize; ++y) { |
52 for (int x = 0; x < xSize; ++x) { | 52 for (int x = 0; x < xSize; ++x) { |
53 addr[y*xSize+x] = SkPreMultiplyColor(SK_ColorBLACK); | 53 addr[y*xSize+x] = SkPreMultiplyColor(SK_ColorBLACK); |
54 | 54 |
55 if ((y % 5) == 0) { | 55 if ((y % 5) == 0) { |
56 addr[y*xSize+x] = SkPreMultiplyColor(SK_ColorRED); | 56 addr[y*xSize+x] = SkPreMultiplyColor(SK_ColorRED); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 typedef GM INHERITED; | 143 typedef GM INHERITED; |
144 }; | 144 }; |
145 | 145 |
146 ////////////////////////////////////////////////////////////////////////////// | 146 ////////////////////////////////////////////////////////////////////////////// |
147 | 147 |
148 static GM* MyFactory(void*) { return new SamplerStressGM; } | 148 static GM* MyFactory(void*) { return new SamplerStressGM; } |
149 static GMRegistry reg(MyFactory); | 149 static GMRegistry reg(MyFactory); |
150 | 150 |
151 } | 151 } |
OLD | NEW |