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