| 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 "SkReadBuffer.h" | 5 #include "SkReadBuffer.h" |
| 6 #include "SkWriteBuffer.h" | 6 #include "SkWriteBuffer.h" |
| 7 | 7 |
| 8 // Simple helper canvas that "takes ownership" of the provided device, so that | 8 // Simple helper canvas that "takes ownership" of the provided device, so that |
| 9 // when this canvas goes out of scope, so will its device. Could be replaced | 9 // when this canvas goes out of scope, so will its device. Could be replaced |
| 10 // with the following: | 10 // with the following: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 OwnDeviceCanvas canvas(dev); | 64 OwnDeviceCanvas canvas(dev); |
| 65 | 65 |
| 66 SkRect r = SkRect::MakeWH(SkIntToScalar(src.width()), | 66 SkRect r = SkRect::MakeWH(SkIntToScalar(src.width()), |
| 67 SkIntToScalar(src.height())); | 67 SkIntToScalar(src.height())); |
| 68 canvas.drawBitmapRect(tmp, NULL, r, NULL); | 68 canvas.drawBitmapRect(tmp, NULL, r, NULL); |
| 69 *result = dev->accessBitmap(false); | 69 *result = dev->accessBitmap(false); |
| 70 } | 70 } |
| 71 return true; | 71 return true; |
| 72 } | 72 } |
| 73 | 73 |
| 74 SkFlattenable* SkDownSampleImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 75 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
| 76 return Create(buffer.readScalar(), common.getInput(0)); |
| 77 } |
| 78 |
| 74 void SkDownSampleImageFilter::flatten(SkWriteBuffer& buffer) const { | 79 void SkDownSampleImageFilter::flatten(SkWriteBuffer& buffer) const { |
| 75 this->INHERITED::flatten(buffer); | 80 this->INHERITED::flatten(buffer); |
| 76 | |
| 77 buffer.writeScalar(fScale); | 81 buffer.writeScalar(fScale); |
| 78 } | 82 } |
| 79 | 83 |
| 84 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 80 SkDownSampleImageFilter::SkDownSampleImageFilter(SkReadBuffer& buffer) | 85 SkDownSampleImageFilter::SkDownSampleImageFilter(SkReadBuffer& buffer) |
| 81 : INHERITED(1, buffer) { | 86 : INHERITED(1, buffer) { |
| 82 fScale = buffer.readScalar(); | 87 fScale = buffer.readScalar(); |
| 83 buffer.validate(SkScalarIsFinite(fScale)); | 88 buffer.validate(SkScalarIsFinite(fScale)); |
| 84 } | 89 } |
| 90 #endif |
| OLD | NEW |