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" |
11 #include "SkReadBuffer.h" | 11 #include "SkReadBuffer.h" |
12 #include "SkWriteBuffer.h" | 12 #include "SkWriteBuffer.h" |
13 #include "SkValidationUtils.h" | 13 #include "SkValidationUtils.h" |
14 | 14 |
15 SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture, uint32_t un
iqueID) | 15 SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture, uint32_t un
iqueID) |
16 : INHERITED(0, 0, NULL, uniqueID), | 16 : INHERITED(0, 0, NULL, uniqueID) |
17 fPicture(picture), | 17 , fPicture(SkSafeRef(picture)) |
18 fCropRect(SkRect::MakeWH(picture ? SkIntToScalar(picture->width()) : 0, | 18 , fCropRect(NULL != picture ? picture->cullRect() : SkRect::MakeEmpty()) { |
19 picture ? SkIntToScalar(picture->height()) : 0)) { | |
20 SkSafeRef(fPicture); | |
21 } | 19 } |
22 | 20 |
23 SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture, const SkRec
t& cropRect, | 21 SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture, const SkRec
t& cropRect, |
24 uint32_t uniqueID) | 22 uint32_t uniqueID) |
25 : INHERITED(0, 0, NULL, uniqueID), | 23 : INHERITED(0, 0, NULL, uniqueID) |
26 fPicture(picture), | 24 , fPicture(SkSafeRef(picture)) |
27 fCropRect(cropRect) { | 25 , fCropRect(cropRect) { |
28 SkSafeRef(fPicture); | |
29 } | 26 } |
30 | 27 |
31 SkPictureImageFilter::~SkPictureImageFilter() { | 28 SkPictureImageFilter::~SkPictureImageFilter() { |
32 SkSafeUnref(fPicture); | 29 SkSafeUnref(fPicture); |
33 } | 30 } |
34 | 31 |
35 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | 32 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
36 SkPictureImageFilter::SkPictureImageFilter(SkReadBuffer& buffer) | 33 SkPictureImageFilter::SkPictureImageFilter(SkReadBuffer& buffer) |
37 : INHERITED(0, buffer), | 34 : INHERITED(0, buffer), |
38 fPicture(NULL) { | 35 fPicture(NULL) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 offset->fY = bounds.fTop; | 110 offset->fY = bounds.fTop; |
114 return true; | 111 return true; |
115 } | 112 } |
116 | 113 |
117 bool SkPictureImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ct
m, | 114 bool SkPictureImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ct
m, |
118 SkIRect* dst) const { | 115 SkIRect* dst) const { |
119 *dst = src; | 116 *dst = src; |
120 return true; | 117 return true; |
121 } | 118 } |
122 | 119 |
OLD | NEW |