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 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkRegion.h" | 10 #include "SkRegion.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)]; | 55 SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)]; |
56 | 56 |
57 protected: | 57 protected: |
58 | 58 |
59 enum { | 59 enum { |
60 kPOTSize = 32, | 60 kPOTSize = 32, |
61 kNPOTSize = 21, | 61 kNPOTSize = 21, |
62 }; | 62 }; |
63 | 63 |
64 SkString onShortName() SK_OVERRIDE { | 64 SkString onShortName() override { |
65 SkString name("tilemodes"); | 65 SkString name("tilemodes"); |
66 if (!fPowerOfTwoSize) { | 66 if (!fPowerOfTwoSize) { |
67 name.append("_npot"); | 67 name.append("_npot"); |
68 } | 68 } |
69 return name; | 69 return name; |
70 } | 70 } |
71 | 71 |
72 SkISize onISize() SK_OVERRIDE { return SkISize::Make(880, 560); } | 72 SkISize onISize() override { return SkISize::Make(880, 560); } |
73 | 73 |
74 void onOnceBeforeDraw() SK_OVERRIDE { | 74 void onOnceBeforeDraw() override { |
75 int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize; | 75 int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize; |
76 for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) { | 76 for (size_t i = 0; i < SK_ARRAY_COUNT(gColorTypes); i++) { |
77 makebm(&fTexture[i], gColorTypes[i], size, size); | 77 makebm(&fTexture[i], gColorTypes[i], size, size); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 81 void onDraw(SkCanvas* canvas) override { |
82 | 82 |
83 int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize; | 83 int size = fPowerOfTwoSize ? kPOTSize : kNPOTSize; |
84 | 84 |
85 SkRect r = { 0, 0, SkIntToScalar(size*2), SkIntToScalar(size*2) }; | 85 SkRect r = { 0, 0, SkIntToScalar(size*2), SkIntToScalar(size*2) }; |
86 | 86 |
87 static const char* gConfigNames[] = { "8888", "565", "4444" }; | 87 static const char* gConfigNames[] = { "8888", "565", "4444" }; |
88 | 88 |
89 static const bool gFilters[] = { false, true }; | 89 static const bool gFilters[] = { false, true }; |
90 static const char* gFilterNames[] = { "point",
"bilinear" }; | 90 static const char* gFilterNames[] = { "point",
"bilinear" }; |
91 | 91 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 class Tiling2GM : public skiagm::GM { | 188 class Tiling2GM : public skiagm::GM { |
189 ShaderProc fProc; | 189 ShaderProc fProc; |
190 SkString fName; | 190 SkString fName; |
191 public: | 191 public: |
192 Tiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { | 192 Tiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { |
193 fName.printf("tilemode_%s", name); | 193 fName.printf("tilemode_%s", name); |
194 } | 194 } |
195 | 195 |
196 protected: | 196 protected: |
197 | 197 |
198 SkString onShortName() SK_OVERRIDE { | 198 SkString onShortName() override { |
199 return fName; | 199 return fName; |
200 } | 200 } |
201 | 201 |
202 SkISize onISize() SK_OVERRIDE { return SkISize::Make(880, 560); } | 202 SkISize onISize() override { return SkISize::Make(880, 560); } |
203 | 203 |
204 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 204 void onDraw(SkCanvas* canvas) override { |
205 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); | 205 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); |
206 | 206 |
207 const SkScalar w = SkIntToScalar(gWidth); | 207 const SkScalar w = SkIntToScalar(gWidth); |
208 const SkScalar h = SkIntToScalar(gHeight); | 208 const SkScalar h = SkIntToScalar(gHeight); |
209 SkRect r = { -w, -h, w*2, h*2 }; | 209 SkRect r = { -w, -h, w*2, h*2 }; |
210 | 210 |
211 static const SkShader::TileMode gModes[] = { | 211 static const SkShader::TileMode gModes[] = { |
212 SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMi
rror_TileMode | 212 SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMi
rror_TileMode |
213 }; | 213 }; |
214 static const char* gModeNames[] = { | 214 static const char* gModeNames[] = { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 private: | 257 private: |
258 typedef skiagm::GM INHERITED; | 258 typedef skiagm::GM INHERITED; |
259 }; | 259 }; |
260 | 260 |
261 ////////////////////////////////////////////////////////////////////////////// | 261 ////////////////////////////////////////////////////////////////////////////// |
262 | 262 |
263 DEF_GM( return new TilingGM(true); ) | 263 DEF_GM( return new TilingGM(true); ) |
264 DEF_GM( return new TilingGM(false); ) | 264 DEF_GM( return new TilingGM(false); ) |
265 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) | 265 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) |
266 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) | 266 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) |
OLD | NEW |