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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 | 852 |
853 int pad = SkScalarCeilToInt(6*xformedSigma)/2; | 853 int pad = SkScalarCeilToInt(6*xformedSigma)/2; |
854 rect.outset(SkIntToScalar(pad), SkIntToScalar(pad)); | 854 rect.outset(SkIntToScalar(pad), SkIntToScalar(pad)); |
855 | 855 |
856 SkAutoTUnref<GrFragmentProcessor> fp(GrRectBlurEffect::Create( | 856 SkAutoTUnref<GrFragmentProcessor> fp(GrRectBlurEffect::Create( |
857 texProvider, rec
t, xformedSigma)); | 857 texProvider, rec
t, xformedSigma)); |
858 if (!fp) { | 858 if (!fp) { |
859 return false; | 859 return false; |
860 } | 860 } |
861 | 861 |
862 grp->addCoverageProcessor(fp); | 862 grp->addCoverageFragmentProcessor(fp); |
863 | 863 |
864 SkMatrix inverse; | 864 SkMatrix inverse; |
865 if (!viewMatrix.invert(&inverse)) { | 865 if (!viewMatrix.invert(&inverse)) { |
866 return false; | 866 return false; |
867 } | 867 } |
868 | 868 |
869 drawContext->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), rec
t, inverse); | 869 drawContext->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), rec
t, inverse); |
870 return true; | 870 return true; |
871 } | 871 } |
872 | 872 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 | 1128 |
1129 SkRect proxyRect = rrect.rect(); | 1129 SkRect proxyRect = rrect.rect(); |
1130 proxyRect.outset(extra, extra); | 1130 proxyRect.outset(extra, extra); |
1131 | 1131 |
1132 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectBlurEffect::Create(texProvider, | 1132 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectBlurEffect::Create(texProvider, |
1133 xformedSigma,
rrect)); | 1133 xformedSigma,
rrect)); |
1134 if (!fp) { | 1134 if (!fp) { |
1135 return false; | 1135 return false; |
1136 } | 1136 } |
1137 | 1137 |
1138 grp->addCoverageProcessor(fp); | 1138 grp->addCoverageFragmentProcessor(fp); |
1139 | 1139 |
1140 SkMatrix inverse; | 1140 SkMatrix inverse; |
1141 if (!viewMatrix.invert(&inverse)) { | 1141 if (!viewMatrix.invert(&inverse)) { |
1142 return false; | 1142 return false; |
1143 } | 1143 } |
1144 | 1144 |
1145 drawContext->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), pro
xyRect, inverse); | 1145 drawContext->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), pro
xyRect, inverse); |
1146 return true; | 1146 return true; |
1147 } | 1147 } |
1148 | 1148 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 clipRect, false, xformedSigma, xforme
dSigma); | 1204 clipRect, false, xformedSigma, xforme
dSigma); |
1205 if (NULL == *result) { | 1205 if (NULL == *result) { |
1206 return false; | 1206 return false; |
1207 } | 1207 } |
1208 | 1208 |
1209 if (!isNormalBlur) { | 1209 if (!isNormalBlur) { |
1210 GrPaint paint; | 1210 GrPaint paint; |
1211 SkMatrix matrix; | 1211 SkMatrix matrix; |
1212 matrix.setIDiv(src->width(), src->height()); | 1212 matrix.setIDiv(src->width(), src->height()); |
1213 // Blend pathTexture over blurTexture. | 1213 // Blend pathTexture over blurTexture. |
1214 paint.addCoverageProcessor(GrSimpleTextureEffect::Create(paint.getProces
sorDataManager(), | 1214 paint.addCoverageFragmentProcessor( |
1215 src, matrix))->
unref(); | 1215 GrSimpleTextureEffect::Create(paint.getProcessorDataManager(), src,
matrix))->unref(); |
1216 if (kInner_SkBlurStyle == fBlurStyle) { | 1216 if (kInner_SkBlurStyle == fBlurStyle) { |
1217 // inner: dst = dst * src | 1217 // inner: dst = dst * src |
1218 paint.setCoverageSetOpXPFactory(SkRegion::kIntersect_Op); | 1218 paint.setCoverageSetOpXPFactory(SkRegion::kIntersect_Op); |
1219 } else if (kSolid_SkBlurStyle == fBlurStyle) { | 1219 } else if (kSolid_SkBlurStyle == fBlurStyle) { |
1220 // solid: dst = src + dst - src * dst | 1220 // solid: dst = src + dst - src * dst |
1221 // = src + (1 - src) * dst | 1221 // = src + (1 - src) * dst |
1222 paint.setCoverageSetOpXPFactory(SkRegion::kUnion_Op); | 1222 paint.setCoverageSetOpXPFactory(SkRegion::kUnion_Op); |
1223 } else if (kOuter_SkBlurStyle == fBlurStyle) { | 1223 } else if (kOuter_SkBlurStyle == fBlurStyle) { |
1224 // outer: dst = dst * (1 - src) | 1224 // outer: dst = dst * (1 - src) |
1225 // = 0 * src + (1 - src) * dst | 1225 // = 0 * src + (1 - src) * dst |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 } else { | 1266 } else { |
1267 str->append("None"); | 1267 str->append("None"); |
1268 } | 1268 } |
1269 str->append("))"); | 1269 str->append("))"); |
1270 } | 1270 } |
1271 #endif | 1271 #endif |
1272 | 1272 |
1273 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1273 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1274 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1274 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1275 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1275 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |