Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / platform / image-decoders / ImageDecoder.h
index 28b2c3d..b9dfb75 100644 (file)
 #include "qcms.h"
 #if OS(MACOSX)
 #include <ApplicationServices/ApplicationServices.h>
-#include "platform/graphics/cg/GraphicsContextCG.h"
 #include "wtf/RetainPtr.h"
 #endif
 #endif
 
-namespace WebCore {
+namespace blink {
+
+// ImagePlanes can be used to decode color components into provided buffers instead of using an ImageFrame.
+class PLATFORM_EXPORT ImagePlanes {
+public:
+    ImagePlanes();
+
+    void set(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];
+};
 
 // ImageDecoder is a base for all format-specific decoders
 // (e.g. JPEGImageDecoder). This base manages the ImageFrame cache.
@@ -103,6 +116,10 @@ public:
     // return the actual decoded size.
     virtual IntSize decodedSize() const { return size(); }
 
+    // Decoders which support YUV decoding can override this to
+    // give potentially different sizes per component.
+    virtual IntSize decodedYUVSize(int component) const { return decodedSize(); }
+
     // This will only differ from size() for ICO (where each frame is a
     // different icon) or other formats where different frames are different
     // sizes. This does NOT differ from size() for GIF or WebP, since
@@ -187,6 +204,7 @@ public:
                 size_t length = CFDataGetLength(iccProfile);
                 const unsigned char* systemProfile = CFDataGetBytePtr(iccProfile);
                 m_outputDeviceProfile = qcms_profile_from_memory(systemProfile, length);
+                CFRelease(iccProfile);
             }
 #else
             // FIXME: add support for multiple monitors.
@@ -252,6 +270,10 @@ public:
         m_frameBufferCache[0].setMemoryAllocator(allocator);
     }
 
+    virtual bool YUVDecoding() const { return false; }
+    virtual bool decodeToYUV() { return false; }
+    virtual void setImagePlanes(OwnPtr<ImagePlanes>&) { }
+
 protected:
     // Calculates the most recent frame whose image data may be needed in
     // order to decode frame |frameIndex|, based on frame disposal methods
@@ -303,6 +325,6 @@ private:
     bool m_failed;
 };
 
-} // namespace WebCore
+} // namespace blink
 
 #endif