aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects/SkPictureImageFilter.h
diff options
context:
space:
mode:
authorGravatar Justin Novosad <junov@chromium.org>2014-12-02 14:50:56 -0500
committerGravatar Justin Novosad <junov@chromium.org>2014-12-02 14:50:56 -0500
commit5234075b1c6bcada4ad17ed5a83bfcb53df66b7f (patch)
treee0dfcb9772e462f71ffdcf65f83bc460c08d2c9e /include/effects/SkPictureImageFilter.h
parent367e1867b2d6901e3327d0707738d2bc7d13826e (diff)
Adding a PictureResolution option to SkPictureImageFilter
This change adds an option to SkPictureImageFilter to make it rasterize SkPicture in a resolution that matches the local coordinate space (equivalent to the record-time device space). BUG=skia:3176 R=reed@google.com, senorblanco@chromium.org Review URL: https://codereview.chromium.org/753073010
Diffstat (limited to 'include/effects/SkPictureImageFilter.h')
-rw-r--r--include/effects/SkPictureImageFilter.h40
1 files changed, 35 insertions, 5 deletions
diff --git a/include/effects/SkPictureImageFilter.h b/include/effects/SkPictureImageFilter.h
index f4f1fff4ef..8c3c9c46ec 100644
--- a/include/effects/SkPictureImageFilter.h
+++ b/include/effects/SkPictureImageFilter.h
@@ -24,15 +24,37 @@ public:
* 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) {
+ return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect, uniqueID,
+ kDeviceSpace_PictureResolution));
+ }
+
+ /**
+ * Refs the passed-in picture. The picture is rasterized at a resolution that matches the
+ * local coordinate space. If the picture needs to be resampled for drawing it into the
+ * destination canvas, bilinear filtering will be used. 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* CreateForLocalSpace(const SkPicture* picture,
+ const SkRect& cropRect,
+ uint32_t uniqueID = 0) {
+ return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect, uniqueID,
+ kLocalSpace_PictureResolution));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter)
protected:
+ enum PictureResolution {
+ kDeviceSpace_PictureResolution,
+ kLocalSpace_PictureResolution
+ };
+
explicit SkPictureImageFilter(const SkPicture* picture, uint32_t uniqueID);
- SkPictureImageFilter(const SkPicture* picture, const SkRect& cropRect, uint32_t uniqueID);
+ SkPictureImageFilter(const SkPicture* picture, const SkRect& cropRect, uint32_t uniqueID,
+ PictureResolution);
virtual ~SkPictureImageFilter();
/* Constructs an SkPictureImageFilter object from an SkReadBuffer.
* Note: If the SkPictureImageFilter object construction requires bitmap
@@ -45,8 +67,16 @@ protected:
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
private:
- const SkPicture* fPicture;
- SkRect fCropRect;
+
+
+ void drawPictureAtDeviceResolution(Proxy*, SkBaseDevice*, const SkIRect& deviceBounds,
+ const Context&) const;
+ void drawPictureAtLocalResolution(Proxy*, SkBaseDevice*, const SkIRect& deviceBounds,
+ const Context&) const;
+
+ const SkPicture* fPicture;
+ SkRect fCropRect;
+ PictureResolution fPictureResolution;
typedef SkImageFilter INHERITED;
};