| Index: include/core/SkImageFilter.h
|
| diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
|
| index 75fa29b425663795b80b89e301fd740e0aa214ee..896636bb75e0bff8024d84940d85e2b35fa5b300 100644
|
| --- a/include/core/SkImageFilter.h
|
| +++ b/include/core/SkImageFilter.h
|
| @@ -32,24 +32,6 @@ struct SkIPoint;
|
| */
|
| class SK_API SkImageFilter : public SkFlattenable {
|
| public:
|
| - class CropRect {
|
| - public:
|
| - enum CropEdge {
|
| - kHasLeft_CropEdge = 0x01,
|
| - kHasTop_CropEdge = 0x02,
|
| - kHasRight_CropEdge = 0x04,
|
| - kHasBottom_CropEdge = 0x08,
|
| - kHasAll_CropEdge = 0x0F,
|
| - };
|
| - CropRect() {}
|
| - explicit CropRect(const SkRect& rect, uint32_t flags = kHasAll_CropEdge) : fRect(rect), fFlags(flags) {}
|
| - uint32_t flags() const { return fFlags; }
|
| - const SkRect& rect() const { return fRect; }
|
| - private:
|
| - SkRect fRect;
|
| - uint32_t fFlags;
|
| - };
|
| -
|
| // This cache maps from (filter's unique ID + CTM + clipBounds + src bitmap generation ID) to
|
| // (result, offset).
|
| class Cache : public SkRefCnt {
|
| @@ -77,6 +59,41 @@ public:
|
| Cache* fCache;
|
| };
|
|
|
| + class CropRect {
|
| + public:
|
| + enum CropEdge {
|
| + kHasLeft_CropEdge = 0x01,
|
| + kHasTop_CropEdge = 0x02,
|
| + kHasRight_CropEdge = 0x04,
|
| + kHasBottom_CropEdge = 0x08,
|
| + kHasAll_CropEdge = 0x0F,
|
| + };
|
| + CropRect() {}
|
| + explicit CropRect(const SkRect& rect, uint32_t flags = kHasAll_CropEdge)
|
| + : fRect(rect), fFlags(flags) {}
|
| + uint32_t flags() const { return fFlags; }
|
| + const SkRect& rect() const { return fRect; }
|
| +#ifndef SK_IGNORE_TO_STRING
|
| + void toString(SkString* str) const;
|
| +#endif
|
| +
|
| + /**
|
| + * Apply this cropRect to the imageBounds. If a given edge of the cropRect is not
|
| + * set, then the corresponding edge from imageBounds will be used.
|
| + *
|
| + * Note: imageBounds is in "device" space, as the output cropped rectangle will be,
|
| + * so the context's CTM is ignore for those. It is only applied the croprect's bounds.
|
| + *
|
| + * The resulting rect will be intersected with the context's clip. If that intersection is
|
| + * empty, then this returns false and cropped is unmodified.
|
| + */
|
| + bool applyTo(const SkIRect& imageBounds, const Context&, SkIRect* cropped) const;
|
| +
|
| + private:
|
| + SkRect fRect;
|
| + uint32_t fFlags;
|
| + };
|
| +
|
| class Proxy {
|
| public:
|
| Proxy(SkBaseDevice* device) : fDevice(device) { }
|
| @@ -182,7 +199,8 @@ public:
|
| /**
|
| * 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
|
| + * input image will be processed, and which pixels in the output image will be allowed.
|
| + * 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
|
|
|