Chromium Code Reviews| Index: include/core/SkImage.h |
| diff --git a/include/core/SkImage.h b/include/core/SkImage.h |
| index 60f8bfb311828c3f110bd80b78b03d5f93fe0de6..0fab67473340a2de5c51e36191c059a7053e0e35 100644 |
| --- a/include/core/SkImage.h |
| +++ b/include/core/SkImage.h |
| @@ -76,6 +76,36 @@ public: |
| void draw(SkCanvas*, const SkRect* src, const SkRect& dst, const SkPaint*); |
| /** |
| + * If the image has direct access to its pixels (i.e. they are in local |
| + * RAM) return true and set bitmap to those pixels. In this case the client |
| + * must still call lockPixels/unlockPixels to access them, and must NOT |
| + * modify the pixels in any way. |
| + * |
| + * If this direct exposing of the pixels is not valid, return false and |
| + * bitmap will unmodified. |
|
scroggo
2014/02/05 17:16:07
nit: will be*
|
| + */ |
| + bool peekPixels(SkBitmap* bitmap) const; |
|
bsalomon
2014/02/05 17:13:37
Maybe this should return a const pointer, an image
scroggo
2014/02/05 17:16:43
+1
reed1
2014/02/05 17:47:52
Interesting. That is precisely what I first typed,
|
| + |
| + /** |
| + * Return a copy of the image's pixels, limiting them to the subset |
| + * rectangle's intersection wit the image bounds. If subset is NULL, then |
| + * the entire image will be considered. |
| + * |
| + * If the bitmap's pixels have already been allocated, then readPixels() |
| + * will succeed only if it can support converting the image's pixels into |
| + * the bitmap's ColorType/AlphaType. Aany pixels in the bitmap that do not |
|
scroggo
2014/02/05 17:16:07
Any*
|
| + * intersect with the image's bounds and the subset (if not null) will be |
| + * left untouched. |
| + * |
| + * If the bitmap is initially empty/unallocated, then it will be allocated |
| + * using the default allocator, and the ColorType/AlphaType will be chosen |
| + * to most closely fit the image's configuration. |
| + * |
| + * On failure, false will be returned, and bitmap will unmodified. |
| + */ |
| + bool readPixels(SkBitmap* bitmap, const SkIRect* subset = NULL); |
|
scroggo
2014/02/05 17:16:07
Should this function be const also?
In the case o
|
| + |
| + /** |
| * Encode the image's pixels and return the result as a new SkData, which |
| * the caller must manage (i.e. call unref() when they are done). |
| * |