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 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 inout->mulByUnknownSingleComponent(); | 258 inout->mulByUnknownSingleComponent(); |
259 } else if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThresh
old >= 1.f) { | 259 } else if (GrPixelConfigIsOpaque(this->texture(0)->config()) && fOuterThresh
old >= 1.f) { |
260 inout->mulByUnknownOpaqueFourComponents(); | 260 inout->mulByUnknownOpaqueFourComponents(); |
261 } else { | 261 } else { |
262 inout->mulByUnknownFourComponents(); | 262 inout->mulByUnknownFourComponents(); |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 #endif | 266 #endif |
267 | 267 |
268 SkFlattenable* SkAlphaThresholdFilterImpl::CreateProc(SkReadBuffer& buffer) { | 268 sk_sp<SkFlattenable> SkAlphaThresholdFilterImpl::CreateProc(SkReadBuffer& buffer
) { |
269 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 269 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
270 SkScalar inner = buffer.readScalar(); | 270 SkScalar inner = buffer.readScalar(); |
271 SkScalar outer = buffer.readScalar(); | 271 SkScalar outer = buffer.readScalar(); |
272 SkRegion rgn; | 272 SkRegion rgn; |
273 buffer.readRegion(&rgn); | 273 buffer.readRegion(&rgn); |
274 return SkAlphaThresholdFilter::Make(rgn, inner, outer, common.getInput(0)).r
elease(); | 274 return SkAlphaThresholdFilter::Make(rgn, inner, outer, common.getInput(0)); |
275 } | 275 } |
276 | 276 |
277 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region, | 277 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region, |
278 SkScalar innerThreshold, | 278 SkScalar innerThreshold, |
279 SkScalar outerThreshold, | 279 SkScalar outerThreshold, |
280 sk_sp<SkImageFilter> inpu
t) | 280 sk_sp<SkImageFilter> inpu
t) |
281 : INHERITED(&input, 1, nullptr) | 281 : INHERITED(&input, 1, nullptr) |
282 , fRegion(region) | 282 , fRegion(region) |
283 , fInnerThreshold(innerThreshold) | 283 , fInnerThreshold(innerThreshold) |
284 , fOuterThreshold(outerThreshold) { | 284 , fOuterThreshold(outerThreshold) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 return true; | 405 return true; |
406 } | 406 } |
407 | 407 |
408 #ifndef SK_IGNORE_TO_STRING | 408 #ifndef SK_IGNORE_TO_STRING |
409 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 409 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
410 str->appendf("SkAlphaThresholdImageFilter: ("); | 410 str->appendf("SkAlphaThresholdImageFilter: ("); |
411 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 411 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
412 str->append(")"); | 412 str->append(")"); |
413 } | 413 } |
414 #endif | 414 #endif |
OLD | NEW |