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

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

Issue 112803004: Make SkImageFilter crop rects relative to the primitive origin, instead of relative to their parent (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove a useless zero. 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
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 "SkMatrixConvolutionImageFilter.h" 8 #include "SkMatrixConvolutionImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 dstRow[x] = SkUnPreMultiply::PMColorToColor(srcRow[x]); 245 dstRow[x] = SkUnPreMultiply::PMColorToColor(srcRow[x]);
246 } 246 }
247 } 247 }
248 return result; 248 return result;
249 } 249 }
250 250
251 bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy, 251 bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy,
252 const SkBitmap& source, 252 const SkBitmap& source,
253 const SkMatrix& matrix, 253 const SkMatrix& matrix,
254 SkBitmap* result, 254 SkBitmap* result,
255 SkIPoint* loc) { 255 SkIPoint* offset) {
256 SkBitmap src = source; 256 SkBitmap src = source;
257 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, lo c)) { 257 SkIPoint srcOffset = SkIPoint::Make(0, 0);
258 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &s rcOffset)) {
258 return false; 259 return false;
259 } 260 }
260 261
261 if (src.config() != SkBitmap::kARGB_8888_Config) { 262 if (src.config() != SkBitmap::kARGB_8888_Config) {
262 return false; 263 return false;
263 } 264 }
264 265
265 SkIRect bounds; 266 SkIRect bounds;
266 src.getBounds(&bounds); 267 src.getBounds(&bounds);
268 bounds.offset(srcOffset);
267 if (!this->applyCropRect(&bounds, matrix)) { 269 if (!this->applyCropRect(&bounds, matrix)) {
268 return false; 270 return false;
269 } 271 }
270 272
271 if (!fConvolveAlpha && !src.isOpaque()) { 273 if (!fConvolveAlpha && !src.isOpaque()) {
272 src = unpremultiplyBitmap(src); 274 src = unpremultiplyBitmap(src);
273 } 275 }
274 276
275 SkAutoLockPixels alp(src); 277 SkAutoLockPixels alp(src);
276 if (!src.getPixels()) { 278 if (!src.getPixels()) {
(...skipping 15 matching lines...) Expand all
292 bounds.right(), bounds.bottom()); 294 bounds.right(), bounds.bottom());
293 SkIRect left = SkIRect::MakeLTRB(bounds.left(), interior.top(), 295 SkIRect left = SkIRect::MakeLTRB(bounds.left(), interior.top(),
294 interior.left(), interior.bottom()); 296 interior.left(), interior.bottom());
295 SkIRect right = SkIRect::MakeLTRB(interior.right(), interior.top(), 297 SkIRect right = SkIRect::MakeLTRB(interior.right(), interior.top(),
296 bounds.right(), interior.bottom()); 298 bounds.right(), interior.bottom());
297 filterBorderPixels(src, result, top, bounds); 299 filterBorderPixels(src, result, top, bounds);
298 filterBorderPixels(src, result, left, bounds); 300 filterBorderPixels(src, result, left, bounds);
299 filterInteriorPixels(src, result, interior, bounds); 301 filterInteriorPixels(src, result, interior, bounds);
300 filterBorderPixels(src, result, right, bounds); 302 filterBorderPixels(src, result, right, bounds);
301 filterBorderPixels(src, result, bottom, bounds); 303 filterBorderPixels(src, result, bottom, bounds);
302 loc->fX += bounds.fLeft; 304 offset->fX = bounds.fLeft;
303 loc->fY += bounds.fTop; 305 offset->fY = bounds.fTop;
304 return true; 306 return true;
305 } 307 }
306 308
307 #if SK_SUPPORT_GPU 309 #if SK_SUPPORT_GPU
308 310
309 /////////////////////////////////////////////////////////////////////////////// 311 ///////////////////////////////////////////////////////////////////////////////
310 312
311 class GrGLMatrixConvolutionEffect; 313 class GrGLMatrixConvolutionEffect;
312 314
313 class GrMatrixConvolutionEffect : public GrSingleTextureEffect { 315 class GrMatrixConvolutionEffect : public GrSingleTextureEffect {
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 fBias, 662 fBias,
661 fTarget, 663 fTarget,
662 fTileMode, 664 fTileMode,
663 fConvolveAlpha); 665 fConvolveAlpha);
664 return true; 666 return true;
665 } 667 }
666 668
667 /////////////////////////////////////////////////////////////////////////////// 669 ///////////////////////////////////////////////////////////////////////////////
668 670
669 #endif 671 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698