Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/effects/SkMorphologyImageFilter.cpp

Issue 137423005: Implement a computeFastBounds() traversal for SkImageFilter. This allows for correct culling of pri… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix Win build; update to ToT Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/effects/SkDropShadowImageFilter.cpp ('k') | src/effects/SkOffsetImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/effects/SkDropShadowImageFilter.cpp ('k') | src/effects/SkOffsetImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698