Chromium Code Reviews| Index: include/core/SkImageDecoder.h |
| diff --git a/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h |
| index 5910d33a997a4950aad0694d1beb0619f6edb31b..1c975063eae0b28ee75fb25b81b6d318d9da74c8 100644 |
| --- a/include/core/SkImageDecoder.h |
| +++ b/include/core/SkImageDecoder.h |
| @@ -18,6 +18,24 @@ |
| class SkStream; |
| class SkStreamRewindable; |
| +/** \class SkImagePlanes |
| + |
| + SkImagePlanes can be used to decode color components into provided buffers |
| + instead of using an SkBitmap. |
| +*/ |
| +class SkImagePlanes : public SkRefCnt { |
| +public: |
| + SkImagePlanes(); |
| + SkImagePlanes(void* planes[3], size_t rowBytes[3]); |
| + |
| + void* plane(int); |
| + size_t rowBytes(int) const; |
| + |
| +private: |
| + void* m_planes[3]; |
| + size_t m_rowBytes[3]; |
| +}; |
| + |
| /** \class SkImageDecoder |
| Base class for decoding compressed images into a SkBitmap |
| @@ -47,6 +65,17 @@ public: |
| */ |
| virtual Format getFormat() const; |
| + /** Returns the sizes of each component of the image |
| + @param sizes On success, returns the sizes of each component of the image. |
| + */ |
| + bool getYUVComponentSizes(SkStream* stream, SkISize sizes[3]); |
| + |
| + /** Decodes the YUV planes into the provided planes |
| + Returns whether the decoding to YUV was successful. |
| + */ |
| + bool decodeToYUV(SkStream* stream, SkISize componentSizes[3], void* planes[3], |
| + size_t rowBytes[3]); |
| + |
| /** Return the format of the SkStreamRewindable or kUnknown_Format if it cannot be determined. |
| Rewinds the stream before returning. |
| */ |
| @@ -339,6 +368,17 @@ protected: |
| return false; |
| } |
| + /** If imagePlanes is NULL, decodes the header and computes componentSizes |
| + for memory allocation. |
| + Otherwise, decodes the YUV planes into the provided image planes and |
| + updates componentSizes to the final image size. |
| + Returns whether the decoding was successful. |
| + */ |
| + virtual bool onDecodeToYUV(SkStream* stream, SkISize componentSizes[3], |
| + SkImagePlanes* imagePlanes) { |
|
reed1
2014/10/13 13:15:35
I thnk passing the planes and sizes arrays is bett
sugoi1
2014/10/14 15:07:36
Done. This was added only to mimic what is used in
|
| + return false; |
| + } |
| + |
| /* |
| * Crop a rectangle from the src Bitmap to the dest Bitmap. src and dst are |
| * both sampled by sampleSize from an original Bitmap. |