| 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 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 const GrRectBlurEffect& s = sBase.cast<GrRectBlurEffect>(); | 814 const GrRectBlurEffect& s = sBase.cast<GrRectBlurEffect>(); |
| 815 return this->getSigma() == s.getSigma() && this->getRect() == s.getRect(); | 815 return this->getSigma() == s.getSigma() && this->getRect() == s.getRect(); |
| 816 } | 816 } |
| 817 | 817 |
| 818 void GrRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const
{ | 818 void GrRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const
{ |
| 819 inout->mulByUnknownSingleComponent(); | 819 inout->mulByUnknownSingleComponent(); |
| 820 } | 820 } |
| 821 | 821 |
| 822 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRectBlurEffect); | 822 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRectBlurEffect); |
| 823 | 823 |
| 824 GrFragmentProcessor* GrRectBlurEffect::TestCreate(SkRandom* random, | 824 GrFragmentProcessor* GrRectBlurEffect::TestCreate(GrProcessorTestData* d) { |
| 825 GrContext* context, | 825 float sigma = d->fRandom->nextRangeF(3,8); |
| 826 const GrCaps&, | 826 float width = d->fRandom->nextRangeF(200,300); |
| 827 GrTexture**) { | 827 float height = d->fRandom->nextRangeF(200,300); |
| 828 float sigma = random->nextRangeF(3,8); | 828 return GrRectBlurEffect::Create(d->fContext->textureProvider(), SkRect::Make
WH(width, height), |
| 829 float width = random->nextRangeF(200,300); | |
| 830 float height = random->nextRangeF(200,300); | |
| 831 return GrRectBlurEffect::Create(context->textureProvider(), SkRect::MakeWH(w
idth, height), | |
| 832 sigma); | 829 sigma); |
| 833 } | 830 } |
| 834 | 831 |
| 835 | 832 |
| 836 bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrContext* context, | 833 bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrContext* context, |
| 837 GrRenderTarget* rt, | 834 GrRenderTarget* rt, |
| 838 GrPaint* grp, | 835 GrPaint* grp, |
| 839 const GrClip& clip, | 836 const GrClip& clip, |
| 840 const SkMatrix& viewMatrix, | 837 const SkMatrix& viewMatrix, |
| 841 const SkStrokeRec& strokeRec, | 838 const SkStrokeRec& strokeRec, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 | 999 |
| 1003 bool GrRRectBlurEffect::onIsEqual(const GrFragmentProcessor& other) const { | 1000 bool GrRRectBlurEffect::onIsEqual(const GrFragmentProcessor& other) const { |
| 1004 const GrRRectBlurEffect& rrbe = other.cast<GrRRectBlurEffect>(); | 1001 const GrRRectBlurEffect& rrbe = other.cast<GrRRectBlurEffect>(); |
| 1005 return fRRect.getSimpleRadii().fX == rrbe.fRRect.getSimpleRadii().fX && fSig
ma == rrbe.fSigma; | 1002 return fRRect.getSimpleRadii().fX == rrbe.fRRect.getSimpleRadii().fX && fSig
ma == rrbe.fSigma; |
| 1006 } | 1003 } |
| 1007 | 1004 |
| 1008 ////////////////////////////////////////////////////////////////////////////// | 1005 ////////////////////////////////////////////////////////////////////////////// |
| 1009 | 1006 |
| 1010 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRRectBlurEffect); | 1007 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRRectBlurEffect); |
| 1011 | 1008 |
| 1012 GrFragmentProcessor* GrRRectBlurEffect::TestCreate(SkRandom* random, | 1009 GrFragmentProcessor* GrRRectBlurEffect::TestCreate(GrProcessorTestData* d) { |
| 1013 GrContext* context, | 1010 SkScalar w = d->fRandom->nextRangeScalar(100.f, 1000.f); |
| 1014 const GrCaps& caps, | 1011 SkScalar h = d->fRandom->nextRangeScalar(100.f, 1000.f); |
| 1015 GrTexture*[]) { | 1012 SkScalar r = d->fRandom->nextRangeF(1.f, 9.f); |
| 1016 SkScalar w = random->nextRangeScalar(100.f, 1000.f); | 1013 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); |
| 1017 SkScalar h = random->nextRangeScalar(100.f, 1000.f); | |
| 1018 SkScalar r = random->nextRangeF(1.f, 9.f); | |
| 1019 SkScalar sigma = random->nextRangeF(1.f,10.f); | |
| 1020 SkRRect rrect; | 1014 SkRRect rrect; |
| 1021 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); | 1015 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); |
| 1022 return GrRRectBlurEffect::Create(context, sigma, rrect); | 1016 return GrRRectBlurEffect::Create(d->fContext, sigma, rrect); |
| 1023 } | 1017 } |
| 1024 | 1018 |
| 1025 ////////////////////////////////////////////////////////////////////////////// | 1019 ////////////////////////////////////////////////////////////////////////////// |
| 1026 | 1020 |
| 1027 class GrGLRRectBlurEffect : public GrGLFragmentProcessor { | 1021 class GrGLRRectBlurEffect : public GrGLFragmentProcessor { |
| 1028 public: | 1022 public: |
| 1029 GrGLRRectBlurEffect(const GrProcessor&) {} | 1023 GrGLRRectBlurEffect(const GrProcessor&) {} |
| 1030 | 1024 |
| 1031 virtual void emitCode(GrGLFPBuilder*, | 1025 virtual void emitCode(GrGLFPBuilder*, |
| 1032 const GrFragmentProcessor&, | 1026 const GrFragmentProcessor&, |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 } else { | 1285 } else { |
| 1292 str->append("None"); | 1286 str->append("None"); |
| 1293 } | 1287 } |
| 1294 str->append("))"); | 1288 str->append("))"); |
| 1295 } | 1289 } |
| 1296 #endif | 1290 #endif |
| 1297 | 1291 |
| 1298 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1292 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
| 1299 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1293 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
| 1300 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1294 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |