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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 SkScalar xformedSigma = this->computeXformedSigma(ctm); | 857 SkScalar xformedSigma = this->computeXformedSigma(ctm); |
858 | 858 |
859 int pad=SkScalarCeilToInt(6*xformedSigma)/2; | 859 int pad=SkScalarCeilToInt(6*xformedSigma)/2; |
860 rect.outset(SkIntToScalar(pad), SkIntToScalar(pad)); | 860 rect.outset(SkIntToScalar(pad), SkIntToScalar(pad)); |
861 | 861 |
862 SkAutoTUnref<GrFragmentProcessor> fp(GrRectBlurEffect::Create(context, rect,
xformedSigma)); | 862 SkAutoTUnref<GrFragmentProcessor> fp(GrRectBlurEffect::Create(context, rect,
xformedSigma)); |
863 if (!fp) { | 863 if (!fp) { |
864 return false; | 864 return false; |
865 } | 865 } |
866 | 866 |
867 if (!grp->localCoordChangeInverse(viewMatrix)) { | |
868 return false; | |
869 } | |
870 | |
871 grp->addCoverageProcessor(fp); | 867 grp->addCoverageProcessor(fp); |
872 | 868 |
873 context->drawRect(*grp, SkMatrix::I(), rect); | 869 SkMatrix inverse; |
| 870 if (!viewMatrix.invert(&inverse)) { |
| 871 return false; |
| 872 } |
| 873 context->drawNonAARectWithLocalMatrix(*grp, SkMatrix::I(), rect, inverse); |
874 return true; | 874 return true; |
875 } | 875 } |
876 | 876 |
877 class GrRRectBlurEffect : public GrFragmentProcessor { | 877 class GrRRectBlurEffect : public GrFragmentProcessor { |
878 public: | 878 public: |
879 | 879 |
880 static GrFragmentProcessor* Create(GrContext* context, float sigma, const Sk
RRect&); | 880 static GrFragmentProcessor* Create(GrContext* context, float sigma, const Sk
RRect&); |
881 | 881 |
882 virtual ~GrRRectBlurEffect() {}; | 882 virtual ~GrRRectBlurEffect() {}; |
883 virtual const char* name() const SK_OVERRIDE { return "GrRRectBlur"; } | 883 virtual const char* name() const SK_OVERRIDE { return "GrRRectBlur"; } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 SkMatrix ctm = viewMatrix; | 1139 SkMatrix ctm = viewMatrix; |
1140 SkScalar xformedSigma = this->computeXformedSigma(ctm); | 1140 SkScalar xformedSigma = this->computeXformedSigma(ctm); |
1141 float extra=3.f*SkScalarCeilToScalar(xformedSigma-1/6.0f); | 1141 float extra=3.f*SkScalarCeilToScalar(xformedSigma-1/6.0f); |
1142 proxy_rect.outset(extra, extra); | 1142 proxy_rect.outset(extra, extra); |
1143 | 1143 |
1144 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectBlurEffect::Create(context, xfor
medSigma, rrect)); | 1144 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectBlurEffect::Create(context, xfor
medSigma, rrect)); |
1145 if (!fp) { | 1145 if (!fp) { |
1146 return false; | 1146 return false; |
1147 } | 1147 } |
1148 | 1148 |
1149 if (!grp->localCoordChangeInverse(viewMatrix)) { | |
1150 return false; | |
1151 } | |
1152 | |
1153 grp->addCoverageProcessor(fp); | 1149 grp->addCoverageProcessor(fp); |
1154 | 1150 |
1155 context->drawRect(*grp, SkMatrix::I(), proxy_rect); | 1151 SkMatrix inverse; |
| 1152 if (!viewMatrix.invert(&inverse)) { |
| 1153 return false; |
| 1154 } |
| 1155 context->drawNonAARectWithLocalMatrix(*grp, SkMatrix::I(), proxy_rect, inver
se); |
1156 return true; | 1156 return true; |
1157 } | 1157 } |
1158 | 1158 |
1159 bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRect& srcBounds, | 1159 bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRect& srcBounds, |
1160 const SkIRect& clipBounds, | 1160 const SkIRect& clipBounds, |
1161 const SkMatrix& ctm, | 1161 const SkMatrix& ctm, |
1162 SkRect* maskRect) const { | 1162 SkRect* maskRect) const { |
1163 SkScalar xformedSigma = this->computeXformedSigma(ctm); | 1163 SkScalar xformedSigma = this->computeXformedSigma(ctm); |
1164 if (xformedSigma <= 0) { | 1164 if (xformedSigma <= 0) { |
1165 return false; | 1165 return false; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 } else { | 1269 } else { |
1270 str->append("None"); | 1270 str->append("None"); |
1271 } | 1271 } |
1272 str->append("))"); | 1272 str->append("))"); |
1273 } | 1273 } |
1274 #endif | 1274 #endif |
1275 | 1275 |
1276 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1276 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1277 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1277 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1278 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1278 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |