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

Side by Side Diff: src/core/SkDevice.cpp

Issue 1308703007: Fix filter primitive bounds computations. (Closed) Base URL: https://skia.googlesource.com/skia.git@saveLayer-bounds-not-transformed
Patch Set: Fix comment style; remove useless param names Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 "SkColorFilter.h" 8 #include "SkColorFilter.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 404
405 void SkBaseDevice::drawBitmapAsSprite(const SkDraw& draw, const SkBitmap& bitmap , int x, int y, 405 void SkBaseDevice::drawBitmapAsSprite(const SkDraw& draw, const SkBitmap& bitmap , int x, int y,
406 const SkPaint& paint) { 406 const SkPaint& paint) {
407 SkImageFilter* filter = paint.getImageFilter(); 407 SkImageFilter* filter = paint.getImageFilter();
408 if (filter && !this->canHandleImageFilter(filter)) { 408 if (filter && !this->canHandleImageFilter(filter)) {
409 SkImageFilter::DeviceProxy proxy(this); 409 SkImageFilter::DeviceProxy proxy(this);
410 SkBitmap dst; 410 SkBitmap dst;
411 SkIPoint offset = SkIPoint::Make(0, 0); 411 SkIPoint offset = SkIPoint::Make(0, 0);
412 SkMatrix matrix = *draw.fMatrix; 412 SkMatrix matrix = *draw.fMatrix;
413 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); 413 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
414 #ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
414 const SkIRect clipBounds = bitmap.bounds(); 415 const SkIRect clipBounds = bitmap.bounds();
416 #else
417 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y);
418 #endif
415 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); 419 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache());
416 SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), 420 SkImageFilter::Context ctx(matrix, clipBounds, cache.get(),
417 SkImageFilter::kApprox_SizeConstraint); 421 SkImageFilter::kApprox_SizeConstraint);
418 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { 422 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) {
419 SkPaint tmpUnfiltered(paint); 423 SkPaint tmpUnfiltered(paint);
420 tmpUnfiltered.setImageFilter(nullptr); 424 tmpUnfiltered.setImageFilter(nullptr);
421 this->drawSprite(draw, dst, x + offset.x(), y + offset.y(), tmpUnfil tered); 425 this->drawSprite(draw, dst, x + offset.x(), y + offset.y(), tmpUnfil tered);
422 } 426 }
423 } else { 427 } else {
424 this->drawSprite(draw, bitmap, x, y, paint); 428 this->drawSprite(draw, bitmap, x, y, paint);
(...skipping 10 matching lines...) Expand all
435 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() 439 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry()
436 || this->onShouldDisableLCD(paint)) { 440 || this->onShouldDisableLCD(paint)) {
437 441
438 flags &= ~SkPaint::kLCDRenderText_Flag; 442 flags &= ~SkPaint::kLCDRenderText_Flag;
439 flags |= SkPaint::kGenA8FromLCD_Flag; 443 flags |= SkPaint::kGenA8FromLCD_Flag;
440 } 444 }
441 445
442 return flags; 446 return flags;
443 } 447 }
444 448
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkImageFilter.cpp » ('j') | src/core/SkRecordDraw.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698