Chromium Code Reviews| Index: include/effects/SkPictureImageFilter.h |
| diff --git a/include/effects/SkPictureImageFilter.h b/include/effects/SkPictureImageFilter.h |
| index ed5c63c18a51007b476c1bc17b55d101d5930943..6d9b003c5f3e8cb0ed21a9e7f8ae92ba9c374e77 100644 |
| --- a/include/effects/SkPictureImageFilter.h |
| +++ b/include/effects/SkPictureImageFilter.h |
| @@ -13,26 +13,49 @@ |
| class SK_API SkPictureImageFilter : public SkImageFilter { |
| public: |
| + enum PictureResolution { |
| + /** |
| + * In this mode, which is the default, the picture is reasterized in at |
| + * a resolution that matches the device that filter is rendering to. |
| + */ |
| + kDeviceSpace_PictureResolution, |
| + |
| + /** |
| + * In this mode, the picture is rasterized at a resolution such that pixels have |
| + * unit size in the local (pre-transform) coordinate space. This is equivalent |
| + * to rendering in record-time device space and the resampling the result to |
| + * pring in into the playback device space. |
| + */ |
| + kLocalSpace_PictureResolution |
| + }; |
| + |
| /** |
| * Refs the passed-in picture. |
| */ |
| - static SkPictureImageFilter* Create(const SkPicture* picture, int32_t uniqueID = 0) { |
| - return SkNEW_ARGS(SkPictureImageFilter, (picture, uniqueID)); |
| + static SkPictureImageFilter* Create(const SkPicture* picture, int32_t uniqueID = 0, |
|
reed2
2014/11/28 15:33:52
api nit: can we not have so many default arguments
|
| + PictureResolution res = kDeviceSpace_PictureResolution, |
| + SkPaint::FilterLevel level = SkPaint::kLow_FilterLevel) { |
| + return SkNEW_ARGS(SkPictureImageFilter, (picture, uniqueID, res, level)); |
| } |
| /** |
| * Refs the passed-in picture. cropRect can be used to crop or expand the destination rect when |
| * the picture is drawn. (No scaling is implied by the dest rect; only the CTM is applied.) |
| */ |
| - static SkPictureImageFilter* Create(const SkPicture* picture, const SkRect& cropRect, uint32_t uniqueID = 0) { |
| - return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect, uniqueID)); |
| + static SkPictureImageFilter* Create(const SkPicture* picture, const SkRect& cropRect, |
| + uint32_t uniqueID = 0, |
| + PictureResolution res = kDeviceSpace_PictureResolution, |
| + SkPaint::FilterLevel level = SkPaint::kLow_FilterLevel) { |
| + return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect, uniqueID, res, level)); |
| } |
| SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter) |
| protected: |
| - explicit SkPictureImageFilter(const SkPicture* picture, uint32_t uniqueID); |
| - SkPictureImageFilter(const SkPicture* picture, const SkRect& cropRect, uint32_t uniqueID); |
| + explicit SkPictureImageFilter(const SkPicture* picture, uint32_t uniqueID, PictureResolution, |
| + SkPaint::FilterLevel); |
| + SkPictureImageFilter(const SkPicture* picture, const SkRect& cropRect, uint32_t uniqueID, |
| + PictureResolution, SkPaint::FilterLevel); |
| virtual ~SkPictureImageFilter(); |
| /* Constructs an SkPictureImageFilter object from an SkReadBuffer. |
| * Note: If the SkPictureImageFilter object construction requires bitmap |
| @@ -48,8 +71,15 @@ protected: |
| SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE; |
| private: |
| - const SkPicture* fPicture; |
| - SkRect fCropRect; |
| + void drawPictureAtNativeResolution(Proxy*, SkBaseDevice*, const SkIRect& deviceBounds, |
| + const Context&) const; |
| + void drawPictureAtOriginalResolution(Proxy*, SkBaseDevice*, const SkIRect& deviceBounds, |
| + const Context&) const; |
| + |
| + const SkPicture* fPicture; |
| + SkRect fCropRect; |
| + SkPaint::FilterLevel fFilterLevel; |
| + PictureResolution fPictureResolution; |
| typedef SkImageFilter INHERITED; |
| }; |