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

Side by Side Diff: src/core/SkImageFilter.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 | « include/effects/SkOffsetImageFilter.h ('k') | src/core/SkPaint.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 "SkImageFilter.h" 8 #include "SkImageFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 this->onFilterImage(proxy, src, ctm, result, offset); 104 this->onFilterImage(proxy, src, ctm, result, offset);
105 } 105 }
106 106
107 bool SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm, 107 bool SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm,
108 SkIRect* dst) { 108 SkIRect* dst) {
109 SkASSERT(&src); 109 SkASSERT(&src);
110 SkASSERT(dst); 110 SkASSERT(dst);
111 return this->onFilterBounds(src, ctm, dst); 111 return this->onFilterBounds(src, ctm, dst);
112 } 112 }
113 113
114 void SkImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
115 if (0 == fInputCount) {
116 *dst = src;
117 return;
118 }
119 if (this->getInput(0)) {
120 this->getInput(0)->computeFastBounds(src, dst);
121 } else {
122 *dst = src;
123 }
124 for (int i = 1; i < fInputCount; i++) {
125 SkImageFilter* input = this->getInput(i);
126 if (input) {
127 SkRect bounds;
128 input->computeFastBounds(src, &bounds);
129 dst->join(bounds);
130 } else {
131 dst->join(src);
132 }
133 }
134 }
135
114 bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&, 136 bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&,
115 SkBitmap*, SkIPoint*) { 137 SkBitmap*, SkIPoint*) {
116 return false; 138 return false;
117 } 139 }
118 140
119 bool SkImageFilter::canFilterImageGPU() const { 141 bool SkImageFilter::canFilterImageGPU() const {
120 return this->asNewEffect(NULL, NULL, SkMatrix::I(), SkIRect()); 142 return this->asNewEffect(NULL, NULL, SkMatrix::I(), SkIRect());
121 } 143 }
122 144
123 bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMa trix& ctm, 145 bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMa trix& ctm,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 return true; 211 return true;
190 } 212 }
191 213
192 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&, cons t SkIRect&) const { 214 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&, cons t SkIRect&) const {
193 return false; 215 return false;
194 } 216 }
195 217
196 bool SkImageFilter::asColorFilter(SkColorFilter**) const { 218 bool SkImageFilter::asColorFilter(SkColorFilter**) const {
197 return false; 219 return false;
198 } 220 }
OLDNEW
« no previous file with comments | « include/effects/SkOffsetImageFilter.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698