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 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 paint.setAlpha(alpha); | 197 paint.setAlpha(alpha); |
198 paint.setShader(shaders[y]); | 198 paint.setShader(shaders[y]); |
199 canvas->drawRect(r, paint); | 199 canvas->drawRect(r, paint); |
200 | 200 |
201 canvas->translate(r.width() + 5, 0); | 201 canvas->translate(r.width() + 5, 0); |
202 } | 202 } |
203 canvas->restore(); | 203 canvas->restore(); |
204 canvas->translate(0, r.height() + 5); | 204 canvas->translate(0, r.height() + 5); |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 private: | 208 private: |
209 /** This determines the length and width of the bitmaps used in the ComposeS
haders. Values | 209 /** This determines the length and width of the bitmaps used in the ComposeS
haders. Values |
210 * above 20 may cause an SkASSERT to fail in SkSmallAllocator. However, lar
ger values will | 210 * above 20 may cause an SkASSERT to fail in SkSmallAllocator. However, lar
ger values will |
211 * work in a release build. You can change this parameter and then compile
a release build | 211 * work in a release build. You can change this parameter and then compile
a release build |
212 * to have this GM draw larger bitmaps for easier visual inspection. | 212 * to have this GM draw larger bitmaps for easier visual inspection. |
213 */ | 213 */ |
214 static const int squareLength = 20; | 214 static const int squareLength = 20; |
215 | 215 |
216 SkBitmap fColorBitmap; | 216 SkBitmap fColorBitmap; |
217 SkBitmap fAlpha8Bitmap; | 217 SkBitmap fAlpha8Bitmap; |
218 sk_sp<SkShader> fColorBitmapShader; | 218 sk_sp<SkShader> fColorBitmapShader; |
219 sk_sp<SkShader> fAlpha8BitmapShader; | 219 sk_sp<SkShader> fAlpha8BitmapShader; |
220 sk_sp<SkShader> fLinearGradientShader; | 220 sk_sp<SkShader> fLinearGradientShader; |
221 | 221 |
222 typedef GM INHERITED; | 222 typedef GM INHERITED; |
223 }; | 223 }; |
224 | 224 |
225 ////////////////////////////////////////////////////////////////////////////// | 225 ////////////////////////////////////////////////////////////////////////////// |
226 | 226 |
227 DEF_GM( return new ComposeShaderGM; ) | 227 DEF_GM( return new ComposeShaderGM; ) |
228 DEF_GM( return new ComposeShaderAlphaGM; ) | 228 DEF_GM( return new ComposeShaderAlphaGM; ) |
229 DEF_GM( return new ComposeShaderBitmapGM; ) | 229 DEF_GM( return new ComposeShaderBitmapGM; ) |
OLD | NEW |