| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 typedef GrFragmentProcessor INHERITED; | 117 typedef GrFragmentProcessor INHERITED; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 class GrGLAlphaThresholdEffect : public GrGLFragmentProcessor { | 120 class GrGLAlphaThresholdEffect : public GrGLFragmentProcessor { |
| 121 public: | 121 public: |
| 122 GrGLAlphaThresholdEffect(const GrBackendProcessorFactory&, const GrProcessor
&); | 122 GrGLAlphaThresholdEffect(const GrBackendProcessorFactory&, const GrProcessor
&); |
| 123 | 123 |
| 124 virtual void emitCode(GrGLFPBuilder*, | 124 virtual void emitCode(GrGLFPBuilder*, |
| 125 const GrFragmentProcessor&, | 125 const GrFragmentProcessor&, |
| 126 const GrProcessorKey&, | |
| 127 const char* outputColor, | 126 const char* outputColor, |
| 128 const char* inputColor, | 127 const char* inputColor, |
| 129 const TransformedCoordsArray&, | 128 const TransformedCoordsArray&, |
| 130 const TextureSamplerArray&) SK_OVERRIDE; | 129 const TextureSamplerArray&) SK_OVERRIDE; |
| 131 | 130 |
| 132 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; | 131 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; |
| 133 | 132 |
| 134 private: | 133 private: |
| 135 | 134 |
| 136 GrGLProgramDataManager::UniformHandle fInnerThresholdVar; | 135 GrGLProgramDataManager::UniformHandle fInnerThresholdVar; |
| 137 GrGLProgramDataManager::UniformHandle fOuterThresholdVar; | 136 GrGLProgramDataManager::UniformHandle fOuterThresholdVar; |
| 138 | 137 |
| 139 typedef GrGLFragmentProcessor INHERITED; | 138 typedef GrGLFragmentProcessor INHERITED; |
| 140 }; | 139 }; |
| 141 | 140 |
| 142 GrGLAlphaThresholdEffect::GrGLAlphaThresholdEffect(const GrBackendProcessorFacto
ry& factory, | 141 GrGLAlphaThresholdEffect::GrGLAlphaThresholdEffect(const GrBackendProcessorFacto
ry& factory, |
| 143 const GrProcessor&) | 142 const GrProcessor&) |
| 144 : INHERITED(factory) { | 143 : INHERITED(factory) { |
| 145 } | 144 } |
| 146 | 145 |
| 147 void GrGLAlphaThresholdEffect::emitCode(GrGLFPBuilder* builder, | 146 void GrGLAlphaThresholdEffect::emitCode(GrGLFPBuilder* builder, |
| 148 const GrFragmentProcessor&, | 147 const GrFragmentProcessor&, |
| 149 const GrProcessorKey& key, | |
| 150 const char* outputColor, | 148 const char* outputColor, |
| 151 const char* inputColor, | 149 const char* inputColor, |
| 152 const TransformedCoordsArray& coords, | 150 const TransformedCoordsArray& coords, |
| 153 const TextureSamplerArray& samplers) { | 151 const TextureSamplerArray& samplers) { |
| 154 fInnerThresholdVar = builder->addUniform( | 152 fInnerThresholdVar = builder->addUniform( |
| 155 GrGLProgramBuilder::kFragment_Visibility, | 153 GrGLProgramBuilder::kFragment_Visibility, |
| 156 kFloat_GrSLType, "inner_threshold"); | 154 kFloat_GrSLType, "inner_threshold"); |
| 157 fOuterThresholdVar = builder->addUniform( | 155 fOuterThresholdVar = builder->addUniform( |
| 158 GrGLProgramBuilder::kFragment_Visibility, | 156 GrGLProgramBuilder::kFragment_Visibility, |
| 159 kFloat_GrSLType, "outer_threshold"); | 157 kFloat_GrSLType, "outer_threshold"); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 (U8CPU)(SkColorGetG(source) *
scale), | 376 (U8CPU)(SkColorGetG(source) *
scale), |
| 379 (U8CPU)(SkColorGetB(source) *
scale)); | 377 (U8CPU)(SkColorGetB(source) *
scale)); |
| 380 } | 378 } |
| 381 } | 379 } |
| 382 dptr[y * dst->width() + x] = output_color; | 380 dptr[y * dst->width() + x] = output_color; |
| 383 } | 381 } |
| 384 } | 382 } |
| 385 | 383 |
| 386 return true; | 384 return true; |
| 387 } | 385 } |
| OLD | NEW |