| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 The Android Open Source Project | 2 * Copyright 2013 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 "SkPictureImageFilter.h" | 8 #include "SkPictureImageFilter.h" |
| 9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 uint32_t uniqueID) | 23 uint32_t uniqueID) |
| 24 : INHERITED(0, 0, NULL, uniqueID) | 24 : INHERITED(0, 0, NULL, uniqueID) |
| 25 , fPicture(SkSafeRef(picture)) | 25 , fPicture(SkSafeRef(picture)) |
| 26 , fCropRect(cropRect) { | 26 , fCropRect(cropRect) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 SkPictureImageFilter::~SkPictureImageFilter() { | 29 SkPictureImageFilter::~SkPictureImageFilter() { |
| 30 SkSafeUnref(fPicture); | 30 SkSafeUnref(fPicture); |
| 31 } | 31 } |
| 32 | 32 |
| 33 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 34 SkPictureImageFilter::SkPictureImageFilter(SkReadBuffer& buffer) |
| 35 : INHERITED(0, buffer), |
| 36 fPicture(NULL) { |
| 37 if (!buffer.isCrossProcess()) { |
| 38 if (buffer.readBool()) { |
| 39 fPicture = SkPicture::CreateFromBuffer(buffer); |
| 40 } |
| 41 } else { |
| 42 buffer.validate(!buffer.readBool()); |
| 43 } |
| 44 buffer.readRect(&fCropRect); |
| 45 } |
| 46 #endif |
| 47 |
| 33 SkFlattenable* SkPictureImageFilter::CreateProc(SkReadBuffer& buffer) { | 48 SkFlattenable* SkPictureImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 34 SkAutoTUnref<SkPicture> picture; | 49 SkAutoTUnref<SkPicture> picture; |
| 35 SkRect cropRect; | 50 SkRect cropRect; |
| 36 | 51 |
| 37 if (!buffer.isCrossProcess()) { | 52 if (!buffer.isCrossProcess()) { |
| 38 if (buffer.readBool()) { | 53 if (buffer.readBool()) { |
| 39 picture.reset(SkPicture::CreateFromBuffer(buffer)); | 54 picture.reset(SkPicture::CreateFromBuffer(buffer)); |
| 40 } | 55 } |
| 41 } else { | 56 } else { |
| 42 buffer.validate(!buffer.readBool()); | 57 buffer.validate(!buffer.readBool()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 105 |
| 91 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); | 106 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); |
| 92 canvas.concat(ctx.ctm()); | 107 canvas.concat(ctx.ctm()); |
| 93 canvas.drawPicture(fPicture); | 108 canvas.drawPicture(fPicture); |
| 94 | 109 |
| 95 *result = device.get()->accessBitmap(false); | 110 *result = device.get()->accessBitmap(false); |
| 96 offset->fX = bounds.fLeft; | 111 offset->fX = bounds.fLeft; |
| 97 offset->fY = bounds.fTop; | 112 offset->fY = bounds.fTop; |
| 98 return true; | 113 return true; |
| 99 } | 114 } |
| OLD | NEW |