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

Unified Diff: include/core/SkImage.h

Issue 821083002: add newImage API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: include SkRandom.h Created 5 years, 11 months 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/core/SkImage.h
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 8d65870dc03883a2c8e1cfa954781ad8946d273d..6322afc978f104f6e206e6c92198383cc4b47c00 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -8,6 +8,7 @@
#ifndef SkImage_DEFINED
#define SkImage_DEFINED
+#include "SkFilterQuality.h"
#include "SkImageInfo.h"
#include "SkImageEncoder.h"
#include "SkRefCnt.h"
@@ -132,6 +133,25 @@ public:
const char* toString(SkString*) const;
+ /**
+ * Return an image that is a rescale of this image (using newWidth, newHeight).
+ *
+ * If subset is NULL, then the entire original image is used as the src for the scaling.
+ * If subset is not NULL, then it specifies subset of src-pixels used for scaling. If
+ * subset extends beyond the bounds of the original image, then NULL is returned.
+ *
+ * Notes:
+ * - it is legal for the returned image to be the same instance as the src image
+ * (if the new dimensions == the src dimensions and subset is NULL or == src dimensions).
+ *
+ * - it is legal for the "scaled" image to have changed its SkAlphaType from unpremul
+ * to premul (as required by the impl). The image should draw (nearly) identically,
+ * since during drawing we will "apply the alpha" to the pixels. Future optimizations
+ * may take away this caveat, preserving unpremul.
+ */
+ SkImage* newImage(int newWidth, int newHeight, const SkIRect* subset = NULL,
scroggo 2015/01/22 20:05:14 Why not take an SkImageInfo instead of a width/hei
reed1 2015/01/22 21:52:52 Being conservative. Since we don't even reveal the
+ SkFilterQuality = kNone_SkFilterQuality) const;
+
protected:
SkImage(int width, int height) :
fWidth(width),

Powered by Google App Engine
This is Rietveld 408576698