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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 if (!dilateXProc) { | 232 if (!dilateXProc) { |
233 dilateXProc = dilate<kX>; | 233 dilateXProc = dilate<kX>; |
234 } | 234 } |
235 Proc dilateYProc = SkMorphologyGetPlatformProc(kDilateY_SkMorphologyProcType
); | 235 Proc dilateYProc = SkMorphologyGetPlatformProc(kDilateY_SkMorphologyProcType
); |
236 if (!dilateYProc) { | 236 if (!dilateYProc) { |
237 dilateYProc = dilate<kY>; | 237 dilateYProc = dilate<kY>; |
238 } | 238 } |
239 return this->filterImageGeneric(dilateXProc, dilateYProc, proxy, source, ctm
, dst, offset); | 239 return this->filterImageGeneric(dilateXProc, dilateYProc, proxy, source, ctm
, dst, offset); |
240 } | 240 } |
241 | 241 |
| 242 void SkMorphologyImageFilter::computeFastBounds(const SkRect& src, SkRect* dst)
const { |
| 243 if (getInput(0)) { |
| 244 getInput(0)->computeFastBounds(src, dst); |
| 245 } else { |
| 246 *dst = src; |
| 247 } |
| 248 dst->outset(SkIntToScalar(fRadius.width()), SkIntToScalar(fRadius.height()))
; |
| 249 } |
| 250 |
242 #if SK_SUPPORT_GPU | 251 #if SK_SUPPORT_GPU |
243 | 252 |
244 /////////////////////////////////////////////////////////////////////////////// | 253 /////////////////////////////////////////////////////////////////////////////// |
245 | 254 |
246 class GrGLMorphologyEffect; | 255 class GrGLMorphologyEffect; |
247 | 256 |
248 /** | 257 /** |
249 * Morphology effects. Depending upon the type of morphology, either the | 258 * Morphology effects. Depending upon the type of morphology, either the |
250 * component-wise min (Erode_Type) or max (Dilate_Type) of all pixels in the | 259 * component-wise min (Erode_Type) or max (Dilate_Type) of all pixels in the |
251 * kernel is selected as the new color. The new color is modulated by the input | 260 * 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... |
561 SkBitmap* result, SkIPoint* offset) { | 570 SkBitmap* result, SkIPoint* offset) { |
562 return this->filterImageGPUGeneric(true, proxy, src, ctm, result, offset); | 571 return this->filterImageGPUGeneric(true, proxy, src, ctm, result, offset); |
563 } | 572 } |
564 | 573 |
565 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
SkMatrix& ctm, | 574 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
SkMatrix& ctm, |
566 SkBitmap* result, SkIPoint* offset) { | 575 SkBitmap* result, SkIPoint* offset) { |
567 return this->filterImageGPUGeneric(false, proxy, src, ctm, result, offset); | 576 return this->filterImageGPUGeneric(false, proxy, src, ctm, result, offset); |
568 } | 577 } |
569 | 578 |
570 #endif | 579 #endif |
OLD | NEW |