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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 SkBitmap* result, SkIPoint* offset) con
st { | 62 SkBitmap* result, SkIPoint* offset) con
st { |
63 if (!fPicture) { | 63 if (!fPicture) { |
64 offset->fX = offset->fY = 0; | 64 offset->fX = offset->fY = 0; |
65 return true; | 65 return true; |
66 } | 66 } |
67 | 67 |
68 SkRect floatBounds; | 68 SkRect floatBounds; |
69 SkIRect bounds; | 69 SkIRect bounds; |
70 ctx.ctm().mapRect(&floatBounds, fCropRect); | 70 ctx.ctm().mapRect(&floatBounds, fCropRect); |
71 floatBounds.roundOut(&bounds); | 71 floatBounds.roundOut(&bounds); |
| 72 if (!bounds.intersect(ctx.clipBounds())) { |
| 73 return false; |
| 74 } |
72 | 75 |
73 if (bounds.isEmpty()) { | 76 if (bounds.isEmpty()) { |
74 offset->fX = offset->fY = 0; | 77 offset->fX = offset->fY = 0; |
75 return true; | 78 return true; |
76 } | 79 } |
77 | 80 |
78 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); | 81 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); |
79 if (NULL == device.get()) { | 82 if (NULL == device.get()) { |
80 return false; | 83 return false; |
81 } | 84 } |
(...skipping 10 matching lines...) Expand all Loading... |
92 offset->fY = bounds.fTop; | 95 offset->fY = bounds.fTop; |
93 return true; | 96 return true; |
94 } | 97 } |
95 | 98 |
96 bool SkPictureImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ct
m, | 99 bool SkPictureImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ct
m, |
97 SkIRect* dst) const { | 100 SkIRect* dst) const { |
98 *dst = src; | 101 *dst = src; |
99 return true; | 102 return true; |
100 } | 103 } |
101 | 104 |
OLD | NEW |