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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 if ((x % 7) == 0) { | 64 if ((x % 7) == 0) { |
65 addr[y*xSize+x] = SkPreMultiplyColor(SK_ColorGREEN); | 65 addr[y*xSize+x] = SkPreMultiplyColor(SK_ColorGREEN); |
66 } | 66 } |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 fTextureCreated = true; | 70 fTextureCreated = true; |
71 } | 71 } |
72 | 72 |
73 void createShader() { | 73 void createShader() { |
74 if (NULL != fShader.get()) { | 74 if (fShader.get()) { |
75 return; | 75 return; |
76 } | 76 } |
77 | 77 |
78 createTexture(); | 78 createTexture(); |
79 | 79 |
80 fShader.reset(SkShader::CreateBitmapShader(fTexture, | 80 fShader.reset(SkShader::CreateBitmapShader(fTexture, |
81 SkShader::kRepeat_TileMode, | 81 SkShader::kRepeat_TileMode, |
82 SkShader::kRepeat_TileMode)); | 82 SkShader::kRepeat_TileMode)); |
83 } | 83 } |
84 | 84 |
85 void createMaskFilter() { | 85 void createMaskFilter() { |
86 if (NULL != 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) { |
95 | 95 |
96 createShader(); | 96 createShader(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 typedef GM INHERITED; | 149 typedef GM INHERITED; |
150 }; | 150 }; |
151 | 151 |
152 ////////////////////////////////////////////////////////////////////////////// | 152 ////////////////////////////////////////////////////////////////////////////// |
153 | 153 |
154 static GM* MyFactory(void*) { return new SamplerStressGM; } | 154 static GM* MyFactory(void*) { return new SamplerStressGM; } |
155 static GMRegistry reg(MyFactory); | 155 static GMRegistry reg(MyFactory); |
156 | 156 |
157 } | 157 } |
OLD | NEW |