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

Unified Diff: src/core/SkImageFilter.cpp

Issue 1232873002: Fix for partially-specified crop rects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix 100-cols Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/ImageFilterTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 8a3fbb4485ebe3f1495a5fe6f24a0878f47acd45..178d892b610235be8583b28e8648e6c2f27fd39c 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -302,10 +302,18 @@ bool SkImageFilter::applyCropRect(const Context& ctx, const SkBitmap& src,
ctx.ctm().mapRect(&cropRect, fCropRect.rect());
const SkIRect cropRectI = cropRect.roundOut();
uint32_t flags = fCropRect.flags();
- if (flags & CropRect::kHasLeft_CropEdge) srcBounds.fLeft = cropRectI.fLeft;
- if (flags & CropRect::kHasTop_CropEdge) srcBounds.fTop = cropRectI.fTop;
- if (flags & CropRect::kHasRight_CropEdge) srcBounds.fRight = cropRectI.fRight;
- if (flags & CropRect::kHasBottom_CropEdge) srcBounds.fBottom = cropRectI.fBottom;
+ if (flags & CropRect::kHasLeft_CropEdge) {
+ srcBounds.fLeft = cropRectI.fLeft;
+ }
+ if (flags & CropRect::kHasTop_CropEdge) {
+ srcBounds.fTop = cropRectI.fTop;
+ }
+ if (flags & CropRect::kHasRight_CropEdge) {
+ srcBounds.fRight = srcBounds.fLeft + cropRectI.width();
+ }
+ if (flags & CropRect::kHasBottom_CropEdge) {
+ srcBounds.fBottom = srcBounds.fTop + cropRectI.height();
+ }
if (!srcBounds.intersect(ctx.clipBounds())) {
return false;
}
@@ -323,10 +331,18 @@ bool SkImageFilter::applyCropRect(const Context& ctx, Proxy* proxy, const SkBitm
const SkIRect cropRectI = cropRect.roundOut();
uint32_t flags = fCropRect.flags();
*bounds = srcBounds;
- if (flags & CropRect::kHasLeft_CropEdge) bounds->fLeft = cropRectI.fLeft;
- if (flags & CropRect::kHasTop_CropEdge) bounds->fTop = cropRectI.fTop;
- if (flags & CropRect::kHasRight_CropEdge) bounds->fRight = cropRectI.fRight;
- if (flags & CropRect::kHasBottom_CropEdge) bounds->fBottom = cropRectI.fBottom;
+ if (flags & CropRect::kHasLeft_CropEdge) {
+ bounds->fLeft = cropRectI.fLeft;
+ }
+ if (flags & CropRect::kHasTop_CropEdge) {
+ bounds->fTop = cropRectI.fTop;
+ }
+ if (flags & CropRect::kHasRight_CropEdge) {
+ bounds->fRight = bounds->fLeft + cropRectI.width();
+ }
+ if (flags & CropRect::kHasBottom_CropEdge) {
+ bounds->fBottom = bounds->fTop + cropRectI.height();
+ }
if (!bounds->intersect(ctx.clipBounds())) {
return false;
}
« no previous file with comments | « no previous file | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698