| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 | 217 |
| 218 /////////////////////////////////////////////////////////////////////////////// | 218 /////////////////////////////////////////////////////////////////////////////// |
| 219 | 219 |
| 220 const GrBackendFragmentProcessorFactory& AlphaThresholdEffect::getFactory() cons
t { | 220 const GrBackendFragmentProcessorFactory& AlphaThresholdEffect::getFactory() cons
t { |
| 221 return GrTBackendFragmentProcessorFactory<AlphaThresholdEffect>::getInstance
(); | 221 return GrTBackendFragmentProcessorFactory<AlphaThresholdEffect>::getInstance
(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const { | 224 bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
| 225 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>(); | 225 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>(); |
| 226 return (this->texture(0) == s.texture(0) && | 226 return (this->fInnerThreshold == s.fInnerThreshold && |
| 227 this->fInnerThreshold == s.fInnerThreshold && | |
| 228 this->fOuterThreshold == s.fOuterThreshold); | 227 this->fOuterThreshold == s.fOuterThreshold); |
| 229 } | 228 } |
| 230 | 229 |
| 231 void AlphaThresholdEffect::onComputeInvariantOutput(InvariantOutput* inout) cons
t { | 230 void AlphaThresholdEffect::onComputeInvariantOutput(InvariantOutput* inout) cons
t { |
| 232 if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThreshold >=
1.f) { | 231 if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThreshold >=
1.f) { |
| 233 inout->mulByUnknownOpaqueColor(); | 232 inout->mulByUnknownOpaqueColor(); |
| 234 } else { | 233 } else { |
| 235 inout->mulByUnknownColor(); | 234 inout->mulByUnknownColor(); |
| 236 } | 235 } |
| 237 } | 236 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 (U8CPU)(SkColorGetG(source) *
scale), | 377 (U8CPU)(SkColorGetG(source) *
scale), |
| 379 (U8CPU)(SkColorGetB(source) *
scale)); | 378 (U8CPU)(SkColorGetB(source) *
scale)); |
| 380 } | 379 } |
| 381 } | 380 } |
| 382 dptr[y * dst->width() + x] = output_color; | 381 dptr[y * dst->width() + x] = output_color; |
| 383 } | 382 } |
| 384 } | 383 } |
| 385 | 384 |
| 386 return true; | 385 return true; |
| 387 } | 386 } |
| OLD | NEW |