OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 "SkAlphaThresholdFilter.h" | 8 #include "SkAlphaThresholdFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 typedef GrEffect INHERITED; | 112 typedef GrEffect INHERITED; |
113 }; | 113 }; |
114 | 114 |
115 class GrGLAlphaThresholdEffect : public GrGLEffect { | 115 class GrGLAlphaThresholdEffect : public GrGLEffect { |
116 public: | 116 public: |
117 GrGLAlphaThresholdEffect(const GrBackendEffectFactory&, const GrDrawEffect&)
; | 117 GrGLAlphaThresholdEffect(const GrBackendEffectFactory&, const GrDrawEffect&)
; |
118 | 118 |
119 virtual void emitCode(GrGLShaderBuilder*, | 119 virtual void emitCode(GrGLShaderBuilder*, |
120 const GrDrawEffect&, | 120 const GrDrawEffect&, |
121 EffectKey, | 121 const GrEffectKey&, |
122 const char* outputColor, | 122 const char* outputColor, |
123 const char* inputColor, | 123 const char* inputColor, |
124 const TransformedCoordsArray&, | 124 const TransformedCoordsArray&, |
125 const TextureSamplerArray&) SK_OVERRIDE; | 125 const TextureSamplerArray&) SK_OVERRIDE; |
126 | 126 |
127 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVER
RIDE; | 127 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVER
RIDE; |
128 | 128 |
129 private: | 129 private: |
130 | 130 |
131 GrGLUniformManager::UniformHandle fInnerThresholdVar; | 131 GrGLUniformManager::UniformHandle fInnerThresholdVar; |
132 GrGLUniformManager::UniformHandle fOuterThresholdVar; | 132 GrGLUniformManager::UniformHandle fOuterThresholdVar; |
133 | 133 |
134 typedef GrGLEffect INHERITED; | 134 typedef GrGLEffect INHERITED; |
135 }; | 135 }; |
136 | 136 |
137 GrGLAlphaThresholdEffect::GrGLAlphaThresholdEffect(const GrBackendEffectFactory&
factory, const GrDrawEffect&) | 137 GrGLAlphaThresholdEffect::GrGLAlphaThresholdEffect(const GrBackendEffectFactory&
factory, const GrDrawEffect&) |
138 : INHERITED(factory) { | 138 : INHERITED(factory) { |
139 } | 139 } |
140 | 140 |
141 void GrGLAlphaThresholdEffect::emitCode(GrGLShaderBuilder* builder, | 141 void GrGLAlphaThresholdEffect::emitCode(GrGLShaderBuilder* builder, |
142 const GrDrawEffect&, | 142 const GrDrawEffect&, |
143 EffectKey key, | 143 const GrEffectKey& key, |
144 const char* outputColor, | 144 const char* outputColor, |
145 const char* inputColor, | 145 const char* inputColor, |
146 const TransformedCoordsArray& coords, | 146 const TransformedCoordsArray& coords, |
147 const TextureSamplerArray& samplers) { | 147 const TextureSamplerArray& samplers) { |
148 SkString coords2D = builder->ensureFSCoords2D(coords, 0); | 148 SkString coords2D = builder->ensureFSCoords2D(coords, 0); |
149 SkString maskCoords2D = builder->ensureFSCoords2D(coords, 1); | 149 SkString maskCoords2D = builder->ensureFSCoords2D(coords, 1); |
150 fInnerThresholdVar = builder->addUniform( | 150 fInnerThresholdVar = builder->addUniform( |
151 GrGLShaderBuilder::kFragment_Visibility, | 151 GrGLShaderBuilder::kFragment_Visibility, |
152 kFloat_GrSLType, "inner_threshold"); | 152 kFloat_GrSLType, "inner_threshold"); |
153 fOuterThresholdVar = builder->addUniform( | 153 fOuterThresholdVar = builder->addUniform( |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 (U8CPU)(SkColorGetG(source) *
scale), | 360 (U8CPU)(SkColorGetG(source) *
scale), |
361 (U8CPU)(SkColorGetB(source) *
scale)); | 361 (U8CPU)(SkColorGetB(source) *
scale)); |
362 } | 362 } |
363 } | 363 } |
364 dptr[y * dst->width() + x] = output_color; | 364 dptr[y * dst->width() + x] = output_color; |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 return true; | 368 return true; |
369 } | 369 } |
OLD | NEW |