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

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

Issue 793013003: Remove the low hanging fruit with coord change matrices (Closed) Base URL: https://skia.googlesource.com/skia.git@more-ccm-cleanup
Patch Set: adding tests to ignore Created 6 years 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 | « include/gpu/GrPaint.h ('k') | src/gpu/GrBitmapTextContext.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 /* 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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 SkScalar xformedSigma = this->computeXformedSigma(ctm); 853 SkScalar xformedSigma = this->computeXformedSigma(ctm);
854 854
855 int pad=SkScalarCeilToInt(6*xformedSigma)/2; 855 int pad=SkScalarCeilToInt(6*xformedSigma)/2;
856 rect.outset(SkIntToScalar(pad), SkIntToScalar(pad)); 856 rect.outset(SkIntToScalar(pad), SkIntToScalar(pad));
857 857
858 SkAutoTUnref<GrFragmentProcessor> fp(GrRectBlurEffect::Create(context, rect, xformedSigma)); 858 SkAutoTUnref<GrFragmentProcessor> fp(GrRectBlurEffect::Create(context, rect, xformedSigma));
859 if (!fp) { 859 if (!fp) {
860 return false; 860 return false;
861 } 861 }
862 862
863 if (!grp->localCoordChangeInverse(viewMatrix)) {
864 return false;
865 }
866
867 grp->addCoverageProcessor(fp); 863 grp->addCoverageProcessor(fp);
868 864
869 context->drawRect(*grp, SkMatrix::I(), rect); 865 SkMatrix inverse;
866 if (!viewMatrix.invert(&inverse)) {
867 return false;
868 }
869 context->drawNonAARectWithLocalMatrix(*grp, SkMatrix::I(), rect, inverse);
870 return true; 870 return true;
871 } 871 }
872 872
873 class GrRRectBlurEffect : public GrFragmentProcessor { 873 class GrRRectBlurEffect : public GrFragmentProcessor {
874 public: 874 public:
875 875
876 static GrFragmentProcessor* Create(GrContext* context, float sigma, const Sk RRect&); 876 static GrFragmentProcessor* Create(GrContext* context, float sigma, const Sk RRect&);
877 877
878 virtual ~GrRRectBlurEffect() {}; 878 virtual ~GrRRectBlurEffect() {};
879 virtual const char* name() const SK_OVERRIDE { return "GrRRectBlur"; } 879 virtual const char* name() const SK_OVERRIDE { return "GrRRectBlur"; }
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 SkMatrix ctm = viewMatrix; 1135 SkMatrix ctm = viewMatrix;
1136 SkScalar xformedSigma = this->computeXformedSigma(ctm); 1136 SkScalar xformedSigma = this->computeXformedSigma(ctm);
1137 float extra=3.f*SkScalarCeilToScalar(xformedSigma-1/6.0f); 1137 float extra=3.f*SkScalarCeilToScalar(xformedSigma-1/6.0f);
1138 proxy_rect.outset(extra, extra); 1138 proxy_rect.outset(extra, extra);
1139 1139
1140 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectBlurEffect::Create(context, xfor medSigma, rrect)); 1140 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectBlurEffect::Create(context, xfor medSigma, rrect));
1141 if (!fp) { 1141 if (!fp) {
1142 return false; 1142 return false;
1143 } 1143 }
1144 1144
1145 if (!grp->localCoordChangeInverse(viewMatrix)) {
1146 return false;
1147 }
1148
1149 grp->addCoverageProcessor(fp); 1145 grp->addCoverageProcessor(fp);
1150 1146
1151 context->drawRect(*grp, SkMatrix::I(), proxy_rect); 1147 SkMatrix inverse;
1148 if (!viewMatrix.invert(&inverse)) {
1149 return false;
1150 }
1151 context->drawNonAARectWithLocalMatrix(*grp, SkMatrix::I(), proxy_rect, inver se);
1152 return true; 1152 return true;
1153 } 1153 }
1154 1154
1155 bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRect& srcBounds, 1155 bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRect& srcBounds,
1156 const SkIRect& clipBounds, 1156 const SkIRect& clipBounds,
1157 const SkMatrix& ctm, 1157 const SkMatrix& ctm,
1158 SkRect* maskRect) const { 1158 SkRect* maskRect) const {
1159 SkScalar xformedSigma = this->computeXformedSigma(ctm); 1159 SkScalar xformedSigma = this->computeXformedSigma(ctm);
1160 if (xformedSigma <= 0) { 1160 if (xformedSigma <= 0) {
1161 return false; 1161 return false;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 } else { 1265 } else {
1266 str->append("None"); 1266 str->append("None");
1267 } 1267 }
1268 str->append("))"); 1268 str->append("))");
1269 } 1269 }
1270 #endif 1270 #endif
1271 1271
1272 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 1272 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
1273 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 1273 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
1274 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1274 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « include/gpu/GrPaint.h ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698