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 "SkMorphologyImageFilter.h" | 8 #include "SkMorphologyImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 getInput(0)->computeFastBounds(src, dst); | 241 getInput(0)->computeFastBounds(src, dst); |
242 } else { | 242 } else { |
243 *dst = src; | 243 *dst = src; |
244 } | 244 } |
245 dst->outset(SkIntToScalar(fRadius.width()), SkIntToScalar(fRadius.height()))
; | 245 dst->outset(SkIntToScalar(fRadius.width()), SkIntToScalar(fRadius.height()))
; |
246 } | 246 } |
247 | 247 |
248 bool SkMorphologyImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix&
ctm, | 248 bool SkMorphologyImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix&
ctm, |
249 SkIRect* dst) const { | 249 SkIRect* dst) const { |
250 SkIRect bounds = src; | 250 SkIRect bounds = src; |
251 if (getInput(0) && !getInput(0)->filterBounds(src, ctm, &bounds)) { | |
252 return false; | |
253 } | |
254 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()), | 251 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()), |
255 SkIntToScalar(this->radius().height())); | 252 SkIntToScalar(this->radius().height())); |
256 ctm.mapVectors(&radius, 1); | 253 ctm.mapVectors(&radius, 1); |
257 bounds.outset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radius.y())); | 254 bounds.outset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radius.y())); |
| 255 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { |
| 256 return false; |
| 257 } |
258 *dst = bounds; | 258 *dst = bounds; |
259 return true; | 259 return true; |
260 } | 260 } |
261 | 261 |
262 SkFlattenable* SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) { | 262 SkFlattenable* SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) { |
263 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 263 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
264 const int width = buffer.readInt(); | 264 const int width = buffer.readInt(); |
265 const int height = buffer.readInt(); | 265 const int height = buffer.readInt(); |
266 return Create(width, height, common.getInput(0), &common.cropRect()); | 266 return Create(width, height, common.getInput(0), &common.cropRect()); |
267 } | 267 } |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 SkBitmap* result, SkIPoint* offset) con
st { | 600 SkBitmap* result, SkIPoint* offset) con
st { |
601 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 601 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
602 } | 602 } |
603 | 603 |
604 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 604 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
605 SkBitmap* result, SkIPoint* offset) cons
t { | 605 SkBitmap* result, SkIPoint* offset) cons
t { |
606 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 606 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
607 } | 607 } |
608 | 608 |
609 #endif | 609 #endif |
OLD | NEW |