| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 ScaledTilingGM(bool powerOfTwoSize) | 61 ScaledTilingGM(bool powerOfTwoSize) |
| 62 : fLooper(SkBlurDrawLooper::Create(0x88000000, | 62 : fLooper(SkBlurDrawLooper::Create(0x88000000, |
| 63 SkBlurMask::ConvertRadiusToSigma(
SkIntToScalar(1)), | 63 SkBlurMask::ConvertRadiusToSigma(
SkIntToScalar(1)), |
| 64 SkIntToScalar(2), SkIntToScalar(2
))) | 64 SkIntToScalar(2), SkIntToScalar(2
))) |
| 65 , fPowerOfTwoSize(powerOfTwoSize) { | 65 , fPowerOfTwoSize(powerOfTwoSize) { |
| 66 } | 66 } |
| 67 | 67 |
| 68 SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)]; | 68 SkBitmap fTexture[SK_ARRAY_COUNT(gColorTypes)]; |
| 69 | 69 |
| 70 protected: | 70 protected: |
| 71 | |
| 72 enum { | 71 enum { |
| 73 kPOTSize = 4, | 72 kPOTSize = 4, |
| 74 kNPOTSize = 3, | 73 kNPOTSize = 3, |
| 75 }; | 74 }; |
| 76 | 75 |
| 76 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 77 if (!fPowerOfTwoSize) { |
| 78 return kSkipTiled_Flag; // Only for 565. 8888 is fine. |
| 79 } |
| 80 return 0; |
| 81 } |
| 82 |
| 77 SkString onShortName() { | 83 SkString onShortName() { |
| 78 SkString name("scaled_tilemodes"); | 84 SkString name("scaled_tilemodes"); |
| 79 if (!fPowerOfTwoSize) { | 85 if (!fPowerOfTwoSize) { |
| 80 name.append("_npot"); | 86 name.append("_npot"); |
| 81 } | 87 } |
| 82 return name; | 88 return name; |
| 83 } | 89 } |
| 84 | 90 |
| 85 SkISize onISize() { return SkISize::Make(880, 760); } | 91 SkISize onISize() { return SkISize::Make(880, 760); } |
| 86 | 92 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 213 |
| 208 class ScaledTiling2GM : public skiagm::GM { | 214 class ScaledTiling2GM : public skiagm::GM { |
| 209 ShaderProc fProc; | 215 ShaderProc fProc; |
| 210 SkString fName; | 216 SkString fName; |
| 211 public: | 217 public: |
| 212 ScaledTiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { | 218 ScaledTiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { |
| 213 fName.printf("scaled_tilemode_%s", name); | 219 fName.printf("scaled_tilemode_%s", name); |
| 214 } | 220 } |
| 215 | 221 |
| 216 protected: | 222 protected: |
| 223 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 224 return kSkipTiled_Flag; |
| 225 } |
| 226 |
| 217 SkString onShortName() { | 227 SkString onShortName() { |
| 218 return fName; | 228 return fName; |
| 219 } | 229 } |
| 220 | 230 |
| 221 SkISize onISize() { return SkISize::Make(880, 560); } | 231 SkISize onISize() { return SkISize::Make(880, 560); } |
| 222 | 232 |
| 223 virtual void onDraw(SkCanvas* canvas) { | 233 virtual void onDraw(SkCanvas* canvas) { |
| 224 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); | 234 canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); |
| 225 | 235 |
| 226 const SkScalar w = SkIntToScalar(gWidth); | 236 const SkScalar w = SkIntToScalar(gWidth); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 private: | 285 private: |
| 276 typedef skiagm::GM INHERITED; | 286 typedef skiagm::GM INHERITED; |
| 277 }; | 287 }; |
| 278 | 288 |
| 279 ////////////////////////////////////////////////////////////////////////////// | 289 ////////////////////////////////////////////////////////////////////////////// |
| 280 | 290 |
| 281 DEF_GM( return new ScaledTilingGM(true); ) | 291 DEF_GM( return new ScaledTilingGM(true); ) |
| 282 DEF_GM( return new ScaledTilingGM(false); ) | 292 DEF_GM( return new ScaledTilingGM(false); ) |
| 283 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) | 293 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) |
| 284 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) | 294 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) |
| OLD | NEW |