OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
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 "SkMorphologyImageFilter.h" | 8 #include "SkMorphologyImageFilter.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 | 66 |
67 SkIRect SkMorphologyImageFilter::onFilterNodeBounds(const SkIRect& src, const Sk
Matrix& ctm, | 67 SkIRect SkMorphologyImageFilter::onFilterNodeBounds(const SkIRect& src, const Sk
Matrix& ctm, |
68 MapDirection) const { | 68 MapDirection) const { |
69 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()), | 69 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()), |
70 SkIntToScalar(this->radius().height())); | 70 SkIntToScalar(this->radius().height())); |
71 ctm.mapVectors(&radius, 1); | 71 ctm.mapVectors(&radius, 1); |
72 return src.makeOutset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radiu
s.y())); | 72 return src.makeOutset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radiu
s.y())); |
73 } | 73 } |
74 | 74 |
75 SkFlattenable* SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) { | 75 sk_sp<SkFlattenable> SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) { |
76 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 76 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
77 const int width = buffer.readInt(); | 77 const int width = buffer.readInt(); |
78 const int height = buffer.readInt(); | 78 const int height = buffer.readInt(); |
79 return Create(width, height, common.getInput(0).get(), &common.cropRect()); | 79 return sk_sp<SkFlattenable>(Create(width, height, common.getInput(0).get(), |
| 80 &common.cropRect())); |
80 } | 81 } |
81 | 82 |
82 SkFlattenable* SkDilateImageFilter::CreateProc(SkReadBuffer& buffer) { | 83 sk_sp<SkFlattenable> SkDilateImageFilter::CreateProc(SkReadBuffer& buffer) { |
83 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 84 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
84 const int width = buffer.readInt(); | 85 const int width = buffer.readInt(); |
85 const int height = buffer.readInt(); | 86 const int height = buffer.readInt(); |
86 return Create(width, height, common.getInput(0).get(), &common.cropRect()); | 87 return sk_sp<SkFlattenable>(Create(width, height, common.getInput(0).get(), |
| 88 &common.cropRect())); |
87 } | 89 } |
88 | 90 |
89 #ifndef SK_IGNORE_TO_STRING | 91 #ifndef SK_IGNORE_TO_STRING |
90 void SkErodeImageFilter::toString(SkString* str) const { | 92 void SkErodeImageFilter::toString(SkString* str) const { |
91 str->appendf("SkErodeImageFilter: ("); | 93 str->appendf("SkErodeImageFilter: ("); |
92 str->appendf("radius: (%d,%d)", this->radius().fWidth, this->radius().fHeigh
t); | 94 str->appendf("radius: (%d,%d)", this->radius().fWidth, this->radius().fHeigh
t); |
93 str->append(")"); | 95 str->append(")"); |
94 } | 96 } |
95 #endif | 97 #endif |
96 | 98 |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 inputPixmap.rowBytesAsPixels(), | 616 inputPixmap.rowBytesAsPixels(), |
615 &dst, height, srcBounds); | 617 &dst, height, srcBounds); |
616 } | 618 } |
617 offset->fX = bounds.left(); | 619 offset->fX = bounds.left(); |
618 offset->fY = bounds.top(); | 620 offset->fY = bounds.top(); |
619 | 621 |
620 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), | 622 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), |
621 SkIRect::MakeWH(bounds.width(), bounds
.height()), | 623 SkIRect::MakeWH(bounds.width(), bounds
.height()), |
622 dst); | 624 dst); |
623 } | 625 } |
OLD | NEW |