| 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkShader.h" | 10 #include "SkShader.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual ~SamplerStressGM() { | 27 virtual ~SamplerStressGM() { |
| 28 } | 28 } |
| 29 | 29 |
| 30 protected: | 30 protected: |
| 31 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 31 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 32 return kSkipTiled_Flag; | 32 return kSkipTiled_Flag; |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual SkString onShortName() { | 35 virtual SkString onShortName() SK_OVERRIDE { |
| 36 return SkString("gpusamplerstress"); | 36 return SkString("gpusamplerstress"); |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual SkISize onISize() { | 39 virtual SkISize onISize() SK_OVERRIDE { |
| 40 return SkISize::Make(640, 480); | 40 return SkISize::Make(640, 480); |
| 41 } | 41 } |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Create a red & green stripes on black texture | 44 * Create a red & green stripes on black texture |
| 45 */ | 45 */ |
| 46 void createTexture() { | 46 void createTexture() { |
| 47 if (fTextureCreated) { | 47 if (fTextureCreated) { |
| 48 return; | 48 return; |
| 49 } | 49 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 void createMaskFilter() { | 85 void createMaskFilter() { |
| 86 if (fMaskFilter.get()) { | 86 if (fMaskFilter.get()) { |
| 87 return; | 87 return; |
| 88 } | 88 } |
| 89 | 89 |
| 90 const SkScalar sigma = 1; | 90 const SkScalar sigma = 1; |
| 91 fMaskFilter.reset(SkBlurMaskFilter::Create(kNormal_SkBlurStyle, sigma)); | 91 fMaskFilter.reset(SkBlurMaskFilter::Create(kNormal_SkBlurStyle, sigma)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 virtual void onDraw(SkCanvas* canvas) { | 94 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 95 | |
| 96 createShader(); | 95 createShader(); |
| 97 createMaskFilter(); | 96 createMaskFilter(); |
| 98 | 97 |
| 99 canvas->save(); | 98 canvas->save(); |
| 100 | 99 |
| 101 // draw a letter "M" with a green & red striped texture and a | 100 // draw a letter "M" with a green & red striped texture and a |
| 102 // stipple mask with a round rect soft clip | 101 // stipple mask with a round rect soft clip |
| 103 SkPaint paint; | 102 SkPaint paint; |
| 104 paint.setAntiAlias(true); | 103 paint.setAntiAlias(true); |
| 105 paint.setTextSize(72); | 104 paint.setTextSize(72); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 147 |
| 149 typedef GM INHERITED; | 148 typedef GM INHERITED; |
| 150 }; | 149 }; |
| 151 | 150 |
| 152 ////////////////////////////////////////////////////////////////////////////// | 151 ////////////////////////////////////////////////////////////////////////////// |
| 153 | 152 |
| 154 static GM* MyFactory(void*) { return new SamplerStressGM; } | 153 static GM* MyFactory(void*) { return new SamplerStressGM; } |
| 155 static GMRegistry reg(MyFactory); | 154 static GMRegistry reg(MyFactory); |
| 156 | 155 |
| 157 } | 156 } |
| OLD | NEW |