OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBlurMaskFilter.h" | 8 #include "SkBlurMaskFilter.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkGpuBlurUtils.h" | 10 #include "SkGpuBlurUtils.h" |
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); | 1036 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); |
1037 SkRRect rrect; | 1037 SkRRect rrect; |
1038 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); | 1038 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); |
1039 return GrRRectBlurEffect::Create(d->fContext->textureProvider(), sigma, rrec
t); | 1039 return GrRRectBlurEffect::Create(d->fContext->textureProvider(), sigma, rrec
t); |
1040 } | 1040 } |
1041 | 1041 |
1042 ////////////////////////////////////////////////////////////////////////////// | 1042 ////////////////////////////////////////////////////////////////////////////// |
1043 | 1043 |
1044 class GrGLRRectBlurEffect : public GrGLSLFragmentProcessor { | 1044 class GrGLRRectBlurEffect : public GrGLSLFragmentProcessor { |
1045 public: | 1045 public: |
1046 GrGLRRectBlurEffect(const GrProcessor&) {} | 1046 void emitCode(EmitArgs&) override; |
1047 | |
1048 virtual void emitCode(EmitArgs&) override; | |
1049 | 1047 |
1050 protected: | 1048 protected: |
1051 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; | 1049 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; |
1052 | 1050 |
1053 private: | 1051 private: |
1054 GrGLSLProgramDataManager::UniformHandle fProxyRectUniform; | 1052 GrGLSLProgramDataManager::UniformHandle fProxyRectUniform; |
1055 GrGLSLProgramDataManager::UniformHandle fCornerRadiusUniform; | 1053 GrGLSLProgramDataManager::UniformHandle fCornerRadiusUniform; |
1056 GrGLSLProgramDataManager::UniformHandle fBlurRadiusUniform; | 1054 GrGLSLProgramDataManager::UniformHandle fBlurRadiusUniform; |
1057 typedef GrGLSLFragmentProcessor INHERITED; | 1055 typedef GrGLSLFragmentProcessor INHERITED; |
1058 }; | 1056 }; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 radius = rrect.getSimpleRadii().fX; | 1129 radius = rrect.getSimpleRadii().fX; |
1132 pdman.set1f(fCornerRadiusUniform, radius); | 1130 pdman.set1f(fCornerRadiusUniform, radius); |
1133 } | 1131 } |
1134 | 1132 |
1135 void GrRRectBlurEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, | 1133 void GrRRectBlurEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
1136 GrProcessorKeyBuilder* b) const { | 1134 GrProcessorKeyBuilder* b) const { |
1137 GrGLRRectBlurEffect::GenKey(*this, caps, b); | 1135 GrGLRRectBlurEffect::GenKey(*this, caps, b); |
1138 } | 1136 } |
1139 | 1137 |
1140 GrGLSLFragmentProcessor* GrRRectBlurEffect::onCreateGLSLInstance() const { | 1138 GrGLSLFragmentProcessor* GrRRectBlurEffect::onCreateGLSLInstance() const { |
1141 return new GrGLRRectBlurEffect(*this); | 1139 return new GrGLRRectBlurEffect; |
1142 } | 1140 } |
1143 | 1141 |
1144 bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrTextureProvider* texProvid
er, | 1142 bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrTextureProvider* texProvid
er, |
1145 GrDrawContext* drawContext, | 1143 GrDrawContext* drawContext, |
1146 GrPaint* grp, | 1144 GrPaint* grp, |
1147 const GrClip& clip, | 1145 const GrClip& clip, |
1148 const SkMatrix& viewMatrix, | 1146 const SkMatrix& viewMatrix, |
1149 const SkStrokeRec& strokeRec
, | 1147 const SkStrokeRec& strokeRec
, |
1150 const SkRRect& rrect) const
{ | 1148 const SkRRect& rrect) const
{ |
1151 SkASSERT(drawContext); | 1149 SkASSERT(drawContext); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 } else { | 1302 } else { |
1305 str->append("None"); | 1303 str->append("None"); |
1306 } | 1304 } |
1307 str->append("))"); | 1305 str->append("))"); |
1308 } | 1306 } |
1309 #endif | 1307 #endif |
1310 | 1308 |
1311 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1309 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1312 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1310 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1313 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1311 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |