| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 "SkBlurMaskFilter.h" | 8 #include "SkBlurMaskFilter.h" |
| 9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkGpuBlurUtils.h" | 10 #include "SkGpuBlurUtils.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 if ((unsigned)style > (unsigned)kLastEnum_SkBlurStyle) { | 133 if ((unsigned)style > (unsigned)kLastEnum_SkBlurStyle) { |
| 134 return nullptr; | 134 return nullptr; |
| 135 } | 135 } |
| 136 SkASSERT(flags <= SkBlurMaskFilter::kAll_BlurFlag); | 136 SkASSERT(flags <= SkBlurMaskFilter::kAll_BlurFlag); |
| 137 flags &= SkBlurMaskFilter::kAll_BlurFlag; | 137 flags &= SkBlurMaskFilter::kAll_BlurFlag; |
| 138 | 138 |
| 139 return sk_sp<SkMaskFilter>(new SkBlurMaskFilterImpl(sigma, style, occluder,
flags)); | 139 return sk_sp<SkMaskFilter>(new SkBlurMaskFilterImpl(sigma, style, occluder,
flags)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 bool SkBlurMaskFilter::ComputeBlurredRRectParams(const SkRRect& rrect, | 142 // linearly interpolate between y1 & y3 to match x2's position between x1 & x3 |
| 143 SkScalar sigma, | 143 static SkScalar interp(SkScalar x1, SkScalar x2, SkScalar x3, SkScalar y1, SkSca
lar y3) { |
| 144 SkASSERT(x1 <= x2 && x2 <= x3); |
| 145 SkASSERT(y1 <= y3); |
| 146 |
| 147 SkScalar t = (x2 - x1) / (x3 - x1); |
| 148 return y1 + t * (y3 - y1); |
| 149 } |
| 150 |
| 151 // Insert 'lower' and 'higher' into 'array1' and insert a new value at each matc
hing insertion |
| 152 // point in 'array2' that linearly interpolates between the existing values. |
| 153 // Return a bit mask which contains a copy of 'inputMask' for all the cells betw
een the two |
| 154 // insertion points. |
| 155 static uint32_t insert_into_arrays(SkScalar* array1, SkScalar* array2, |
| 156 SkScalar lower, SkScalar higher, |
| 157 int* num, uint32_t inputMask, int maskSize) { |
| 158 SkASSERT(lower < higher); |
| 159 SkASSERT(lower >= array1[0] && higher <= array1[*num-1]); |
| 160 |
| 161 int32_t skipMask = 0x0; |
| 162 int i; |
| 163 for (i = 0; i < *num; ++i) { |
| 164 if (lower >= array1[i] && lower < array1[i+1]) { |
| 165 if (!SkScalarNearlyEqual(lower, array1[i])) { |
| 166 memmove(&array1[i+2], &array1[i+1], (*num-i-1)*sizeof(SkScalar))
; |
| 167 array1[i+1] = lower; |
| 168 memmove(&array2[i+2], &array2[i+1], (*num-i-1)*sizeof(SkScalar))
; |
| 169 array2[i+1] = interp(array1[i], lower, array1[i+2], array2[i], a
rray2[i+2]); |
| 170 i++; |
| 171 (*num)++; |
| 172 } |
| 173 break; |
| 174 } |
| 175 } |
| 176 for ( ; i < *num; ++i) { |
| 177 skipMask |= inputMask << (i*maskSize); |
| 178 if (higher > array1[i] && higher <= array1[i+1]) { |
| 179 if (!SkScalarNearlyEqual(higher, array1[i+1])) { |
| 180 memmove(&array1[i+2], &array1[i+1], (*num-i-1)*sizeof(SkScalar))
; |
| 181 array1[i+1] = higher; |
| 182 memmove(&array2[i+2], &array2[i+1], (*num-i-1)*sizeof(SkScalar))
; |
| 183 array2[i+1] = interp(array1[i], higher, array1[i+2], array2[i],
array2[i+2]); |
| 184 (*num)++; |
| 185 } |
| 186 break; |
| 187 } |
| 188 } |
| 189 |
| 190 return skipMask; |
| 191 } |
| 192 |
| 193 bool SkBlurMaskFilter::ComputeBlurredRRectParams(const SkRRect& srcRRect, const
SkRRect& devRRect, |
| 194 const SkRect& occluder, |
| 195 SkScalar sigma, SkScalar xforme
dSigma, |
| 144 SkRRect* rrectToDraw, | 196 SkRRect* rrectToDraw, |
| 145 SkISize* widthHeight, | 197 SkISize* widthHeight, |
| 146 SkScalar xs[4], | 198 SkScalar rectXs[kMaxDivisions], |
| 147 int* numXs, | 199 SkScalar rectYs[kMaxDivisions], |
| 148 SkScalar ys[4], | 200 SkScalar texXs[kMaxDivisions], |
| 149 int* numYs) { | 201 SkScalar texYs[kMaxDivisions], |
| 150 unsigned int blurRadius = 3*SkScalarCeilToInt(sigma-1/6.0f); | 202 int* numXs, int* numYs, uint32_
t* skipMask) { |
| 203 unsigned int devBlurRadius = 3*SkScalarCeilToInt(xformedSigma-1/6.0f); |
| 204 SkScalar srcBlurRadius = 3.0f * sigma; |
| 151 | 205 |
| 152 const SkRect& orig = rrect.getBounds(); | 206 const SkRect& devOrig = devRRect.getBounds(); |
| 153 const SkVector& radiiUL = rrect.radii(SkRRect::kUpperLeft_Corner); | 207 const SkVector& devRadiiUL = devRRect.radii(SkRRect::kUpperLeft_Corner); |
| 154 const SkVector& radiiUR = rrect.radii(SkRRect::kUpperRight_Corner); | 208 const SkVector& devRadiiUR = devRRect.radii(SkRRect::kUpperRight_Corner); |
| 155 const SkVector& radiiLR = rrect.radii(SkRRect::kLowerRight_Corner); | 209 const SkVector& devRadiiLR = devRRect.radii(SkRRect::kLowerRight_Corner); |
| 156 const SkVector& radiiLL = rrect.radii(SkRRect::kLowerLeft_Corner); | 210 const SkVector& devRadiiLL = devRRect.radii(SkRRect::kLowerLeft_Corner); |
| 157 | 211 |
| 158 const int left = SkScalarCeilToInt(SkTMax<SkScalar>(radiiUL.fX, radiiLL.fX)
); | 212 const int devLeft = SkScalarCeilToInt(SkTMax<SkScalar>(devRadiiUL.fX, devRa
diiLL.fX)); |
| 159 const int top = SkScalarCeilToInt(SkTMax<SkScalar>(radiiUL.fY, radiiUR.fY)
); | 213 const int devTop = SkScalarCeilToInt(SkTMax<SkScalar>(devRadiiUL.fY, devRa
diiUR.fY)); |
| 160 const int right = SkScalarCeilToInt(SkTMax<SkScalar>(radiiUR.fX, radiiLR.fX)
); | 214 const int devRight = SkScalarCeilToInt(SkTMax<SkScalar>(devRadiiUR.fX, devRa
diiLR.fX)); |
| 161 const int bot = SkScalarCeilToInt(SkTMax<SkScalar>(radiiLL.fY, radiiLR.fY)
); | 215 const int devBot = SkScalarCeilToInt(SkTMax<SkScalar>(devRadiiLL.fY, devRa
diiLR.fY)); |
| 162 | 216 |
| 163 // This is a conservative check for nine-patchability | 217 // This is a conservative check for nine-patchability |
| 164 if (orig.fLeft + left + blurRadius >= orig.fRight - right - blurRadius || | 218 if (devOrig.fLeft + devLeft + devBlurRadius >= devOrig.fRight - devRight -
devBlurRadius || |
| 165 orig.fTop + top + blurRadius >= orig.fBottom - bot - blurRadius) { | 219 devOrig.fTop + devTop + devBlurRadius >= devOrig.fBottom - devBot -
devBlurRadius) { |
| 166 return false; | 220 return false; |
| 167 } | 221 } |
| 168 | 222 |
| 169 int newRRWidth, newRRHeight; | 223 const SkVector& srcRadiiUL = srcRRect.radii(SkRRect::kUpperLeft_Corner); |
| 224 const SkVector& srcRadiiUR = srcRRect.radii(SkRRect::kUpperRight_Corner); |
| 225 const SkVector& srcRadiiLR = srcRRect.radii(SkRRect::kLowerRight_Corner); |
| 226 const SkVector& srcRadiiLL = srcRRect.radii(SkRRect::kLowerLeft_Corner); |
| 170 | 227 |
| 171 // 3x3 case | 228 const SkScalar srcLeft = SkTMax<SkScalar>(srcRadiiUL.fX, srcRadiiLL.fX); |
| 172 newRRWidth = 2*blurRadius + left + right + 1; | 229 const SkScalar srcTop = SkTMax<SkScalar>(srcRadiiUL.fY, srcRadiiUR.fY); |
| 173 newRRHeight = 2*blurRadius + top + bot + 1; | 230 const SkScalar srcRight = SkTMax<SkScalar>(srcRadiiUR.fX, srcRadiiLR.fX); |
| 174 widthHeight->fWidth = newRRWidth + 2 * blurRadius; | 231 const SkScalar srcBot = SkTMax<SkScalar>(srcRadiiLL.fY, srcRadiiLR.fY); |
| 175 widthHeight->fHeight = newRRHeight + 2 * blurRadius; | 232 |
| 176 // TODO: need to return non-normalized indices | 233 int newRRWidth = 2*devBlurRadius + devLeft + devRight + 1; |
| 177 xs[0] = 0.0f; | 234 int newRRHeight = 2*devBlurRadius + devTop + devBot + 1; |
| 178 xs[1] = (blurRadius + left) / (float) widthHeight->fWidth; | 235 widthHeight->fWidth = newRRWidth + 2 * devBlurRadius; |
| 179 xs[2] = (blurRadius + left + 1.0f) / widthHeight->fWidth; | 236 widthHeight->fHeight = newRRHeight + 2 * devBlurRadius; |
| 180 xs[3] = 1.0f; | 237 |
| 238 const SkRect srcProxyRect = srcRRect.getBounds().makeOutset(srcBlurRadius, s
rcBlurRadius); |
| 239 |
| 240 rectXs[0] = srcProxyRect.fLeft; |
| 241 rectXs[1] = srcProxyRect.fLeft + 2*srcBlurRadius + srcLeft; |
| 242 rectXs[2] = srcProxyRect.fRight - 2*srcBlurRadius - srcRight; |
| 243 rectXs[3] = srcProxyRect.fRight; |
| 244 |
| 245 rectYs[0] = srcProxyRect.fTop; |
| 246 rectYs[1] = srcProxyRect.fTop + 2*srcBlurRadius + srcTop; |
| 247 rectYs[2] = srcProxyRect.fBottom - 2*srcBlurRadius - srcBot; |
| 248 rectYs[3] = srcProxyRect.fBottom; |
| 249 |
| 250 texXs[0] = 0.0f; |
| 251 texXs[1] = 2.0f*devBlurRadius + devLeft; |
| 252 texXs[2] = 2.0f*devBlurRadius + devLeft + 1; |
| 253 texXs[3] = SkIntToScalar(widthHeight->fWidth); |
| 254 |
| 255 texYs[0] = 0.0f; |
| 256 texYs[1] = 2.0f*devBlurRadius + devTop; |
| 257 texYs[2] = 2.0f*devBlurRadius + devTop + 1; |
| 258 texYs[3] = SkIntToScalar(widthHeight->fHeight); |
| 259 |
| 260 SkRect temp = occluder; |
| 261 |
| 181 *numXs = 4; | 262 *numXs = 4; |
| 182 ys[0] = 0.0f; | |
| 183 ys[1] = (blurRadius + top) / (float) widthHeight->fHeight; | |
| 184 ys[2] = (blurRadius + top + 1.0f) / widthHeight->fHeight; | |
| 185 ys[3] = 1.0f; | |
| 186 *numYs = 4; | 263 *numYs = 4; |
| 264 *skipMask = 0; |
| 265 if (!temp.isEmpty() && (srcProxyRect.contains(temp) || temp.intersect(srcPro
xyRect))) { |
| 266 *skipMask = insert_into_arrays(rectXs, texXs, temp.fLeft, temp.fRight, n
umXs, 0x1, 1); |
| 267 *skipMask = insert_into_arrays(rectYs, texYs, temp.fTop, temp.fBottom, |
| 268 numYs, *skipMask, *numXs-1); |
| 269 } |
| 187 | 270 |
| 188 const SkRect newRect = SkRect::MakeXYWH(SkIntToScalar(blurRadius), SkIntToSc
alar(blurRadius), | 271 const SkRect newRect = SkRect::MakeXYWH(SkIntToScalar(devBlurRadius), |
| 189 SkIntToScalar(newRRWidth), SkIntToSc
alar(newRRHeight)); | 272 SkIntToScalar(devBlurRadius), |
| 273 SkIntToScalar(newRRWidth), |
| 274 SkIntToScalar(newRRHeight)); |
| 190 SkVector newRadii[4]; | 275 SkVector newRadii[4]; |
| 191 newRadii[0] = { SkScalarCeilToScalar(radiiUL.fX), SkScalarCeilToScalar(radii
UL.fY) }; | 276 newRadii[0] = { SkScalarCeilToScalar(devRadiiUL.fX), SkScalarCeilToScalar(de
vRadiiUL.fY) }; |
| 192 newRadii[1] = { SkScalarCeilToScalar(radiiUR.fX), SkScalarCeilToScalar(radii
UR.fY) }; | 277 newRadii[1] = { SkScalarCeilToScalar(devRadiiUR.fX), SkScalarCeilToScalar(de
vRadiiUR.fY) }; |
| 193 newRadii[2] = { SkScalarCeilToScalar(radiiLR.fX), SkScalarCeilToScalar(radii
LR.fY) }; | 278 newRadii[2] = { SkScalarCeilToScalar(devRadiiLR.fX), SkScalarCeilToScalar(de
vRadiiLR.fY) }; |
| 194 newRadii[3] = { SkScalarCeilToScalar(radiiLL.fX), SkScalarCeilToScalar(radii
LL.fY) }; | 279 newRadii[3] = { SkScalarCeilToScalar(devRadiiLL.fX), SkScalarCeilToScalar(de
vRadiiLL.fY) }; |
| 195 | 280 |
| 196 rrectToDraw->setRectRadii(newRect, newRadii); | 281 rrectToDraw->setRectRadii(newRect, newRadii); |
| 197 return true; | 282 return true; |
| 198 } | 283 } |
| 199 | 284 |
| 200 /////////////////////////////////////////////////////////////////////////////// | 285 /////////////////////////////////////////////////////////////////////////////// |
| 201 | 286 |
| 202 SkBlurMaskFilterImpl::SkBlurMaskFilterImpl(SkScalar sigma, SkBlurStyle style, | 287 SkBlurMaskFilterImpl::SkBlurMaskFilterImpl(SkScalar sigma, SkBlurStyle style, |
| 203 const SkRect& occluder, uint32_t flag
s) | 288 const SkRect& occluder, uint32_t flag
s) |
| 204 : fSigma(sigma) | 289 : fSigma(sigma) |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 | 1061 |
| 977 drawContext->fillRectWithLocalMatrix(clip, *grp, SkMatrix::I(), rect, invers
e); | 1062 drawContext->fillRectWithLocalMatrix(clip, *grp, SkMatrix::I(), rect, invers
e); |
| 978 return true; | 1063 return true; |
| 979 } | 1064 } |
| 980 | 1065 |
| 981 ////////////////////////////////////////////////////////////////////////////// | 1066 ////////////////////////////////////////////////////////////////////////////// |
| 982 | 1067 |
| 983 class GrRRectBlurEffect : public GrFragmentProcessor { | 1068 class GrRRectBlurEffect : public GrFragmentProcessor { |
| 984 public: | 1069 public: |
| 985 | 1070 |
| 986 static sk_sp<GrFragmentProcessor> Make(GrContext*, float sigma, const SkRRec
t&); | 1071 static sk_sp<GrFragmentProcessor> Make(GrContext*, |
| 1072 float sigma, float xformedSigma, |
| 1073 const SkRRect& srcRRect, const SkRRec
t& devRRect); |
| 987 | 1074 |
| 988 virtual ~GrRRectBlurEffect() {}; | 1075 virtual ~GrRRectBlurEffect() {}; |
| 989 const char* name() const override { return "GrRRectBlur"; } | 1076 const char* name() const override { return "GrRRectBlur"; } |
| 990 | 1077 |
| 991 const SkRRect& getRRect() const { return fRRect; } | 1078 const SkRRect& getRRect() const { return fRRect; } |
| 992 float getSigma() const { return fSigma; } | 1079 float getSigma() const { return fSigma; } |
| 993 | 1080 |
| 994 private: | 1081 private: |
| 995 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; | 1082 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
| 996 | 1083 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 | 1149 |
| 1063 mask = dc2->asTexture(); | 1150 mask = dc2->asTexture(); |
| 1064 SkASSERT(mask); | 1151 SkASSERT(mask); |
| 1065 context->textureProvider()->assignUniqueKeyToTexture(key, mask.get()); | 1152 context->textureProvider()->assignUniqueKeyToTexture(key, mask.get()); |
| 1066 } | 1153 } |
| 1067 | 1154 |
| 1068 return mask; | 1155 return mask; |
| 1069 } | 1156 } |
| 1070 | 1157 |
| 1071 sk_sp<GrFragmentProcessor> GrRRectBlurEffect::Make(GrContext* context, | 1158 sk_sp<GrFragmentProcessor> GrRRectBlurEffect::Make(GrContext* context, |
| 1072 float xformedSigma, | 1159 float sigma, float xformedSig
ma, |
| 1073 const SkRRect& devRRect) { | 1160 const SkRRect& srcRRect, cons
t SkRRect& devRRect) { |
| 1074 SkASSERT(!devRRect.isCircle()); // Should've been caught up-stream | 1161 SkASSERT(!devRRect.isCircle()); // Should've been caught up-stream |
| 1075 | 1162 |
| 1076 // TODO: loosen this up | 1163 // TODO: loosen this up |
| 1077 if (!devRRect.isSimpleCircular()) { | 1164 if (!devRRect.isSimpleCircular()) { |
| 1078 return nullptr; | 1165 return nullptr; |
| 1079 } | 1166 } |
| 1080 | 1167 |
| 1081 // Make sure we can successfully ninepatch this rrect -- the blur sigma has
to be | 1168 // Make sure we can successfully ninepatch this rrect -- the blur sigma has
to be |
| 1082 // sufficiently small relative to both the size of the corner radius and the | 1169 // sufficiently small relative to both the size of the corner radius and the |
| 1083 // width (and height) of the rrect. | 1170 // width (and height) of the rrect. |
| 1084 SkRRect rrectToDraw; | 1171 SkRRect rrectToDraw; |
| 1085 SkISize size; | 1172 SkISize size; |
| 1086 SkScalar ignored[4]; | 1173 SkScalar ignored[SkBlurMaskFilter::kMaxDivisions]; |
| 1087 int ignoredSize; | 1174 int ignoredSize; |
| 1175 uint32_t ignored32; |
| 1088 | 1176 |
| 1089 bool ninePatchable = SkBlurMaskFilter::ComputeBlurredRRectParams(devRRect, x
formedSigma, | 1177 bool ninePatchable = SkBlurMaskFilter::ComputeBlurredRRectParams(srcRRect, d
evRRect, |
| 1178 SkRect::Mak
eEmpty(), |
| 1179 sigma, xfor
medSigma, |
| 1090 &rrectToDra
w, &size, | 1180 &rrectToDra
w, &size, |
| 1091 ignored, &i
gnoredSize, | 1181 ignored, ig
nored, |
| 1092 ignored, &i
gnoredSize); | 1182 ignored, ig
nored, |
| 1183 &ignoredSiz
e, &ignoredSize, |
| 1184 &ignored32)
; |
| 1093 if (!ninePatchable) { | 1185 if (!ninePatchable) { |
| 1094 return nullptr; | 1186 return nullptr; |
| 1095 } | 1187 } |
| 1096 | 1188 |
| 1097 sk_sp<GrTexture> mask(find_or_create_rrect_blur_mask(context, rrectToDraw, s
ize, | 1189 sk_sp<GrTexture> mask(find_or_create_rrect_blur_mask(context, rrectToDraw, s
ize, |
| 1098 xformedSigma, true)); | 1190 xformedSigma, true)); |
| 1099 if (!mask) { | 1191 if (!mask) { |
| 1100 return nullptr; | 1192 return nullptr; |
| 1101 } | 1193 } |
| 1102 | 1194 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1129 | 1221 |
| 1130 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRRectBlurEffect); | 1222 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRRectBlurEffect); |
| 1131 | 1223 |
| 1132 sk_sp<GrFragmentProcessor> GrRRectBlurEffect::TestCreate(GrProcessorTestData* d)
{ | 1224 sk_sp<GrFragmentProcessor> GrRRectBlurEffect::TestCreate(GrProcessorTestData* d)
{ |
| 1133 SkScalar w = d->fRandom->nextRangeScalar(100.f, 1000.f); | 1225 SkScalar w = d->fRandom->nextRangeScalar(100.f, 1000.f); |
| 1134 SkScalar h = d->fRandom->nextRangeScalar(100.f, 1000.f); | 1226 SkScalar h = d->fRandom->nextRangeScalar(100.f, 1000.f); |
| 1135 SkScalar r = d->fRandom->nextRangeF(1.f, 9.f); | 1227 SkScalar r = d->fRandom->nextRangeF(1.f, 9.f); |
| 1136 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); | 1228 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); |
| 1137 SkRRect rrect; | 1229 SkRRect rrect; |
| 1138 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); | 1230 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); |
| 1139 return GrRRectBlurEffect::Make(d->fContext, sigma, rrect); | 1231 return GrRRectBlurEffect::Make(d->fContext, sigma, sigma, rrect, rrect); |
| 1140 } | 1232 } |
| 1141 | 1233 |
| 1142 ////////////////////////////////////////////////////////////////////////////// | 1234 ////////////////////////////////////////////////////////////////////////////// |
| 1143 | 1235 |
| 1144 class GrGLRRectBlurEffect : public GrGLSLFragmentProcessor { | 1236 class GrGLRRectBlurEffect : public GrGLSLFragmentProcessor { |
| 1145 public: | 1237 public: |
| 1146 void emitCode(EmitArgs&) override; | 1238 void emitCode(EmitArgs&) override; |
| 1147 | 1239 |
| 1148 protected: | 1240 protected: |
| 1149 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; | 1241 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 newPaint.addCoverageFragmentProcessor(std::move(fp)); | 1364 newPaint.addCoverageFragmentProcessor(std::move(fp)); |
| 1273 newPaint.setAntiAlias(false); | 1365 newPaint.setAntiAlias(false); |
| 1274 | 1366 |
| 1275 SkRect srcProxyRect = srcRRect.rect(); | 1367 SkRect srcProxyRect = srcRRect.rect(); |
| 1276 srcProxyRect.outset(3.0f*fSigma, 3.0f*fSigma); | 1368 srcProxyRect.outset(3.0f*fSigma, 3.0f*fSigma); |
| 1277 | 1369 |
| 1278 drawContext->drawRect(clip, newPaint, viewMatrix, srcProxyRect); | 1370 drawContext->drawRect(clip, newPaint, viewMatrix, srcProxyRect); |
| 1279 return true; | 1371 return true; |
| 1280 } | 1372 } |
| 1281 | 1373 |
| 1282 sk_sp<GrFragmentProcessor> fp(GrRRectBlurEffect::Make(context, xformedSigma,
devRRect)); | 1374 sk_sp<GrFragmentProcessor> fp(GrRRectBlurEffect::Make(context, fSigma, xform
edSigma, |
| 1375 srcRRect, devRRect)); |
| 1283 if (!fp) { | 1376 if (!fp) { |
| 1284 return false; | 1377 return false; |
| 1285 } | 1378 } |
| 1286 | 1379 |
| 1287 GrPaint newPaint(*grp); | 1380 GrPaint newPaint(*grp); |
| 1288 newPaint.addCoverageFragmentProcessor(std::move(fp)); | 1381 newPaint.addCoverageFragmentProcessor(std::move(fp)); |
| 1289 newPaint.setAntiAlias(false); | 1382 newPaint.setAntiAlias(false); |
| 1290 | 1383 |
| 1291 if (!this->ignoreXform()) { | 1384 if (!this->ignoreXform()) { |
| 1292 SkRect srcProxyRect = srcRRect.rect(); | 1385 SkRect srcProxyRect = srcRRect.rect(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 } else { | 1550 } else { |
| 1458 str->append("None"); | 1551 str->append("None"); |
| 1459 } | 1552 } |
| 1460 str->append("))"); | 1553 str->append("))"); |
| 1461 } | 1554 } |
| 1462 #endif | 1555 #endif |
| 1463 | 1556 |
| 1464 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1557 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
| 1465 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1558 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
| 1466 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1559 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |