| Index: include/core/SkImage.h
|
| diff --git a/include/core/SkImage.h b/include/core/SkImage.h
|
| index 9d1c546ef5158eed0ae0794c9d1c5de70b22e1d1..972db44e2e1b4f6b03ed6eeb6ccd75911ede0e08 100644
|
| --- a/include/core/SkImage.h
|
| +++ b/include/core/SkImage.h
|
| @@ -65,17 +65,27 @@ public:
|
| * Construct a new SkImage based on the given ImageGenerator.
|
| * This function will always take ownership of the passed
|
| * ImageGenerator. Returns NULL on error.
|
| + *
|
| + * If a subset is specified, it must be contained within the generator's bounds.
|
| */
|
| - static SkImage* NewFromGenerator(SkImageGenerator*);
|
| + static SkImage* NewFromGenerator(SkImageGenerator*, const SkIRect* subset = NULL);
|
|
|
| /**
|
| * Construct a new SkImage based on the specified encoded data. Returns NULL on failure,
|
| * which can mean that the format of the encoded data was not recognized/supported.
|
| *
|
| + * If a subset is specified, it must be contained within the encoded data's bounds.
|
| + *
|
| * Regardless of success or failure, the caller is responsible for managing their ownership
|
| * of the data.
|
| */
|
| - static SkImage* NewFromData(SkData* data);
|
| + static SkImage* NewFromEncoded(SkData* encoded, const SkIRect* subset = NULL);
|
| +
|
| +#ifdef SK_SUPPORT_LEGACY_IMAGE_NEWFROMDATA
|
| + static SkImage* NewFromData(SkData* data) {
|
| + return NewFromEncoded(data, NULL);
|
| + }
|
| +#endif
|
|
|
| /**
|
| * Create a new image from the specified descriptor. Note - the caller is responsible for
|
| @@ -151,6 +161,15 @@ public:
|
| */
|
| const void* peekPixels(SkImageInfo* info, size_t* rowBytes) const;
|
|
|
| + /**
|
| + * If the image has direct access to its pixels (i.e. they are in local
|
| + * RAM) return the (const) address of those pixels, and if not null, return
|
| + * the true, and if pixmap is not NULL, set it to point into the image.
|
| + *
|
| + * On failure, return false and ignore the pixmap parameter.
|
| + */
|
| + bool peekPixmap(SkPixmap* pixmap) const;
|
| +
|
| // DEPRECATED
|
| GrTexture* getTexture() const;
|
|
|
| @@ -198,6 +217,16 @@ public:
|
| int quality = 80) const;
|
|
|
| /**
|
| + * If the image already has its contents in encoded form (e.g. PNG or JPEG), return a ref
|
| + * to that data (which the caller must call unref() on) and return the X,Y offset from the
|
| + * left-top pixels in the encoded data where this image begins.
|
| + *
|
| + * If the image does not already has its contents in encoded form, return NULL and ignore
|
| + * the origin parameter.
|
| + */
|
| + SkData* refEncodedData(SkIPoint* origin) const;
|
| +
|
| + /**
|
| * Return a new surface that is compatible with this image's internal representation
|
| * (e.g. raster or gpu).
|
| *
|
|
|