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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 return nullptr; | 405 return nullptr; |
406 } | 406 } |
407 | 407 |
408 | 408 |
409 SkMatrix localInverse; | 409 SkMatrix localInverse; |
410 if (!ctx.ctm().invert(&localInverse)) { | 410 if (!ctx.ctm().invert(&localInverse)) { |
411 return nullptr; | 411 return nullptr; |
412 } | 412 } |
413 | 413 |
414 SkImageInfo info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), | 414 SkImageInfo info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), |
415 inputBM.alphaType()); | 415 kPremul_SkAlphaType); |
416 | 416 |
417 SkBitmap dst; | 417 SkBitmap dst; |
418 if (!dst.tryAllocPixels(info)) { | 418 if (!dst.tryAllocPixels(info)) { |
419 return nullptr; | 419 return nullptr; |
420 } | 420 } |
421 | 421 |
422 SkAutoLockPixels dstLock(dst); | 422 SkAutoLockPixels dstLock(dst); |
423 | 423 |
424 U8CPU innerThreshold = (U8CPU)(fInnerThreshold * 0xFF); | 424 U8CPU innerThreshold = (U8CPU)(fInnerThreshold * 0xFF); |
425 U8CPU outerThreshold = (U8CPU)(fOuterThreshold * 0xFF); | 425 U8CPU outerThreshold = (U8CPU)(fOuterThreshold * 0xFF); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 dst); | 465 dst); |
466 } | 466 } |
467 | 467 |
468 #ifndef SK_IGNORE_TO_STRING | 468 #ifndef SK_IGNORE_TO_STRING |
469 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 469 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
470 str->appendf("SkAlphaThresholdImageFilter: ("); | 470 str->appendf("SkAlphaThresholdImageFilter: ("); |
471 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 471 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
472 str->append(")"); | 472 str->append(")"); |
473 } | 473 } |
474 #endif | 474 #endif |
OLD | NEW |