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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 builder->fsCodeAppendf("\t%s = vec4(final, final, final, 1);\n", outputColor
); | 688 builder->fsCodeAppendf("\t%s = vec4(final, final, final, 1);\n", outputColor
); |
689 } | 689 } |
690 | 690 |
691 void GrGLRectBlurEffect::setData(const GrGLUniformManager& uman, | 691 void GrGLRectBlurEffect::setData(const GrGLUniformManager& uman, |
692 const GrDrawEffect& drawEffect) { | 692 const GrDrawEffect& drawEffect) { |
693 const GrRectBlurEffect& rbe = drawEffect.castEffect<GrRectBlurEffect>(); | 693 const GrRectBlurEffect& rbe = drawEffect.castEffect<GrRectBlurEffect>(); |
694 SkRect rect = rbe.getRect(); | 694 SkRect rect = rbe.getRect(); |
695 | 695 |
696 uman.set4f(fProxyRectUniform, rect.fLeft, rect.fTop, rect.fRight, rect.fBott
om); | 696 uman.set4f(fProxyRectUniform, rect.fLeft, rect.fTop, rect.fRight, rect.fBott
om); |
697 uman.set1f(fProfileSizeUniform, SkScalarCeilToScalar(6*rbe.getSigma())); | 697 uman.set1f(fProfileSizeUniform, SkScalarCeilToScalar(6*rbe.getSigma())); |
| 698 |
| 699 SkDebugf( "proxy rect set to %f %f %f %f\n", rect.fLeft, rect.fTop, rect.fRi
ght, rect.fBottom); |
| 700 SkDebugf(" Profile size set to %f\n", SkScalarCeilToScalar(6*rbe.getSigma())
); |
698 } | 701 } |
699 | 702 |
700 bool GrRectBlurEffect::CreateBlurProfileTexture(GrContext *context, float sigma, | 703 bool GrRectBlurEffect::CreateBlurProfileTexture(GrContext *context, float sigma, |
701 GrTexture **blurProfileTexture) { | 704 GrTexture **blurProfileTexture) { |
702 GrTextureParams params; | 705 GrTextureParams params; |
703 GrTextureDesc texDesc; | 706 GrTextureDesc texDesc; |
704 | 707 |
705 unsigned int profile_size = SkScalarCeilToInt(6*sigma); | 708 unsigned int profile_size = SkScalarCeilToInt(6*sigma); |
706 | 709 |
707 texDesc.fWidth = profile_size; | 710 texDesc.fWidth = profile_size; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 return false; | 792 return false; |
790 } | 793 } |
791 | 794 |
792 if (!strokeRec.isFillStyle()) { | 795 if (!strokeRec.isFillStyle()) { |
793 return false; | 796 return false; |
794 } | 797 } |
795 | 798 |
796 SkMatrix ctm = context->getMatrix(); | 799 SkMatrix ctm = context->getMatrix(); |
797 SkScalar xformedSigma = this->computeXformedSigma(ctm); | 800 SkScalar xformedSigma = this->computeXformedSigma(ctm); |
798 | 801 |
799 float pad=SkScalarCeilToScalar(6*xformedSigma)/2.0f; | 802 int pad=SkScalarCeilToInt(6*xformedSigma)/2; |
800 rect.outset(pad, pad); | 803 rect.outset(SkIntToScalar(pad), SkIntToScalar(pad)); |
801 | 804 |
802 SkAutoTUnref<GrEffectRef> effect(GrRectBlurEffect::Create( | 805 SkAutoTUnref<GrEffectRef> effect(GrRectBlurEffect::Create( |
803 context, rect, xformedSigma)); | 806 context, rect, xformedSigma)); |
804 if (!effect) { | 807 if (!effect) { |
805 return false; | 808 return false; |
806 } | 809 } |
807 | 810 |
808 GrContext::AutoMatrix am; | 811 GrContext::AutoMatrix am; |
809 if (!am.setIdentity(context, grp)) { | 812 if (!am.setIdentity(context, grp)) { |
810 return false; | 813 return false; |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 } else { | 1215 } else { |
1213 str->append("None"); | 1216 str->append("None"); |
1214 } | 1217 } |
1215 str->append("))"); | 1218 str->append("))"); |
1216 } | 1219 } |
1217 #endif | 1220 #endif |
1218 | 1221 |
1219 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1222 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1220 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1223 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1221 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1224 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |