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 | |
48 SkFlattenable* SkPictureImageFilter::CreateProc(SkReadBuffer& buffer) { | 33 SkFlattenable* SkPictureImageFilter::CreateProc(SkReadBuffer& buffer) { |
49 SkAutoTUnref<SkPicture> picture; | 34 SkAutoTUnref<SkPicture> picture; |
50 SkRect cropRect; | 35 SkRect cropRect; |
51 | 36 |
52 if (!buffer.isCrossProcess()) { | 37 if (!buffer.isCrossProcess()) { |
53 if (buffer.readBool()) { | 38 if (buffer.readBool()) { |
54 picture.reset(SkPicture::CreateFromBuffer(buffer)); | 39 picture.reset(SkPicture::CreateFromBuffer(buffer)); |
55 } | 40 } |
56 } else { | 41 } else { |
57 buffer.validate(!buffer.readBool()); | 42 buffer.validate(!buffer.readBool()); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 90 |
106 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); | 91 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); |
107 canvas.concat(ctx.ctm()); | 92 canvas.concat(ctx.ctm()); |
108 canvas.drawPicture(fPicture); | 93 canvas.drawPicture(fPicture); |
109 | 94 |
110 *result = device.get()->accessBitmap(false); | 95 *result = device.get()->accessBitmap(false); |
111 offset->fX = bounds.fLeft; | 96 offset->fX = bounds.fLeft; |
112 offset->fY = bounds.fTop; | 97 offset->fY = bounds.fTop; |
113 return true; | 98 return true; |
114 } | 99 } |
OLD | NEW |