Make CropRect immutable after construction.

BUG=
R=reed@google.com

Review URL: https://codereview.chromium.org/27490005

git-svn-id: http://skia.googlecode.com/svn/trunk/src@11819 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkImageFilter.cpp b/core/SkImageFilter.cpp
index ee43c0e..46d9ee4 100644
--- a/core/SkImageFilter.cpp
+++ b/core/SkImageFilter.cpp
@@ -61,8 +61,10 @@
             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 @@
             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::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);
 }