diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-16 18:07:48 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-16 18:07:48 +0000 |
commit | 3f1f2a3a59c43e5bce67ab98e55df45bc7c933a3 (patch) | |
tree | a7de603b22881f14360647dbe5515c642ed3d66b /include/core | |
parent | 3e7e992a8aa564e75bede2a1dc787142d2c2bab0 (diff) |
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@11819 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkImageFilter.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h index 6d659fad89..60cc63f13b 100644 --- a/include/core/SkImageFilter.h +++ b/include/core/SkImageFilter.h @@ -31,9 +31,8 @@ class SK_API SkImageFilter : public SkFlattenable { public: SK_DECLARE_INST_COUNT(SkImageFilter) - struct CropRect { - SkRect fRect; - uint32_t fFlags; + class CropRect { + public: enum CropEdge { kHasLeft_CropEdge = 0x01, kHasTop_CropEdge = 0x02, @@ -43,11 +42,11 @@ public: }; CropRect() {} explicit CropRect(const SkRect& rect, uint32_t flags = kHasAll_CropEdge) : fRect(rect), fFlags(flags) {} - // Returns true if any of the crop edges have been set. - bool isSet() const - { - return fFlags != 0x0; - } + uint32_t flags() const { return fFlags; } + const SkRect& rect() const { return fRect; } + private: + SkRect fRect; + uint32_t fFlags; }; class Proxy { @@ -149,15 +148,16 @@ public: } /** - * Returns the crop rectangle of this filter. This is set at construction - * time, and determines which pixels from the input image will - * be processed. The size of this rectangle should be used as the size - * of the destination image. The origin of this rect should be used to - * offset access to the input images, and should also be added to the - * "offset" parameter in onFilterImage and filterImageGPU(). (The latter - * ensures that the resulting buffer is drawn in the correct location.) + * Returns whether any edges of the crop rect have been set. The crop + * rect is set at construction time, and determines which pixels from the + * input image will be processed. The size of the crop rect should be + * used as the size of the destination image. The origin of this rect + * should be used to offset access to the input images, and should also + * be added to the "offset" parameter in onFilterImage and + * filterImageGPU(). (The latter ensures that the resulting buffer is + * drawn in the correct location.) */ - bool cropRectIsSet() const { return fCropRect.isSet(); } + bool cropRectIsSet() const { return fCropRect.flags() != 0x0; } protected: SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRect = NULL); |