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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 SkString onShortName() SK_OVERRIDE { | 64 SkString onShortName() SK_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() SK_OVERRIDE { return SkISize::Make(880, 560); } |
73 | 73 |
74 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 74 void onOnceBeforeDraw() SK_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 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 81 void onDraw(SkCanvas* canvas) SK_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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
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 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 197 uint32_t onGetFlags() const SK_OVERRIDE { |
198 return kSkipTiled_Flag; | 198 return kSkipTiled_Flag; |
199 } | 199 } |
200 | 200 |
201 SkString onShortName() SK_OVERRIDE { | 201 SkString onShortName() SK_OVERRIDE { |
202 return fName; | 202 return fName; |
203 } | 203 } |
204 | 204 |
205 SkISize onISize() SK_OVERRIDE { return SkISize::Make(880, 560); } | 205 SkISize onISize() SK_OVERRIDE { return SkISize::Make(880, 560); } |
206 | 206 |
207 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 207 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
208 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); | 208 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); |
209 | 209 |
210 const SkScalar w = SkIntToScalar(gWidth); | 210 const SkScalar w = SkIntToScalar(gWidth); |
211 const SkScalar h = SkIntToScalar(gHeight); | 211 const SkScalar h = SkIntToScalar(gHeight); |
212 SkRect r = { -w, -h, w*2, h*2 }; | 212 SkRect r = { -w, -h, w*2, h*2 }; |
213 | 213 |
214 static const SkShader::TileMode gModes[] = { | 214 static const SkShader::TileMode gModes[] = { |
215 SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMi
rror_TileMode | 215 SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMi
rror_TileMode |
216 }; | 216 }; |
217 static const char* gModeNames[] = { | 217 static const char* gModeNames[] = { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 private: | 260 private: |
261 typedef skiagm::GM INHERITED; | 261 typedef skiagm::GM INHERITED; |
262 }; | 262 }; |
263 | 263 |
264 ////////////////////////////////////////////////////////////////////////////// | 264 ////////////////////////////////////////////////////////////////////////////// |
265 | 265 |
266 DEF_GM( return new TilingGM(true); ) | 266 DEF_GM( return new TilingGM(true); ) |
267 DEF_GM( return new TilingGM(false); ) | 267 DEF_GM( return new TilingGM(false); ) |
268 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) | 268 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) |
269 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) | 269 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) |
OLD | NEW |