Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: src/effects/SkDropShadowImageFilter.cpp

Issue 2114313002: Handle negative scale in SkDropShadowImageFilter::onFilterNodeBounds. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: I can has unit test. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/ImageFilterTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698