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 "SkDropShadowImageFilter.h" | 8 #include "SkDropShadowImageFilter.h" |
9 | 9 |
10 #include "SkBlurImageFilter.h" | 10 #include "SkBlurImageFilter.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 SkCanvas* canvas = surf->getCanvas(); | 77 SkCanvas* canvas = surf->getCanvas(); |
78 SkASSERT(canvas); | 78 SkASSERT(canvas); |
79 | 79 |
80 canvas->clear(0x0); | 80 canvas->clear(0x0); |
81 | 81 |
82 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY); | 82 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY); |
83 ctx.ctm().mapVectors(&sigma, 1); | 83 ctx.ctm().mapVectors(&sigma, 1); |
84 sigma.fX = SkMaxScalar(0, sigma.fX); | 84 sigma.fX = SkMaxScalar(0, sigma.fX); |
85 sigma.fY = SkMaxScalar(0, sigma.fY); | 85 sigma.fY = SkMaxScalar(0, sigma.fY); |
86 | 86 |
87 SkAutoTUnref<SkImageFilter> blurFilter(SkBlurImageFilter::Create(sigma.fX, s
igma.fY)); | |
88 SkPaint paint; | 87 SkPaint paint; |
89 paint.setImageFilter(blurFilter.get()); | 88 paint.setImageFilter(SkBlurImageFilter::Make(sigma.fX, sigma.fY, nullptr)); |
90 paint.setColorFilter(SkColorFilter::MakeModeFilter(fColor, SkXfermode::kSrcI
n_Mode)); | 89 paint.setColorFilter(SkColorFilter::MakeModeFilter(fColor, SkXfermode::kSrcI
n_Mode)); |
91 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); | 90 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); |
92 | 91 |
93 SkVector offsetVec = SkVector::Make(fDx, fDy); | 92 SkVector offsetVec = SkVector::Make(fDx, fDy); |
94 ctx.ctm().mapVectors(&offsetVec, 1); | 93 ctx.ctm().mapVectors(&offsetVec, 1); |
95 | 94 |
96 canvas->translate(SkIntToScalar(inputOffset.fX - bounds.fLeft), | 95 canvas->translate(SkIntToScalar(inputOffset.fX - bounds.fLeft), |
97 SkIntToScalar(inputOffset.fY - bounds.fTop)); | 96 SkIntToScalar(inputOffset.fY - bounds.fTop)); |
98 input->draw(canvas, offsetVec.fX, offsetVec.fY, &paint); | 97 input->draw(canvas, offsetVec.fX, offsetVec.fY, &paint); |
99 | 98 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 "kDrawShadowAndForeground", "kDrawShadowOnly" | 153 "kDrawShadowAndForeground", "kDrawShadowOnly" |
155 }; | 154 }; |
156 | 155 |
157 static_assert(kShadowModeCount == SK_ARRAY_COUNT(gModeStrings), "enum_mismat
ch"); | 156 static_assert(kShadowModeCount == SK_ARRAY_COUNT(gModeStrings), "enum_mismat
ch"); |
158 | 157 |
159 str->appendf(" mode: %s", gModeStrings[fShadowMode]); | 158 str->appendf(" mode: %s", gModeStrings[fShadowMode]); |
160 | 159 |
161 str->append(")"); | 160 str->append(")"); |
162 } | 161 } |
163 #endif | 162 #endif |
OLD | NEW |