OLD | NEW |
1 | 1 |
2 #include "SkTestImageFilters.h" | 2 #include "SkTestImageFilters.h" |
3 #include "SkCanvas.h" | 3 #include "SkCanvas.h" |
4 #include "SkDevice.h" | 4 #include "SkDevice.h" |
5 #include "SkFlattenableBuffers.h" | 5 #include "SkFlattenableBuffers.h" |
6 | 6 |
7 // Simple helper canvas that "takes ownership" of the provided device, so that | 7 // Simple helper canvas that "takes ownership" of the provided device, so that |
8 // when this canvas goes out of scope, so will its device. Could be replaced | 8 // when this canvas goes out of scope, so will its device. Could be replaced |
9 // with the following: | 9 // with the following: |
10 // | 10 // |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return inner->filterBounds(src, ctm, &tmp) && | 62 return inner->filterBounds(src, ctm, &tmp) && |
63 outer->filterBounds(tmp, ctm, dst); | 63 outer->filterBounds(tmp, ctm, dst); |
64 } | 64 } |
65 | 65 |
66 SkComposeImageFilter::SkComposeImageFilter(SkFlattenableReadBuffer& buffer) : IN
HERITED(buffer) { | 66 SkComposeImageFilter::SkComposeImageFilter(SkFlattenableReadBuffer& buffer) : IN
HERITED(buffer) { |
67 } | 67 } |
68 | 68 |
69 /////////////////////////////////////////////////////////////////////////////// | 69 /////////////////////////////////////////////////////////////////////////////// |
70 | 70 |
71 bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, | 71 bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, |
72 const SkMatrix& matrix, | 72 const SkMatrix&, |
73 SkBitmap* result, SkIPoint*) { | 73 SkBitmap* result, SkIPoint*) { |
74 SkScalar scale = fScale; | 74 SkScalar scale = fScale; |
75 if (scale > SK_Scalar1 || scale <= 0) { | 75 if (scale > SK_Scalar1 || scale <= 0) { |
76 return false; | 76 return false; |
77 } | 77 } |
78 | 78 |
79 int dstW = SkScalarRoundToInt(src.width() * scale); | 79 int dstW = SkScalarRoundToInt(src.width() * scale); |
80 int dstH = SkScalarRoundToInt(src.height() * scale); | 80 int dstH = SkScalarRoundToInt(src.height() * scale); |
81 if (dstW < 1) { | 81 if (dstW < 1) { |
82 dstW = 1; | 82 dstW = 1; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 void SkDownSampleImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 121 void SkDownSampleImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
122 this->INHERITED::flatten(buffer); | 122 this->INHERITED::flatten(buffer); |
123 | 123 |
124 buffer.writeScalar(fScale); | 124 buffer.writeScalar(fScale); |
125 } | 125 } |
126 | 126 |
127 SkDownSampleImageFilter::SkDownSampleImageFilter(SkFlattenableReadBuffer& buffer
) : INHERITED(buffer) { | 127 SkDownSampleImageFilter::SkDownSampleImageFilter(SkFlattenableReadBuffer& buffer
) : INHERITED(buffer) { |
128 fScale = buffer.readScalar(); | 128 fScale = buffer.readScalar(); |
129 } | 129 } |
OLD | NEW |