Chromium Code Reviews| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 MapDirection direction) cons t { | 132 MapDirection direction) cons t { |
| 133 SkVector offsetVec = SkVector::Make(fDx, fDy); | 133 SkVector offsetVec = SkVector::Make(fDx, fDy); |
| 134 if (kReverse_MapDirection == direction) { | 134 if (kReverse_MapDirection == direction) { |
| 135 offsetVec.negate(); | 135 offsetVec.negate(); |
| 136 } | 136 } |
| 137 ctm.mapVectors(&offsetVec, 1); | 137 ctm.mapVectors(&offsetVec, 1); |
| 138 SkIRect dst = src.makeOffset(SkScalarCeilToInt(offsetVec.x()), | 138 SkIRect dst = src.makeOffset(SkScalarCeilToInt(offsetVec.x()), |
| 139 SkScalarCeilToInt(offsetVec.y())); | 139 SkScalarCeilToInt(offsetVec.y())); |
| 140 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY); | 140 SkVector sigma = SkVector::Make(fSigmaX, fSigmaY); |
| 141 ctm.mapVectors(&sigma, 1); | 141 ctm.mapVectors(&sigma, 1); |
| 142 dst.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))), | 142 dst.outset( |
| 143 SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3)))); | 143 SkScalarCeilToInt(SkScalarAbs(SkScalarMul(sigma.x(), SkIntToScalar(3)))) , |
|
Stephen White
2016/07/12 16:25:23
There's probably a similar bug in SkDSIF::computeF
| |
| 144 SkScalarCeilToInt(SkScalarAbs(SkScalarMul(sigma.y(), SkIntToScalar(3)))) ); | |
| 144 if (fShadowMode == kDrawShadowAndForeground_ShadowMode) { | 145 if (fShadowMode == kDrawShadowAndForeground_ShadowMode) { |
| 145 dst.join(src); | 146 dst.join(src); |
| 146 } | 147 } |
| 147 return dst; | 148 return dst; |
| 148 } | 149 } |
| 149 | 150 |
| 150 #ifndef SK_IGNORE_TO_STRING | 151 #ifndef SK_IGNORE_TO_STRING |
| 151 void SkDropShadowImageFilter::toString(SkString* str) const { | 152 void SkDropShadowImageFilter::toString(SkString* str) const { |
| 152 str->appendf("SkDropShadowImageFilter: ("); | 153 str->appendf("SkDropShadowImageFilter: ("); |
| 153 | 154 |
| 154 str->appendf("dX: %f ", fDx); | 155 str->appendf("dX: %f ", fDx); |
| 155 str->appendf("dY: %f ", fDy); | 156 str->appendf("dY: %f ", fDy); |
| 156 str->appendf("sigmaX: %f ", fSigmaX); | 157 str->appendf("sigmaX: %f ", fSigmaX); |
| 157 str->appendf("sigmaY: %f ", fSigmaY); | 158 str->appendf("sigmaY: %f ", fSigmaY); |
| 158 | 159 |
| 159 str->append("Color: "); | 160 str->append("Color: "); |
| 160 str->appendHex(fColor); | 161 str->appendHex(fColor); |
| 161 | 162 |
| 162 static const char* gModeStrings[] = { | 163 static const char* gModeStrings[] = { |
| 163 "kDrawShadowAndForeground", "kDrawShadowOnly" | 164 "kDrawShadowAndForeground", "kDrawShadowOnly" |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 static_assert(kShadowModeCount == SK_ARRAY_COUNT(gModeStrings), "enum_mismat ch"); | 167 static_assert(kShadowModeCount == SK_ARRAY_COUNT(gModeStrings), "enum_mismat ch"); |
| 167 | 168 |
| 168 str->appendf(" mode: %s", gModeStrings[fShadowMode]); | 169 str->appendf(" mode: %s", gModeStrings[fShadowMode]); |
| 169 | 170 |
| 170 str->append(")"); | 171 str->append(")"); |
| 171 } | 172 } |
| 172 #endif | 173 #endif |
| OLD | NEW |