| 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 return NULL; | 583 return NULL; |
| 584 } | 584 } |
| 585 return SkNEW_ARGS(GrRectBlurEffect, (rect, sigma, blurProfileTexture)); | 585 return SkNEW_ARGS(GrRectBlurEffect, (rect, sigma, blurProfileTexture)); |
| 586 } | 586 } |
| 587 | 587 |
| 588 const SkRect& getRect() const { return fRect; } | 588 const SkRect& getRect() const { return fRect; } |
| 589 float getSigma() const { return fSigma; } | 589 float getSigma() const { return fSigma; } |
| 590 | 590 |
| 591 private: | 591 private: |
| 592 GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *blur_profile); | 592 GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *blur_profile); |
| 593 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 593 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
| 594 | 594 |
| 595 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | 595 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
| 596 | 596 |
| 597 static bool CreateBlurProfileTexture(GrContext *context, float sigma, | 597 static bool CreateBlurProfileTexture(GrContext *context, float sigma, |
| 598 GrTexture **blurProfileTexture); | 598 GrTexture **blurProfileTexture); |
| 599 | 599 |
| 600 SkRect fRect; | 600 SkRect fRect; |
| 601 float fSigma; | 601 float fSigma; |
| 602 GrTextureAccess fBlurProfileAccess; | 602 GrTextureAccess fBlurProfileAccess; |
| 603 | 603 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 this->setWillReadFragmentPosition(); | 753 this->setWillReadFragmentPosition(); |
| 754 } | 754 } |
| 755 | 755 |
| 756 GrRectBlurEffect::~GrRectBlurEffect() { | 756 GrRectBlurEffect::~GrRectBlurEffect() { |
| 757 } | 757 } |
| 758 | 758 |
| 759 const GrBackendFragmentProcessorFactory& GrRectBlurEffect::getFactory() const { | 759 const GrBackendFragmentProcessorFactory& GrRectBlurEffect::getFactory() const { |
| 760 return GrTBackendFragmentProcessorFactory<GrRectBlurEffect>::getInstance(); | 760 return GrTBackendFragmentProcessorFactory<GrRectBlurEffect>::getInstance(); |
| 761 } | 761 } |
| 762 | 762 |
| 763 bool GrRectBlurEffect::onIsEqual(const GrProcessor& sBase) const { | 763 bool GrRectBlurEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
| 764 const GrRectBlurEffect& s = sBase.cast<GrRectBlurEffect>(); | 764 const GrRectBlurEffect& s = sBase.cast<GrRectBlurEffect>(); |
| 765 return this->getSigma() == s.getSigma() && this->getRect() == s.getRect(); | 765 return this->getSigma() == s.getSigma() && this->getRect() == s.getRect(); |
| 766 } | 766 } |
| 767 | 767 |
| 768 void GrRectBlurEffect::onComputeInvariantOutput(InvariantOutput* inout) const { | 768 void GrRectBlurEffect::onComputeInvariantOutput(InvariantOutput* inout) const { |
| 769 inout->mulByUnknownAlpha(); | 769 inout->mulByUnknownAlpha(); |
| 770 } | 770 } |
| 771 | 771 |
| 772 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRectBlurEffect); | 772 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRectBlurEffect); |
| 773 | 773 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 const SkRRect& getRRect() const { return fRRect; } | 834 const SkRRect& getRRect() const { return fRRect; } |
| 835 float getSigma() const { return fSigma; } | 835 float getSigma() const { return fSigma; } |
| 836 | 836 |
| 837 typedef GrGLRRectBlurEffect GLProcessor; | 837 typedef GrGLRRectBlurEffect GLProcessor; |
| 838 | 838 |
| 839 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 839 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
| 840 | 840 |
| 841 private: | 841 private: |
| 842 GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture); | 842 GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture); |
| 843 | 843 |
| 844 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE; | 844 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE; |
| 845 | 845 |
| 846 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | 846 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
| 847 | 847 |
| 848 SkRRect fRRect; | 848 SkRRect fRRect; |
| 849 float fSigma; | 849 float fSigma; |
| 850 GrTextureAccess fNinePatchAccess; | 850 GrTextureAccess fNinePatchAccess; |
| 851 | 851 |
| 852 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 852 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 853 | 853 |
| 854 typedef GrFragmentProcessor INHERITED; | 854 typedef GrFragmentProcessor INHERITED; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 } | 937 } |
| 938 | 938 |
| 939 GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTextur
e *ninePatchTexture) | 939 GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, GrTextur
e *ninePatchTexture) |
| 940 : fRRect(rrect), | 940 : fRRect(rrect), |
| 941 fSigma(sigma), | 941 fSigma(sigma), |
| 942 fNinePatchAccess(ninePatchTexture) { | 942 fNinePatchAccess(ninePatchTexture) { |
| 943 this->addTextureAccess(&fNinePatchAccess); | 943 this->addTextureAccess(&fNinePatchAccess); |
| 944 this->setWillReadFragmentPosition(); | 944 this->setWillReadFragmentPosition(); |
| 945 } | 945 } |
| 946 | 946 |
| 947 bool GrRRectBlurEffect::onIsEqual(const GrProcessor& other) const { | 947 bool GrRRectBlurEffect::onIsEqual(const GrFragmentProcessor& other) const { |
| 948 const GrRRectBlurEffect& rrbe = other.cast<GrRRectBlurEffect>(); | 948 const GrRRectBlurEffect& rrbe = other.cast<GrRRectBlurEffect>(); |
| 949 return fRRect.getSimpleRadii().fX == rrbe.fRRect.getSimpleRadii().fX && fSig
ma == rrbe.fSigma; | 949 return fRRect.getSimpleRadii().fX == rrbe.fRRect.getSimpleRadii().fX && fSig
ma == rrbe.fSigma; |
| 950 } | 950 } |
| 951 | 951 |
| 952 ////////////////////////////////////////////////////////////////////////////// | 952 ////////////////////////////////////////////////////////////////////////////// |
| 953 | 953 |
| 954 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRRectBlurEffect); | 954 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRRectBlurEffect); |
| 955 | 955 |
| 956 GrFragmentProcessor* GrRRectBlurEffect::TestCreate(SkRandom* random, | 956 GrFragmentProcessor* GrRRectBlurEffect::TestCreate(SkRandom* random, |
| 957 GrContext* context, | 957 GrContext* context, |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 } else { | 1218 } else { |
| 1219 str->append("None"); | 1219 str->append("None"); |
| 1220 } | 1220 } |
| 1221 str->append("))"); | 1221 str->append("))"); |
| 1222 } | 1222 } |
| 1223 #endif | 1223 #endif |
| 1224 | 1224 |
| 1225 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1225 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
| 1226 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1226 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
| 1227 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1227 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |