| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 void SkMorphologyImageFilter::computeFastBounds(const SkRect& src, SkRect* dst)
const { | 243 void SkMorphologyImageFilter::computeFastBounds(const SkRect& src, SkRect* dst)
const { |
| 244 if (getInput(0)) { | 244 if (getInput(0)) { |
| 245 getInput(0)->computeFastBounds(src, dst); | 245 getInput(0)->computeFastBounds(src, dst); |
| 246 } else { | 246 } else { |
| 247 *dst = src; | 247 *dst = src; |
| 248 } | 248 } |
| 249 dst->outset(SkIntToScalar(fRadius.width()), SkIntToScalar(fRadius.height()))
; | 249 dst->outset(SkIntToScalar(fRadius.width()), SkIntToScalar(fRadius.height()))
; |
| 250 } | 250 } |
| 251 | 251 |
| 252 bool SkMorphologyImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix&
ctm, |
| 253 SkIRect* dst) const { |
| 254 SkIRect bounds = src; |
| 255 if (getInput(0) && !getInput(0)->filterBounds(src, ctm, &bounds)) { |
| 256 return false; |
| 257 } |
| 258 SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()), |
| 259 SkIntToScalar(this->radius().height())); |
| 260 ctm.mapVectors(&radius, 1); |
| 261 bounds.outset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radius.y())); |
| 262 *dst = bounds; |
| 263 return true; |
| 264 } |
| 265 |
| 252 #if SK_SUPPORT_GPU | 266 #if SK_SUPPORT_GPU |
| 253 | 267 |
| 254 /////////////////////////////////////////////////////////////////////////////// | 268 /////////////////////////////////////////////////////////////////////////////// |
| 255 | 269 |
| 256 class GrGLMorphologyEffect; | 270 class GrGLMorphologyEffect; |
| 257 | 271 |
| 258 /** | 272 /** |
| 259 * Morphology effects. Depending upon the type of morphology, either the | 273 * Morphology effects. Depending upon the type of morphology, either the |
| 260 * component-wise min (Erode_Type) or max (Dilate_Type) of all pixels in the | 274 * component-wise min (Erode_Type) or max (Dilate_Type) of all pixels in the |
| 261 * kernel is selected as the new color. The new color is modulated by the input | 275 * kernel is selected as the new color. The new color is modulated by the input |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 SkBitmap* result, SkIPoint* offset) { | 585 SkBitmap* result, SkIPoint* offset) { |
| 572 return this->filterImageGPUGeneric(true, proxy, src, ctm, result, offset); | 586 return this->filterImageGPUGeneric(true, proxy, src, ctm, result, offset); |
| 573 } | 587 } |
| 574 | 588 |
| 575 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
SkMatrix& ctm, | 589 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
SkMatrix& ctm, |
| 576 SkBitmap* result, SkIPoint* offset) { | 590 SkBitmap* result, SkIPoint* offset) { |
| 577 return this->filterImageGPUGeneric(false, proxy, src, ctm, result, offset); | 591 return this->filterImageGPUGeneric(false, proxy, src, ctm, result, offset); |
| 578 } | 592 } |
| 579 | 593 |
| 580 #endif | 594 #endif |
| OLD | NEW |