| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 rect.offset(x, y); | 106 rect.offset(x, y); |
| 107 canvas->drawRect(rect, paint); | 107 canvas->drawRect(rect, paint); |
| 108 } | 108 } |
| 109 | 109 |
| 110 canvas->restore(); | 110 canvas->restore(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 SkMaskFilter* createBlur() { | 113 SkMaskFilter* createBlur() { |
| 114 static const SkScalar kBlurSigma = SkBlurMask::ConvertRadiusToSigma(SkIn
tToScalar(25)); | 114 static const SkScalar kBlurSigma = SkBlurMask::ConvertRadiusToSigma(SkIn
tToScalar(25)); |
| 115 | 115 |
| 116 return SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle, | 116 return SkBlurMaskFilter::Create(kNormal_SkBlurStyle, kBlurSigma, |
| 117 kBlurSigma, | |
| 118 SkBlurMaskFilter::kHighQuality_BlurFlag)
; | 117 SkBlurMaskFilter::kHighQuality_BlurFlag)
; |
| 119 } | 118 } |
| 120 | 119 |
| 121 // This draws 4 blurred shadows around a single square (centered at x, y). | 120 // This draws 4 blurred shadows around a single square (centered at x, y). |
| 122 // Each blur is offset +/- half the square's side in x & y from the original | 121 // Each blur is offset +/- half the square's side in x & y from the original |
| 123 // (so each blurred rect is centered at one of the corners of the original). | 122 // (so each blurred rect is centered at one of the corners of the original). |
| 124 // For each blur a large outer clip is centered around the blurred rect | 123 // For each blur a large outer clip is centered around the blurred rect |
| 125 // while a difference clip stays at the location of the original rect. | 124 // while a difference clip stays at the location of the original rect. |
| 126 // Each blurred rect is drawn with a draw looper where the original (non- | 125 // Each blurred rect is drawn with a draw looper where the original (non- |
| 127 // blurred rect) is offset to reside outside of the large outer clip (so | 126 // blurred rect) is offset to reside outside of the large outer clip (so |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 { -kHalfSquareSize, -kHalfSquareSize } | 239 { -kHalfSquareSize, -kHalfSquareSize } |
| 241 }; | 240 }; |
| 242 | 241 |
| 243 const SkColor MegaLooperGM::gColors[4] = { | 242 const SkColor MegaLooperGM::gColors[4] = { |
| 244 SK_ColorGREEN, SK_ColorYELLOW, SK_ColorBLUE, SK_ColorRED | 243 SK_ColorGREEN, SK_ColorYELLOW, SK_ColorBLUE, SK_ColorRED |
| 245 }; | 244 }; |
| 246 | 245 |
| 247 DEF_GM( return new MegaLooperGM(MegaLooperGM::k0x0_Type); ) | 246 DEF_GM( return new MegaLooperGM(MegaLooperGM::k0x0_Type); ) |
| 248 DEF_GM( return new MegaLooperGM(MegaLooperGM::k4x1_Type); ) | 247 DEF_GM( return new MegaLooperGM(MegaLooperGM::k4x1_Type); ) |
| 249 DEF_GM( return new MegaLooperGM(MegaLooperGM::k1x4_Type); ) | 248 DEF_GM( return new MegaLooperGM(MegaLooperGM::k1x4_Type); ) |
| OLD | NEW |