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

Unified Diff: src/core/SkImageFilter.cpp

Issue 27490005: Make CropRect immutable after construction. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove now-stale comment. Created 7 years, 2 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 | « include/core/SkImageFilter.h ('k') | no next file » | 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 ee43c0e019d3037cc6c094524b738cf4f38834b6..46d9ee4b9b007c64de7452e88c45a6247293db95 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -61,8 +61,10 @@ SkImageFilter::SkImageFilter(SkFlattenableReadBuffer& buffer)
fInputs[i] = NULL;
}
}
- buffer.readRect(&fCropRect.fRect);
- fCropRect.fFlags = buffer.readUInt();
+ SkRect rect;
+ buffer.readRect(&rect);
+ uint32_t flags = buffer.readUInt();
+ fCropRect = CropRect(rect, flags);
}
void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
@@ -74,8 +76,8 @@ void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
buffer.writeFlattenable(input);
}
}
- buffer.writeRect(fCropRect.fRect);
- buffer.writeUInt(fCropRect.fFlags);
+ buffer.writeRect(fCropRect.rect());
+ buffer.writeUInt(fCropRect.flags());
}
bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src,
@@ -158,14 +160,15 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMa
bool SkImageFilter::applyCropRect(SkIRect* rect, const SkMatrix& matrix) const {
SkRect cropRect;
- matrix.mapRect(&cropRect, fCropRect.fRect);
+ matrix.mapRect(&cropRect, fCropRect.rect());
SkIRect cropRectI;
cropRect.roundOut(&cropRectI);
+ uint32_t flags = fCropRect.flags();
// If the original crop rect edges were unset, max out the new crop edges
- if (!(fCropRect.fFlags & CropRect::kHasLeft_CropEdge)) cropRectI.fLeft = SK_MinS32;
- if (!(fCropRect.fFlags & CropRect::kHasTop_CropEdge)) cropRectI.fTop = SK_MinS32;
- if (!(fCropRect.fFlags & CropRect::kHasRight_CropEdge)) cropRectI.fRight = SK_MaxS32;
- if (!(fCropRect.fFlags & CropRect::kHasBottom_CropEdge)) cropRectI.fBottom = SK_MaxS32;
+ if (!(flags & CropRect::kHasLeft_CropEdge)) cropRectI.fLeft = SK_MinS32;
+ if (!(flags & CropRect::kHasTop_CropEdge)) cropRectI.fTop = SK_MinS32;
+ if (!(flags & CropRect::kHasRight_CropEdge)) cropRectI.fRight = SK_MaxS32;
+ if (!(flags & CropRect::kHasBottom_CropEdge)) cropRectI.fBottom = SK_MaxS32;
return rect->intersect(cropRectI);
}
« no previous file with comments | « include/core/SkImageFilter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698