Index: third_party/WebKit/Source/platform/image-decoders/png/PNGImageReader.h |
diff --git a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageReader.h b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageReader.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ae421d6f1ae9ce801cc9696da92a03220b075fbc |
--- /dev/null |
+++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageReader.h |
@@ -0,0 +1,86 @@ |
+/* |
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
+ * |
+ * Redistribution and use in source and binary forms, with or without |
+ * modification, are permitted provided that the following conditions |
+ * are met: |
+ * 1. Redistributions of source code must retain the above copyright |
+ * notice, this list of conditions and the following disclaimer. |
+ * 2. Redistributions in binary form must reproduce the above copyright |
+ * notice, this list of conditions and the following disclaimer in the |
+ * documentation and/or other materials provided with the distribution. |
+ * |
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ */ |
+ |
+ |
+#include "platform/image-decoders/SegmentReader.h" |
+#include "platform/image-decoders/png/PNGImageDecoder.h" |
+#include "platform/PlatformExport.h" |
+#include "png.h" |
+#include "wtf/Allocator.h" |
+#include "wtf/PtrUtil.h" |
+ |
+#ifndef PNGImageReader_h |
+#define PNGImageReader_h |
+ |
+namespace blink { |
+ |
+class PLATFORM_EXPORT PNGImageReader final { |
+ USING_FAST_MALLOC(PNGImageReader); |
+ WTF_MAKE_NONCOPYABLE(PNGImageReader); |
+public: |
+ PNGImageReader(PNGImageDecoder*, size_t readOffset); |
+ ~PNGImageReader(); |
+ |
+ bool parse(const SegmentReader&, PNGImageDecoder::PNGParseQuery); |
+ bool readChunk(const char* tag, const void* dataChunk, size_t length); |
+ |
+ png_structp pngPtr() const { return m_png; } |
+ png_infop infoPtr() const { return m_info; } |
+ |
+ size_t getReadOffset() const { return m_readOffset; } |
+ void setReadOffset(size_t offset) { m_readOffset = offset; } |
+ size_t currentBufferSize() const { return m_currentBufferSize; } |
+ bool decodingSizeOnly() const { return m_decodingSizeOnly; } |
+ void setHasAlpha(bool hasAlpha) { m_hasAlpha = hasAlpha; } |
+ bool hasAlpha() const { return m_hasAlpha; } |
+ |
+ png_bytep interlaceBuffer() const { return m_interlaceBuffer.get(); } |
+ void createInterlaceBuffer(int size) { m_interlaceBuffer = wrapArrayUnique(new png_byte[size]); } |
+#if USE(QCMSLIB) |
+ png_bytep rowBuffer() const { return m_rowBuffer.get(); } |
+ void createRowBuffer(int size) { m_rowBuffer = wrapArrayUnique(new png_byte[size]); } |
+#endif |
+ |
+ |
+private: |
+ png_structp m_png; |
+ png_infop m_info; |
+ PNGImageDecoder* m_decoder; |
+ size_t m_readOffset; |
+ size_t m_currentBufferSize; |
+ bool m_decodingSizeOnly; |
+ bool m_hasAlpha; |
+ std::unique_ptr<png_byte[]> m_interlaceBuffer; |
+ |
+ inline bool readAnimationControl(const png_byte* data); |
scroggo_chromium
2016/10/04 14:50:17
I think the compiler is going to ignore this "inli
joostouwerling
2016/10/11 16:31:06
Acknowledged.
|
+ |
+#if USE(QCMSLIB) |
+ std::unique_ptr<png_byte[]> m_rowBuffer; |
+#endif |
+}; |
+ |
+}; |
+ |
+#endif |