OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 void SkBlurMaskFilterImpl::computeFastBounds(const SkRect& src, | 477 void SkBlurMaskFilterImpl::computeFastBounds(const SkRect& src, |
478 SkRect* dst) const { | 478 SkRect* dst) const { |
479 SkScalar pad = 3.0f * fSigma; | 479 SkScalar pad = 3.0f * fSigma; |
480 | 480 |
481 dst->set(src.fLeft - pad, src.fTop - pad, | 481 dst->set(src.fLeft - pad, src.fTop - pad, |
482 src.fRight + pad, src.fBottom + pad); | 482 src.fRight + pad, src.fBottom + pad); |
483 } | 483 } |
484 | 484 |
485 SkBlurMaskFilterImpl::SkBlurMaskFilterImpl(SkFlattenableReadBuffer& buffer) | 485 SkBlurMaskFilterImpl::SkBlurMaskFilterImpl(SkFlattenableReadBuffer& buffer) |
486 : SkMaskFilter(buffer) { | 486 : SkMaskFilter(buffer) { |
487 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO
O | 487 fSigma = buffer.readScalar(); |
488 // TODO: when the skps are recaptured at > v15 the SkScalarAbs can be remove
d | |
489 #endif | |
490 fSigma = SkScalarAbs(buffer.readScalar()); | |
491 fBlurStyle = (SkBlurMaskFilter::BlurStyle)buffer.readInt(); | 488 fBlurStyle = (SkBlurMaskFilter::BlurStyle)buffer.readInt(); |
492 fBlurFlags = buffer.readUInt() & SkBlurMaskFilter::kAll_BlurFlag; | 489 fBlurFlags = buffer.readUInt() & SkBlurMaskFilter::kAll_BlurFlag; |
493 SkASSERT(fSigma >= 0); | 490 SkASSERT(fSigma >= 0); |
494 SkASSERT((unsigned)fBlurStyle < SkBlurMaskFilter::kBlurStyleCount); | 491 SkASSERT((unsigned)fBlurStyle < SkBlurMaskFilter::kBlurStyleCount); |
495 } | 492 } |
496 | 493 |
497 void SkBlurMaskFilterImpl::flatten(SkFlattenableWriteBuffer& buffer) const { | 494 void SkBlurMaskFilterImpl::flatten(SkFlattenableWriteBuffer& buffer) const { |
498 this->INHERITED::flatten(buffer); | 495 this->INHERITED::flatten(buffer); |
499 buffer.writeScalar(fSigma); | 496 buffer.writeScalar(fSigma); |
500 buffer.writeInt(fBlurStyle); | 497 buffer.writeInt(fBlurStyle); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 } else { | 614 } else { |
618 str->append("None"); | 615 str->append("None"); |
619 } | 616 } |
620 str->append("))"); | 617 str->append("))"); |
621 } | 618 } |
622 #endif | 619 #endif |
623 | 620 |
624 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 621 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
625 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 622 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
626 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 623 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |