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

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

Issue 2154753003: Introduce GrColorSpaceXform, for gamut conversion on textures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months 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
OLDNEW
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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 } 806 }
807 } 807 }
808 808
809 return blurProfile; 809 return blurProfile;
810 } 810 }
811 811
812 GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *b lurProfile, 812 GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *b lurProfile,
813 GrSLPrecision precision) 813 GrSLPrecision precision)
814 : fRect(rect) 814 : fRect(rect)
815 , fSigma(sigma) 815 , fSigma(sigma)
816 , fBlurProfileAccess(blurProfile) 816 , fBlurProfileAccess(blurProfile, nullptr)
817 , fPrecision(precision) { 817 , fPrecision(precision) {
818 this->initClassID<GrRectBlurEffect>(); 818 this->initClassID<GrRectBlurEffect>();
819 this->addTextureAccess(&fBlurProfileAccess); 819 this->addTextureAccess(&fBlurProfileAccess);
820 this->setWillReadFragmentPosition(); 820 this->setWillReadFragmentPosition();
821 } 821 }
822 822
823 void GrRectBlurEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, 823 void GrRectBlurEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps,
824 GrProcessorKeyBuilder* b) const { 824 GrProcessorKeyBuilder* b) const {
825 GrGLRectBlurEffect::GenKey(*this, caps, b); 825 GrGLRectBlurEffect::GenKey(*this, caps, b);
826 } 826 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 return sk_sp<GrFragmentProcessor>(new GrRRectBlurEffect(sigma, rrect, blurNi nePatchTexture)); 1016 return sk_sp<GrFragmentProcessor>(new GrRRectBlurEffect(sigma, rrect, blurNi nePatchTexture));
1017 } 1017 }
1018 1018
1019 void GrRRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { 1019 void GrRRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
1020 inout->mulByUnknownSingleComponent(); 1020 inout->mulByUnknownSingleComponent();
1021 } 1021 }
1022 1022
1023 GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTextur e *ninePatchTexture) 1023 GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTextur e *ninePatchTexture)
1024 : fRRect(rrect), 1024 : fRRect(rrect),
1025 fSigma(sigma), 1025 fSigma(sigma),
1026 fNinePatchAccess(ninePatchTexture) { 1026 fNinePatchAccess(ninePatchTexture, nullptr) {
1027 this->initClassID<GrRRectBlurEffect>(); 1027 this->initClassID<GrRRectBlurEffect>();
1028 this->addTextureAccess(&fNinePatchAccess); 1028 this->addTextureAccess(&fNinePatchAccess);
1029 this->setWillReadFragmentPosition(); 1029 this->setWillReadFragmentPosition();
1030 } 1030 }
1031 1031
1032 bool GrRRectBlurEffect::onIsEqual(const GrFragmentProcessor& other) const { 1032 bool GrRRectBlurEffect::onIsEqual(const GrFragmentProcessor& other) const {
1033 const GrRRectBlurEffect& rrbe = other.cast<GrRRectBlurEffect>(); 1033 const GrRRectBlurEffect& rrbe = other.cast<GrRRectBlurEffect>();
1034 return fRRect.getSimpleRadii().fX == rrbe.fRRect.getSimpleRadii().fX && 1034 return fRRect.getSimpleRadii().fX == rrbe.fRRect.getSimpleRadii().fX &&
1035 fSigma == rrbe.fSigma && 1035 fSigma == rrbe.fSigma &&
1036 fRRect.rect() == rrbe.fRRect.rect(); 1036 fRRect.rect() == rrbe.fRRect.rect();
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 xformedSigma, xformedSigma)); 1253 xformedSigma, xformedSigma));
1254 if (!drawContext) { 1254 if (!drawContext) {
1255 return false; 1255 return false;
1256 } 1256 }
1257 1257
1258 if (!isNormalBlur) { 1258 if (!isNormalBlur) {
1259 GrPaint paint; 1259 GrPaint paint;
1260 SkMatrix matrix; 1260 SkMatrix matrix;
1261 matrix.setIDiv(src->width(), src->height()); 1261 matrix.setIDiv(src->width(), src->height());
1262 // Blend pathTexture over blurTexture. 1262 // Blend pathTexture over blurTexture.
1263 paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(src, matr ix)); 1263 paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(src, null ptr, matrix));
1264 if (kInner_SkBlurStyle == fBlurStyle) { 1264 if (kInner_SkBlurStyle == fBlurStyle) {
1265 // inner: dst = dst * src 1265 // inner: dst = dst * src
1266 paint.setCoverageSetOpXPFactory(SkRegion::kIntersect_Op); 1266 paint.setCoverageSetOpXPFactory(SkRegion::kIntersect_Op);
1267 } else if (kSolid_SkBlurStyle == fBlurStyle) { 1267 } else if (kSolid_SkBlurStyle == fBlurStyle) {
1268 // solid: dst = src + dst - src * dst 1268 // solid: dst = src + dst - src * dst
1269 // = src + (1 - src) * dst 1269 // = src + (1 - src) * dst
1270 paint.setCoverageSetOpXPFactory(SkRegion::kUnion_Op); 1270 paint.setCoverageSetOpXPFactory(SkRegion::kUnion_Op);
1271 } else if (kOuter_SkBlurStyle == fBlurStyle) { 1271 } else if (kOuter_SkBlurStyle == fBlurStyle) {
1272 // outer: dst = dst * (1 - src) 1272 // outer: dst = dst * (1 - src)
1273 // = 0 * src + (1 - src) * dst 1273 // = 0 * src + (1 - src) * dst
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 } else { 1311 } else {
1312 str->append("None"); 1312 str->append("None");
1313 } 1313 }
1314 str->append("))"); 1314 str->append("))");
1315 } 1315 }
1316 #endif 1316 #endif
1317 1317
1318 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 1318 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
1319 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 1319 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
1320 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1320 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698