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

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

Issue 66413007: Implement a speedup for Y-only blurs by transposing. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix _none version of SkBoxBlurGetPlatformProcs. Created 7 years, 1 month 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 | « no previous file | src/opts/SkBlurImage_opts.h » ('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 2011 The Android Open Source Project 2 * Copyright 2011 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 temp.setConfig(dst->config(), dst->width(), dst->height()); 186 temp.setConfig(dst->config(), dst->width(), dst->height());
187 if (!temp.allocPixels()) { 187 if (!temp.allocPixels()) {
188 return false; 188 return false;
189 } 189 }
190 190
191 const SkPMColor* s = src.getAddr32(srcBounds.left(), srcBounds.top()); 191 const SkPMColor* s = src.getAddr32(srcBounds.left(), srcBounds.top());
192 SkPMColor* t = temp.getAddr32(0, 0); 192 SkPMColor* t = temp.getAddr32(0, 0);
193 SkPMColor* d = dst->getAddr32(0, 0); 193 SkPMColor* d = dst->getAddr32(0, 0);
194 int w = dstBounds.width(), h = dstBounds.height(); 194 int w = dstBounds.width(), h = dstBounds.height();
195 int sw = src.rowBytesAsPixels(); 195 int sw = src.rowBytesAsPixels();
196 SkBoxBlurProc boxBlurX, boxBlurY, boxBlurXY; 196 SkBoxBlurProc boxBlurX, boxBlurY, boxBlurXY, boxBlurYX;
197 if (!SkBoxBlurGetPlatformProcs(&boxBlurX, &boxBlurY, &boxBlurXY)) { 197 if (!SkBoxBlurGetPlatformProcs(&boxBlurX, &boxBlurY, &boxBlurXY, &boxBlurYX) ) {
198 boxBlurX = boxBlur<kX, kX>; 198 boxBlurX = boxBlur<kX, kX>;
199 boxBlurY = boxBlur<kY, kY>; 199 boxBlurY = boxBlur<kY, kY>;
200 boxBlurXY = boxBlur<kX, kY>; 200 boxBlurXY = boxBlur<kX, kY>;
201 boxBlurYX = boxBlur<kY, kX>;
201 } 202 }
202 203
203 if (kernelSizeX > 0 && kernelSizeY > 0) { 204 if (kernelSizeX > 0 && kernelSizeY > 0) {
204 #ifndef SK_DISABLE_BLUR_DIVISION_OPTIMIZATION 205 #ifndef SK_DISABLE_BLUR_DIVISION_OPTIMIZATION
mtklein 2013/11/11 17:43:23 Either the new y-only transposed version needs to
205 boxBlurX(s, sw, t, kernelSizeX, lowOffsetX, highOffsetX, w, h); 206 boxBlurX(s, sw, t, kernelSizeX, lowOffsetX, highOffsetX, w, h);
206 boxBlurX(t, w, d, kernelSizeX, highOffsetX, lowOffsetX, w, h); 207 boxBlurX(t, w, d, kernelSizeX, highOffsetX, lowOffsetX, w, h);
207 boxBlurXY(d, w, t, kernelSizeX3, highOffsetX, highOffsetX, w, h); 208 boxBlurXY(d, w, t, kernelSizeX3, highOffsetX, highOffsetX, w, h);
208 boxBlurX(t, h, d, kernelSizeY, lowOffsetY, highOffsetY, h, w); 209 boxBlurX(t, h, d, kernelSizeY, lowOffsetY, highOffsetY, h, w);
209 boxBlurX(d, h, t, kernelSizeY, highOffsetY, lowOffsetY, h, w); 210 boxBlurX(d, h, t, kernelSizeY, highOffsetY, lowOffsetY, h, w);
210 boxBlurXY(t, h, d, kernelSizeY3, highOffsetY, highOffsetY, h, w); 211 boxBlurXY(t, h, d, kernelSizeY3, highOffsetY, highOffsetY, h, w);
211 #else 212 #else
212 boxBlurX(s, sw, t, kernelSizeX, lowOffsetX, highOffsetX, w, h); 213 boxBlurX(s, sw, t, kernelSizeX, lowOffsetX, highOffsetX, w, h);
213 boxBlurY(t, w, d, kernelSizeY, lowOffsetY, highOffsetY, h, w); 214 boxBlurY(t, w, d, kernelSizeY, lowOffsetY, highOffsetY, h, w);
214 boxBlurX(d, w, t, kernelSizeX, highOffsetX, lowOffsetX, w, h); 215 boxBlurX(d, w, t, kernelSizeX, highOffsetX, lowOffsetX, w, h);
215 boxBlurY(t, w, d, kernelSizeY, highOffsetY, lowOffsetY, h, w); 216 boxBlurY(t, w, d, kernelSizeY, highOffsetY, lowOffsetY, h, w);
216 boxBlurX(d, w, t, kernelSizeX3, highOffsetX, highOffsetX, w, h); 217 boxBlurX(d, w, t, kernelSizeX3, highOffsetX, highOffsetX, w, h);
217 boxBlurY(t, w, d, kernelSizeY3, highOffsetY, highOffsetY, h, w); 218 boxBlurY(t, w, d, kernelSizeY3, highOffsetY, highOffsetY, h, w);
218 #endif 219 #endif
219 } else if (kernelSizeX > 0) { 220 } else if (kernelSizeX > 0) {
220 boxBlurX(s, sw, d, kernelSizeX, lowOffsetX, highOffsetX, w, h); 221 boxBlurX(s, sw, d, kernelSizeX, lowOffsetX, highOffsetX, w, h);
221 boxBlurX(d, w, t, kernelSizeX, highOffsetX, lowOffsetX, w, h); 222 boxBlurX(d, w, t, kernelSizeX, highOffsetX, lowOffsetX, w, h);
222 boxBlurX(t, w, d, kernelSizeX3, highOffsetX, highOffsetX, w, h); 223 boxBlurX(t, w, d, kernelSizeX3, highOffsetX, highOffsetX, w, h);
223 } else if (kernelSizeY > 0) { 224 } else if (kernelSizeY > 0) {
224 boxBlurY(s, sw, d, kernelSizeY, lowOffsetY, highOffsetY, h, w); 225 boxBlurYX(s, sw, d, kernelSizeY, lowOffsetY, highOffsetY, h, w);
225 boxBlurY(d, w, t, kernelSizeY, highOffsetY, lowOffsetY, h, w); 226 boxBlurX(d, h, t, kernelSizeY, highOffsetY, lowOffsetY, h, w);
226 boxBlurY(t, w, d, kernelSizeY3, highOffsetY, highOffsetY, h, w); 227 boxBlurXY(t, h, d, kernelSizeY3, highOffsetY, highOffsetY, h, w);
227 } 228 }
228 offset->fX += srcBounds.fLeft; 229 offset->fX += srcBounds.fLeft;
229 offset->fY += srcBounds.fTop; 230 offset->fY += srcBounds.fTop;
230 return true; 231 return true;
231 } 232 }
232 233
233 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm, 234 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
234 SkBitmap* result, SkIPoint* offset) { 235 SkBitmap* result, SkIPoint* offset) {
235 #if SK_SUPPORT_GPU 236 #if SK_SUPPORT_GPU
236 SkBitmap input; 237 SkBitmap input;
(...skipping 14 matching lines...) Expand all
251 fSigma.width(), 252 fSigma.width(),
252 fSigma.height())); 253 fSigma.height()));
253 offset->fX += rect.fLeft; 254 offset->fX += rect.fLeft;
254 offset->fY += rect.fTop; 255 offset->fY += rect.fTop;
255 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult); 256 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult);
256 #else 257 #else
257 SkDEBUGFAIL("Should not call in GPU-less build"); 258 SkDEBUGFAIL("Should not call in GPU-less build");
258 return false; 259 return false;
259 #endif 260 #endif
260 } 261 }
OLDNEW
« no previous file with comments | « no previous file | src/opts/SkBlurImage_opts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698