| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
| 10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
| (...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 | 1213 |
| 1214 if (!isNormalBlur) { | 1214 if (!isNormalBlur) { |
| 1215 GrPaint paint; | 1215 GrPaint paint; |
| 1216 SkMatrix matrix; | 1216 SkMatrix matrix; |
| 1217 matrix.setIDiv(src->width(), src->height()); | 1217 matrix.setIDiv(src->width(), src->height()); |
| 1218 // Blend pathTexture over blurTexture. | 1218 // Blend pathTexture over blurTexture. |
| 1219 GrContext::AutoRenderTarget art(context, (*result)->asRenderTarget()); | 1219 GrContext::AutoRenderTarget art(context, (*result)->asRenderTarget()); |
| 1220 paint.addColorProcessor(GrSimpleTextureEffect::Create(src, matrix))->unr
ef(); | 1220 paint.addColorProcessor(GrSimpleTextureEffect::Create(src, matrix))->unr
ef(); |
| 1221 if (kInner_SkBlurStyle == fBlurStyle) { | 1221 if (kInner_SkBlurStyle == fBlurStyle) { |
| 1222 // inner: dst = dst * src | 1222 // inner: dst = dst * src |
| 1223 paint.setPorterDuffXPFactory(kDC_GrBlendCoeff, kZero_GrBlendCoeff); | 1223 paint.setPorterDuffXPFactory(SkXfermode::kDC_Coeff, SkXfermode::kZer
o_Coeff); |
| 1224 } else if (kSolid_SkBlurStyle == fBlurStyle) { | 1224 } else if (kSolid_SkBlurStyle == fBlurStyle) { |
| 1225 // solid: dst = src + dst - src * dst | 1225 // solid: dst = src + dst - src * dst |
| 1226 // = (1 - dst) * src + 1 * dst | 1226 // = (1 - dst) * src + 1 * dst |
| 1227 paint.setPorterDuffXPFactory(kIDC_GrBlendCoeff, kOne_GrBlendCoeff); | 1227 paint.setPorterDuffXPFactory(SkXfermode::kIDC_Coeff, SkXfermode::kOn
e_Coeff); |
| 1228 } else if (kOuter_SkBlurStyle == fBlurStyle) { | 1228 } else if (kOuter_SkBlurStyle == fBlurStyle) { |
| 1229 // outer: dst = dst * (1 - src) | 1229 // outer: dst = dst * (1 - src) |
| 1230 // = 0 * src + (1 - src) * dst | 1230 // = 0 * src + (1 - src) * dst |
| 1231 paint.setPorterDuffXPFactory(kZero_GrBlendCoeff, kISC_GrBlendCoeff); | 1231 paint.setPorterDuffXPFactory(SkXfermode::kZero_Coeff, SkXfermode::kI
SC_Coeff); |
| 1232 } | 1232 } |
| 1233 context->drawRect(paint, SkMatrix::I(), clipRect); | 1233 context->drawRect(paint, SkMatrix::I(), clipRect); |
| 1234 } | 1234 } |
| 1235 | 1235 |
| 1236 return true; | 1236 return true; |
| 1237 } | 1237 } |
| 1238 | 1238 |
| 1239 #endif // SK_SUPPORT_GPU | 1239 #endif // SK_SUPPORT_GPU |
| 1240 | 1240 |
| 1241 | 1241 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1264 } else { | 1264 } else { |
| 1265 str->append("None"); | 1265 str->append("None"); |
| 1266 } | 1266 } |
| 1267 str->append("))"); | 1267 str->append("))"); |
| 1268 } | 1268 } |
| 1269 #endif | 1269 #endif |
| 1270 | 1270 |
| 1271 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1271 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
| 1272 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1272 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
| 1273 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1273 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |