Index: Source/platform/image-decoders/ImageDecoder.h |
diff --git a/Source/platform/image-decoders/ImageDecoder.h b/Source/platform/image-decoders/ImageDecoder.h |
index 559213011fae93fa14db64b85678ba0c704652f1..99aa11f4030c4b4fb92412b0536fab2e964d32ad 100644 |
--- a/Source/platform/image-decoders/ImageDecoder.h |
+++ b/Source/platform/image-decoders/ImageDecoder.h |
@@ -49,6 +49,39 @@ |
namespace blink { |
+// DecodingBuffers can be used to decode color components into provided buffers instead of using an ImageFrame. |
+class DecodingBuffers { |
+public: |
+ DecodingBuffers() |
+ { |
+ for (int i = 0; i < 3; ++i) { |
Peter Kasting
2014/07/23 22:17:37
Nit: For these methods that require more than a li
sugoi1
2014/07/24 15:48:30
Done.
|
+ m_planes[i] = 0; |
+ m_rowBytes[i] = 0; |
+ } |
+ } |
+ |
+ void set(void* planes[3], size_t rowBytes[3]) |
+ { |
+ for (int i = 0; i < 3; ++i) { |
+ m_planes[i] = planes[i]; |
+ m_rowBytes[i] = rowBytes[i]; |
+ } |
+ } |
+ |
+ void* getPlane(int i) const |
+ { |
+ return ((i >= 0) && i < 3) ? m_planes[i] : 0; |
Stephen White
2014/07/23 21:45:53
Should this be an assert instead?
sugoi1
2014/07/24 15:48:30
Done.
|
+ } |
+ |
+ size_t getRowBytes(int i) const |
+ { |
+ return ((i >= 0) && i < 3) ? m_rowBytes[i] : 0; |
Stephen White
2014/07/23 21:45:53
Same here.
sugoi1
2014/07/24 15:48:30
Done.
|
+ } |
+private: |
Peter Kasting
2014/07/23 22:17:37
Nit: Blank line above this
sugoi1
2014/07/24 15:48:30
Done.
|
+ void* m_planes[3]; |
+ size_t m_rowBytes[3]; |
+}; |
+ |
// ImageDecoder is a base for all format-specific decoders |
// (e.g. JPEGImageDecoder). This base manages the ImageFrame cache. |
// |
@@ -100,7 +133,7 @@ public: |
// Decoders which downsample images should override this method to |
// return the actual decoded size. |
- virtual IntSize decodedSize() const { return size(); } |
+ virtual IntSize decodedSize(int component = 0) const { return size(); } |
// This will only differ from size() for ICO (where each frame is a |
// different icon) or other formats where different frames are different |
@@ -252,6 +285,11 @@ public: |
m_frameBufferCache[0].setMemoryAllocator(allocator); |
} |
+ virtual void setHardwareDecoding(bool) { } |
+ virtual bool hardwareDecoding() const { return false; } |
+ virtual bool doHardwareDecoding() { return false; } |
+ virtual void setDecodingBuffers(OwnPtr<DecodingBuffers>&) { } |
+ |
protected: |
// Calculates the most recent frame whose image data may be needed in |
// order to decode frame |frameIndex|, based on frame disposal methods |