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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 }; | 670 }; |
671 | 671 |
672 void OutputRectBlurProfileLookup(GrGLFragmentBuilder* fsBuilder, | 672 void OutputRectBlurProfileLookup(GrGLFragmentBuilder* fsBuilder, |
673 const GrGLShaderBuilder::TextureSampler& sample
r, | 673 const GrGLShaderBuilder::TextureSampler& sample
r, |
674 const char *output, | 674 const char *output, |
675 const char *profileSize, const char *loc, | 675 const char *profileSize, const char *loc, |
676 const char *blurred_width, | 676 const char *blurred_width, |
677 const char *sharp_width) { | 677 const char *sharp_width) { |
678 fsBuilder->codeAppendf("\tfloat %s;\n", output); | 678 fsBuilder->codeAppendf("\tfloat %s;\n", output); |
679 fsBuilder->codeAppendf("\t\t{\n"); | 679 fsBuilder->codeAppendf("\t\t{\n"); |
680 fsBuilder->codeAppendf("\t\t\tfloat coord = (0.5 * (abs(2.0*%s - %s) - %s) +
0.5)/%s;\n", | 680 fsBuilder->codeAppendf("\t\t\tfloat coord = (0.5 * (abs(2.0*%s - %s) - %s))/
%s;\n", |
681 loc, blurred_width, sharp_width, profileSize); | 681 loc, blurred_width, sharp_width, profileSize); |
682 fsBuilder->codeAppendf("\t\t\t%s = ", output); | 682 fsBuilder->codeAppendf("\t\t\t%s = ", output); |
683 fsBuilder->appendTextureLookup(sampler, "vec2(coord,0.5)"); | 683 fsBuilder->appendTextureLookup(sampler, "vec2(coord,0.5)"); |
684 fsBuilder->codeAppend(".a;\n"); | 684 fsBuilder->codeAppend(".a;\n"); |
685 fsBuilder->codeAppendf("\t\t}\n"); | 685 fsBuilder->codeAppendf("\t\t}\n"); |
686 } | 686 } |
687 | 687 |
688 void GrGLRectBlurEffect::emitCode(EmitArgs& args) { | 688 void GrGLRectBlurEffect::emitCode(EmitArgs& args) { |
689 | 689 |
690 const char *rectName; | 690 const char *rectName; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 textureProvider->assignUniqueKeyToTexture(key, blurProfile); | 762 textureProvider->assignUniqueKeyToTexture(key, blurProfile); |
763 } | 763 } |
764 } | 764 } |
765 | 765 |
766 return blurProfile; | 766 return blurProfile; |
767 } | 767 } |
768 | 768 |
769 GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *b
lurProfile) | 769 GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *b
lurProfile) |
770 : fRect(rect) | 770 : fRect(rect) |
771 , fSigma(sigma) | 771 , fSigma(sigma) |
772 , fBlurProfileAccess(blurProfile, GrTextureParams::kBilerp_FilterMode) { | 772 , fBlurProfileAccess(blurProfile) { |
773 this->initClassID<GrRectBlurEffect>(); | 773 this->initClassID<GrRectBlurEffect>(); |
774 this->addTextureAccess(&fBlurProfileAccess); | 774 this->addTextureAccess(&fBlurProfileAccess); |
775 this->setWillReadFragmentPosition(); | 775 this->setWillReadFragmentPosition(); |
776 } | 776 } |
777 | 777 |
778 void GrRectBlurEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, | 778 void GrRectBlurEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, |
779 GrProcessorKeyBuilder* b) const { | 779 GrProcessorKeyBuilder* b) const { |
780 GrGLRectBlurEffect::GenKey(*this, caps, b); | 780 GrGLRectBlurEffect::GenKey(*this, caps, b); |
781 } | 781 } |
782 | 782 |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 } else { | 1263 } else { |
1264 str->append("None"); | 1264 str->append("None"); |
1265 } | 1265 } |
1266 str->append("))"); | 1266 str->append("))"); |
1267 } | 1267 } |
1268 #endif | 1268 #endif |
1269 | 1269 |
1270 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1270 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1271 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1271 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1272 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1272 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |