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

Unified Diff: include/core/SkImage.h

Issue 1463373002: scaling API on SkPixmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « gm/image.cpp ('k') | include/core/SkPixmap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImage.h
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 667cf6b9a110a03d87d789f177c81646e3fb4aeb..d6b10a8e186bc3ce5e32acddd06686bb31c85cc6 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -208,6 +208,16 @@ public:
GrBackendObject getTextureHandle(bool flushPendingGrContextIO) const;
/**
+ * Hints to image calls where the system might cache computed intermediates (e.g. the results
+ * of decoding or a read-back from the GPU. Passing kAllow signals that the system's default
+ * behavior is fine. Passing kDisallow signals that caching should be avoided.
+ */
+ enum CachingHint {
+ kAllow_CachingHint,
+ kDisallow_CachingHint,
+ };
+
+ /**
* Copy the pixels from the image into the specified buffer (pixels + rowBytes),
* converting them into the requested format (dstInfo). The image pixels are read
* starting at the specified (srcX,srcY) location.
@@ -226,9 +236,19 @@ public:
* - If the requested colortype/alphatype cannot be converted from the image's types.
*/
bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
- int srcX, int srcY) const;
+ int srcX, int srcY, CachingHint = kAllow_CachingHint) const;
- bool readPixels(const SkPixmap& dst, int srcX, int srcY) const;
+ bool readPixels(const SkPixmap& dst, int srcX, int srcY,
+ CachingHint = kAllow_CachingHint) const;
+
+ /**
+ * Copy the pixels from this image into the dst pixmap, converting as needed into dst's
+ * colortype/alphatype. If the conversion cannot be performed, false is returned.
+ *
+ * If dst's dimensions differ from the src dimension, the image will be scaled, applying the
+ * specified filter-quality.
+ */
+ bool scalePixels(const SkPixmap& dst, SkFilterQuality, CachingHint = kAllow_CachingHint) const;
/**
* Encode the image's pixels and return the result as a new SkData, which
« no previous file with comments | « gm/image.cpp ('k') | include/core/SkPixmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698