Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: include/effects/SkPictureImageFilter.h

Issue 753073010: Adding a PictureResolution option to SkPictureImageFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: response to review comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/effects/SkPictureImageFilter.h
diff --git a/include/effects/SkPictureImageFilter.h b/include/effects/SkPictureImageFilter.h
index ed5c63c18a51007b476c1bc17b55d101d5930943..f9d33f0bf8a29323d03c45912b08685566e4ea58 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
Stephen White 2014/12/01 16:02:12 Is "local space" the usual Skia nomenclature for n
Justin Novosad 2014/12/02 16:33:36 It is standard nomenclature in computer graphics.
+ };
+
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
@@ -48,8 +70,16 @@ protected:
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
private:
- const SkPicture* fPicture;
- SkRect fCropRect;
+
+
+ void drawPictureAtNativeResolution(Proxy*, SkBaseDevice*, const SkIRect& deviceBounds,
Stephen White 2014/12/01 16:02:12 We have native, device, local and original. Is the
Justin Novosad 2014/12/02 16:33:36 Acknowledged.
+ const Context&) const;
+ void drawPictureAtOriginalResolution(Proxy*, SkBaseDevice*, const SkIRect& deviceBounds,
+ const Context&) const;
+
+ const SkPicture* fPicture;
+ SkRect fCropRect;
+ PictureResolution fPictureResolution;
typedef SkImageFilter INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698