| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 canvas->translate(0, r.height() + 5); | 203 canvas->translate(0, r.height() + 5); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 private: | 207 private: |
| 208 /** This determines the length and width of the bitmaps used in the ComposeS
haders. Values | 208 /** This determines the length and width of the bitmaps used in the ComposeS
haders. Values |
| 209 * above 20 may cause an SkASSERT to fail in SkSmallAllocator. However, lar
ger values will | 209 * above 20 may cause an SkASSERT to fail in SkSmallAllocator. However, lar
ger values will |
| 210 * work in a release build. You can change this parameter and then compile
a release build | 210 * work in a release build. You can change this parameter and then compile
a release build |
| 211 * to have this GM draw larger bitmaps for easier visual inspection. | 211 * to have this GM draw larger bitmaps for easier visual inspection. |
| 212 */ | 212 */ |
| 213 static const int squareLength = 20; | 213 static constexpr int squareLength = 20; |
| 214 | 214 |
| 215 SkBitmap fColorBitmap; | 215 SkBitmap fColorBitmap; |
| 216 SkBitmap fAlpha8Bitmap; | 216 SkBitmap fAlpha8Bitmap; |
| 217 sk_sp<SkShader> fColorBitmapShader; | 217 sk_sp<SkShader> fColorBitmapShader; |
| 218 sk_sp<SkShader> fAlpha8BitmapShader; | 218 sk_sp<SkShader> fAlpha8BitmapShader; |
| 219 sk_sp<SkShader> fLinearGradientShader; | 219 sk_sp<SkShader> fLinearGradientShader; |
| 220 | 220 |
| 221 typedef GM INHERITED; | 221 typedef GM INHERITED; |
| 222 }; | 222 }; |
| 223 | 223 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 paint.setShader( | 257 paint.setShader( |
| 258 SkShader::MakeComposeShader(skMaskShader, skSrcShader, dstInMode)); | 258 SkShader::MakeComposeShader(skMaskShader, skSrcShader, dstInMode)); |
| 259 canvas->drawRect(r, paint); | 259 canvas->drawRect(r, paint); |
| 260 } | 260 } |
| 261 | 261 |
| 262 ////////////////////////////////////////////////////////////////////////////// | 262 ////////////////////////////////////////////////////////////////////////////// |
| 263 | 263 |
| 264 DEF_GM( return new ComposeShaderGM; ) | 264 DEF_GM( return new ComposeShaderGM; ) |
| 265 DEF_GM( return new ComposeShaderAlphaGM; ) | 265 DEF_GM( return new ComposeShaderAlphaGM; ) |
| 266 DEF_GM( return new ComposeShaderBitmapGM; ) | 266 DEF_GM( return new ComposeShaderBitmapGM; ) |
| OLD | NEW |