| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 "SkImageFilter.h" | 8 #include "SkImageFilter.h" |
| 9 | 9 |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 if (fFlags & kHasTop_CropEdge) { | 80 if (fFlags & kHasTop_CropEdge) { |
| 81 cropped->fTop = devICropR.fTop; | 81 cropped->fTop = devICropR.fTop; |
| 82 } | 82 } |
| 83 if (fFlags & kHasWidth_CropEdge) { | 83 if (fFlags & kHasWidth_CropEdge) { |
| 84 cropped->fRight = cropped->fLeft + devICropR.width(); | 84 cropped->fRight = cropped->fLeft + devICropR.width(); |
| 85 } | 85 } |
| 86 if (fFlags & kHasHeight_CropEdge) { | 86 if (fFlags & kHasHeight_CropEdge) { |
| 87 cropped->fBottom = cropped->fTop + devICropR.height(); | 87 cropped->fBottom = cropped->fTop + devICropR.height(); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 // Intersect against the clip bounds, in case the crop rect has |
| 91 // grown the bounds beyond the original clip. This can happen for |
| 92 // example in tiling, where the clip is much smaller than the filtered |
| 93 // primitive. If we didn't do this, we would be processing the filter |
| 94 // at the full crop rect size in every tile. |
| 90 return cropped->intersect(ctx.clipBounds()); | 95 return cropped->intersect(ctx.clipBounds()); |
| 91 } | 96 } |
| 92 | 97 |
| 93 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 98 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 94 | 99 |
| 95 static int32_t next_image_filter_unique_id() { | 100 static int32_t next_image_filter_unique_id() { |
| 96 static int32_t gImageFilterUniqueID; | 101 static int32_t gImageFilterUniqueID; |
| 97 | 102 |
| 98 // Never return 0. | 103 // Never return 0. |
| 99 int32_t id; | 104 int32_t id; |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 } | 604 } |
| 600 return dev; | 605 return dev; |
| 601 } | 606 } |
| 602 | 607 |
| 603 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const
SkBitmap& src, | 608 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const
SkBitmap& src, |
| 604 const SkImageFilter::Context& ctx, | 609 const SkImageFilter::Context& ctx, |
| 605 SkBitmap* result, SkIPoint* offset) { | 610 SkBitmap* result, SkIPoint* offset) { |
| 606 return fDevice->filterImage(filter, src, ctx, result, offset); | 611 return fDevice->filterImage(filter, src, ctx, result, offset); |
| 607 } | 612 } |
| 608 | 613 |
| OLD | NEW |