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 | 9 |
10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 int pady = passCount * ry; | 523 int pady = passCount * ry; |
524 | 524 |
525 if (margin) { | 525 if (margin) { |
526 margin->set(padx, pady); | 526 margin->set(padx, pady); |
527 } | 527 } |
528 dst->fBounds.set(src.fBounds.fLeft - padx, src.fBounds.fTop - pady, | 528 dst->fBounds.set(src.fBounds.fLeft - padx, src.fBounds.fTop - pady, |
529 src.fBounds.fRight + padx, src.fBounds.fBottom + pady); | 529 src.fBounds.fRight + padx, src.fBounds.fBottom + pady); |
530 | 530 |
531 dst->fRowBytes = dst->fBounds.width(); | 531 dst->fRowBytes = dst->fBounds.width(); |
532 dst->fFormat = SkMask::kA8_Format; | 532 dst->fFormat = SkMask::kA8_Format; |
533 dst->fImage = NULL; | 533 dst->fImage = nullptr; |
534 | 534 |
535 if (src.fImage) { | 535 if (src.fImage) { |
536 size_t dstSize = dst->computeImageSize(); | 536 size_t dstSize = dst->computeImageSize(); |
537 if (0 == dstSize) { | 537 if (0 == dstSize) { |
538 return false; // too big to allocate, abort | 538 return false; // too big to allocate, abort |
539 } | 539 } |
540 | 540 |
541 int sw = src.fBounds.width(); | 541 int sw = src.fBounds.width(); |
542 int sh = src.fBounds.height(); | 542 int sh = src.fBounds.height(); |
543 const uint8_t* sp = src.fImage; | 543 const uint8_t* sp = src.fImage; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 margin->set( pad, pad ); | 747 margin->set( pad, pad ); |
748 } | 748 } |
749 | 749 |
750 dst->fBounds.set(SkScalarRoundToInt(src.fLeft - pad), | 750 dst->fBounds.set(SkScalarRoundToInt(src.fLeft - pad), |
751 SkScalarRoundToInt(src.fTop - pad), | 751 SkScalarRoundToInt(src.fTop - pad), |
752 SkScalarRoundToInt(src.fRight + pad), | 752 SkScalarRoundToInt(src.fRight + pad), |
753 SkScalarRoundToInt(src.fBottom + pad)); | 753 SkScalarRoundToInt(src.fBottom + pad)); |
754 | 754 |
755 dst->fRowBytes = dst->fBounds.width(); | 755 dst->fRowBytes = dst->fBounds.width(); |
756 dst->fFormat = SkMask::kA8_Format; | 756 dst->fFormat = SkMask::kA8_Format; |
757 dst->fImage = NULL; | 757 dst->fImage = nullptr; |
758 | 758 |
759 int sw = SkScalarFloorToInt(src.width()); | 759 int sw = SkScalarFloorToInt(src.width()); |
760 int sh = SkScalarFloorToInt(src.height()); | 760 int sh = SkScalarFloorToInt(src.height()); |
761 | 761 |
762 if (createMode == SkMask::kJustComputeBounds_CreateMode) { | 762 if (createMode == SkMask::kJustComputeBounds_CreateMode) { |
763 if (style == kInner_SkBlurStyle) { | 763 if (style == kInner_SkBlurStyle) { |
764 dst->fBounds.set(SkScalarRoundToInt(src.fLeft), | 764 dst->fBounds.set(SkScalarRoundToInt(src.fLeft), |
765 SkScalarRoundToInt(src.fTop), | 765 SkScalarRoundToInt(src.fTop), |
766 SkScalarRoundToInt(src.fRight), | 766 SkScalarRoundToInt(src.fRight), |
767 SkScalarRoundToInt(src.fBottom)); // restore trimme
d bounds | 767 SkScalarRoundToInt(src.fBottom)); // restore trimme
d bounds |
768 dst->fRowBytes = sw; | 768 dst->fRowBytes = sw; |
769 } | 769 } |
770 return true; | 770 return true; |
771 } | 771 } |
772 uint8_t *profile = NULL; | 772 uint8_t *profile = nullptr; |
773 | 773 |
774 ComputeBlurProfile(sigma, &profile); | 774 ComputeBlurProfile(sigma, &profile); |
775 SkAutoTDeleteArray<uint8_t> ada(profile); | 775 SkAutoTDeleteArray<uint8_t> ada(profile); |
776 | 776 |
777 size_t dstSize = dst->computeImageSize(); | 777 size_t dstSize = dst->computeImageSize(); |
778 if (0 == dstSize) { | 778 if (0 == dstSize) { |
779 return false; // too big to allocate, abort | 779 return false; // too big to allocate, abort |
780 } | 780 } |
781 | 781 |
782 uint8_t* dp = SkMask::AllocImage(dstSize); | 782 uint8_t* dp = SkMask::AllocImage(dstSize); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 int pad = halfWindow; | 883 int pad = halfWindow; |
884 if (margin) { | 884 if (margin) { |
885 margin->set( pad, pad ); | 885 margin->set( pad, pad ); |
886 } | 886 } |
887 | 887 |
888 dst->fBounds = src.fBounds; | 888 dst->fBounds = src.fBounds; |
889 dst->fBounds.outset(pad, pad); | 889 dst->fBounds.outset(pad, pad); |
890 | 890 |
891 dst->fRowBytes = dst->fBounds.width(); | 891 dst->fRowBytes = dst->fBounds.width(); |
892 dst->fFormat = SkMask::kA8_Format; | 892 dst->fFormat = SkMask::kA8_Format; |
893 dst->fImage = NULL; | 893 dst->fImage = nullptr; |
894 | 894 |
895 if (src.fImage) { | 895 if (src.fImage) { |
896 | 896 |
897 size_t dstSize = dst->computeImageSize(); | 897 size_t dstSize = dst->computeImageSize(); |
898 if (0 == dstSize) { | 898 if (0 == dstSize) { |
899 return false; // too big to allocate, abort | 899 return false; // too big to allocate, abort |
900 } | 900 } |
901 | 901 |
902 int srcWidth = src.fBounds.width(); | 902 int srcWidth = src.fBounds.width(); |
903 int srcHeight = src.fBounds.height(); | 903 int srcHeight = src.fBounds.height(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 (void)autoCall.detach(); | 987 (void)autoCall.detach(); |
988 } | 988 } |
989 | 989 |
990 if (style == kInner_SkBlurStyle) { | 990 if (style == kInner_SkBlurStyle) { |
991 dst->fBounds = src.fBounds; // restore trimmed bounds | 991 dst->fBounds = src.fBounds; // restore trimmed bounds |
992 dst->fRowBytes = src.fRowBytes; | 992 dst->fRowBytes = src.fRowBytes; |
993 } | 993 } |
994 | 994 |
995 return true; | 995 return true; |
996 } | 996 } |
OLD | NEW |