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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 return new GrRectBlurEffect(rect, sigma, blurProfile, precision); | 648 return new GrRectBlurEffect(rect, sigma, blurProfile, precision); |
649 } | 649 } |
650 | 650 |
651 const SkRect& getRect() const { return fRect; } | 651 const SkRect& getRect() const { return fRect; } |
652 float getSigma() const { return fSigma; } | 652 float getSigma() const { return fSigma; } |
653 | 653 |
654 private: | 654 private: |
655 GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *blurProfile, | 655 GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *blurProfile, |
656 GrSLPrecision fPrecision); | 656 GrSLPrecision fPrecision); |
657 | 657 |
658 GrGLSLFragmentProcessor* onCreateGLInstance() const override; | 658 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
659 | 659 |
660 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override; | 660 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b)
const override; |
661 | 661 |
662 bool onIsEqual(const GrFragmentProcessor&) const override; | 662 bool onIsEqual(const GrFragmentProcessor&) const override; |
663 | 663 |
664 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 664 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
665 | 665 |
666 static GrTexture* CreateBlurProfileTexture(GrTextureProvider*, float sigma); | 666 static GrTexture* CreateBlurProfileTexture(GrTextureProvider*, float sigma); |
667 | 667 |
668 SkRect fRect; | 668 SkRect fRect; |
669 float fSigma; | 669 float fSigma; |
670 GrTextureAccess fBlurProfileAccess; | 670 GrTextureAccess fBlurProfileAccess; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 GrSLPrecision precision) | 809 GrSLPrecision precision) |
810 : fRect(rect) | 810 : fRect(rect) |
811 , fSigma(sigma) | 811 , fSigma(sigma) |
812 , fBlurProfileAccess(blurProfile) | 812 , fBlurProfileAccess(blurProfile) |
813 , fPrecision(precision) { | 813 , fPrecision(precision) { |
814 this->initClassID<GrRectBlurEffect>(); | 814 this->initClassID<GrRectBlurEffect>(); |
815 this->addTextureAccess(&fBlurProfileAccess); | 815 this->addTextureAccess(&fBlurProfileAccess); |
816 this->setWillReadFragmentPosition(); | 816 this->setWillReadFragmentPosition(); |
817 } | 817 } |
818 | 818 |
819 void GrRectBlurEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, | 819 void GrRectBlurEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
820 GrProcessorKeyBuilder* b) const { | 820 GrProcessorKeyBuilder* b) const { |
821 GrGLRectBlurEffect::GenKey(fPrecision, b); | 821 GrGLRectBlurEffect::GenKey(fPrecision, b); |
822 } | 822 } |
823 | 823 |
824 GrGLSLFragmentProcessor* GrRectBlurEffect::onCreateGLInstance() const { | 824 GrGLSLFragmentProcessor* GrRectBlurEffect::onCreateGLSLInstance() const { |
825 return new GrGLRectBlurEffect(*this, fPrecision); | 825 return new GrGLRectBlurEffect(*this, fPrecision); |
826 } | 826 } |
827 | 827 |
828 bool GrRectBlurEffect::onIsEqual(const GrFragmentProcessor& sBase) const { | 828 bool GrRectBlurEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
829 const GrRectBlurEffect& s = sBase.cast<GrRectBlurEffect>(); | 829 const GrRectBlurEffect& s = sBase.cast<GrRectBlurEffect>(); |
830 return this->getSigma() == s.getSigma() && this->getRect() == s.getRect(); | 830 return this->getSigma() == s.getSigma() && this->getRect() == s.getRect(); |
831 } | 831 } |
832 | 832 |
833 void GrRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const
{ | 833 void GrRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const
{ |
834 inout->mulByUnknownSingleComponent(); | 834 inout->mulByUnknownSingleComponent(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 | 905 |
906 static const GrFragmentProcessor* Create(GrTextureProvider*, float sigma, co
nst SkRRect&); | 906 static const GrFragmentProcessor* Create(GrTextureProvider*, float sigma, co
nst SkRRect&); |
907 | 907 |
908 virtual ~GrRRectBlurEffect() {}; | 908 virtual ~GrRRectBlurEffect() {}; |
909 const char* name() const override { return "GrRRectBlur"; } | 909 const char* name() const override { return "GrRRectBlur"; } |
910 | 910 |
911 const SkRRect& getRRect() const { return fRRect; } | 911 const SkRRect& getRRect() const { return fRRect; } |
912 float getSigma() const { return fSigma; } | 912 float getSigma() const { return fSigma; } |
913 | 913 |
914 private: | 914 private: |
915 GrGLSLFragmentProcessor* onCreateGLInstance() const override; | 915 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
916 | 916 |
917 GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture); | 917 GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture); |
918 | 918 |
919 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, | 919 virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
920 GrProcessorKeyBuilder* b) const override; | 920 GrProcessorKeyBuilder* b) const override; |
921 | 921 |
922 bool onIsEqual(const GrFragmentProcessor& other) const override; | 922 bool onIsEqual(const GrFragmentProcessor& other) const override; |
923 | 923 |
924 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 924 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
925 | 925 |
926 SkRRect fRRect; | 926 SkRRect fRRect; |
927 float fSigma; | 927 float fSigma; |
928 GrTextureAccess fNinePatchAccess; | 928 GrTextureAccess fNinePatchAccess; |
929 | 929 |
930 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 930 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 SkRect rect = rrect.getBounds(); | 1124 SkRect rect = rrect.getBounds(); |
1125 rect.outset(blurRadius, blurRadius); | 1125 rect.outset(blurRadius, blurRadius); |
1126 pdman.set4f(fProxyRectUniform, rect.fLeft, rect.fTop, rect.fRight, rect.fBot
tom); | 1126 pdman.set4f(fProxyRectUniform, rect.fLeft, rect.fTop, rect.fRight, rect.fBot
tom); |
1127 | 1127 |
1128 SkScalar radius = 0; | 1128 SkScalar radius = 0; |
1129 SkASSERT(rrect.isSimpleCircular() || rrect.isRect()); | 1129 SkASSERT(rrect.isSimpleCircular() || rrect.isRect()); |
1130 radius = rrect.getSimpleRadii().fX; | 1130 radius = rrect.getSimpleRadii().fX; |
1131 pdman.set1f(fCornerRadiusUniform, radius); | 1131 pdman.set1f(fCornerRadiusUniform, radius); |
1132 } | 1132 } |
1133 | 1133 |
1134 void GrRRectBlurEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorK
eyBuilder* b) const { | 1134 void GrRRectBlurEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
| 1135 GrProcessorKeyBuilder* b) const { |
1135 GrGLRRectBlurEffect::GenKey(*this, caps, b); | 1136 GrGLRRectBlurEffect::GenKey(*this, caps, b); |
1136 } | 1137 } |
1137 | 1138 |
1138 GrGLSLFragmentProcessor* GrRRectBlurEffect::onCreateGLInstance() const { | 1139 GrGLSLFragmentProcessor* GrRRectBlurEffect::onCreateGLSLInstance() const { |
1139 return new GrGLRRectBlurEffect(*this); | 1140 return new GrGLRRectBlurEffect(*this); |
1140 } | 1141 } |
1141 | 1142 |
1142 bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrTextureProvider* texProvid
er, | 1143 bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrTextureProvider* texProvid
er, |
1143 GrDrawContext* drawContext, | 1144 GrDrawContext* drawContext, |
1144 GrPaint* grp, | 1145 GrPaint* grp, |
1145 const GrClip& clip, | 1146 const GrClip& clip, |
1146 const SkMatrix& viewMatrix, | 1147 const SkMatrix& viewMatrix, |
1147 const SkStrokeRec& strokeRec
, | 1148 const SkStrokeRec& strokeRec
, |
1148 const SkRRect& rrect) const
{ | 1149 const SkRRect& rrect) const
{ |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 } else { | 1302 } else { |
1302 str->append("None"); | 1303 str->append("None"); |
1303 } | 1304 } |
1304 str->append("))"); | 1305 str->append("))"); |
1305 } | 1306 } |
1306 #endif | 1307 #endif |
1307 | 1308 |
1308 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1309 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1309 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1310 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1310 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1311 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |