| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 return GrTBackendFragmentProcessorFactory<AlphaThresholdEffect>::getInstance
(); | 222 return GrTBackendFragmentProcessorFactory<AlphaThresholdEffect>::getInstance
(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const { | 225 bool AlphaThresholdEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
| 226 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>(); | 226 const AlphaThresholdEffect& s = sBase.cast<AlphaThresholdEffect>(); |
| 227 return (this->fInnerThreshold == s.fInnerThreshold && | 227 return (this->fInnerThreshold == s.fInnerThreshold && |
| 228 this->fOuterThreshold == s.fOuterThreshold); | 228 this->fOuterThreshold == s.fOuterThreshold); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void AlphaThresholdEffect::onComputeInvariantOutput(GrInvariantOutput* inout) co
nst { | 231 void AlphaThresholdEffect::onComputeInvariantOutput(GrInvariantOutput* inout) co
nst { |
| 232 if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThreshold >=
1.f) { | 232 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) { |
| 233 inout->mulByUnknownAlpha(); |
| 234 } else if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThresh
old >= 1.f) { |
| 233 inout->mulByUnknownOpaqueColor(); | 235 inout->mulByUnknownOpaqueColor(); |
| 234 } else { | 236 } else { |
| 235 inout->mulByUnknownColor(); | 237 inout->mulByUnknownColor(); |
| 236 } | 238 } |
| 237 } | 239 } |
| 238 | 240 |
| 239 #endif | 241 #endif |
| 240 | 242 |
| 241 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | 243 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 242 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(SkReadBuffer& buffer) | 244 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(SkReadBuffer& buffer) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 (U8CPU)(SkColorGetG(source) *
scale), | 380 (U8CPU)(SkColorGetG(source) *
scale), |
| 379 (U8CPU)(SkColorGetB(source) *
scale)); | 381 (U8CPU)(SkColorGetB(source) *
scale)); |
| 380 } | 382 } |
| 381 } | 383 } |
| 382 dptr[y * dst->width() + x] = output_color; | 384 dptr[y * dst->width() + x] = output_color; |
| 383 } | 385 } |
| 384 } | 386 } |
| 385 | 387 |
| 386 return true; | 388 return true; |
| 387 } | 389 } |
| OLD | NEW |