| OLD | NEW |
| 1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
| 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 4 * | 4 * |
| 5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
| 6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
| 7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
| 8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
| 9 * | 9 * |
| 10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 * the terms of any one of the MPL, the GPL or the LGPL. | 34 * the terms of any one of the MPL, the GPL or the LGPL. |
| 35 * | 35 * |
| 36 * ***** END LICENSE BLOCK ***** */ | 36 * ***** END LICENSE BLOCK ***** */ |
| 37 | 37 |
| 38 #ifndef GIFImageReader_h | 38 #ifndef GIFImageReader_h |
| 39 #define GIFImageReader_h | 39 #define GIFImageReader_h |
| 40 | 40 |
| 41 // Define ourselves as the clientPtr. Mozilla just hacked their C++ callback cl
ass into this old C decoder, | 41 // Define ourselves as the clientPtr. Mozilla just hacked their C++ callback cl
ass into this old C decoder, |
| 42 // so we will too. | 42 // so we will too. |
| 43 #include "platform/SharedBuffer.h" | 43 #include "platform/SharedBuffer.h" |
| 44 #include "core/platform/image-decoders/gif/GIFImageDecoder.h" | 44 #include "platform/image-decoders/gif/GIFImageDecoder.h" |
| 45 #include "wtf/Noncopyable.h" |
| 45 #include "wtf/OwnPtr.h" | 46 #include "wtf/OwnPtr.h" |
| 46 #include "wtf/PassOwnPtr.h" | 47 #include "wtf/PassOwnPtr.h" |
| 47 #include "wtf/Vector.h" | 48 #include "wtf/Vector.h" |
| 48 | 49 |
| 49 #define MAX_DICTIONARY_ENTRY_BITS 12 | 50 #define MAX_DICTIONARY_ENTRY_BITS 12 |
| 50 #define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS | 51 #define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS |
| 51 #define MAX_COLORS 256 | 52 #define MAX_COLORS 256 |
| 52 #define BYTES_PER_COLORMAP_ENTRY 3 | 53 #define BYTES_PER_COLORMAP_ENTRY 3 |
| 53 | 54 |
| 54 const int cLoopCountNotSeen = -2; | 55 const int cLoopCountNotSeen = -2; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 172 |
| 172 private: | 173 private: |
| 173 bool m_isDefined; | 174 bool m_isDefined; |
| 174 size_t m_position; | 175 size_t m_position; |
| 175 size_t m_colors; | 176 size_t m_colors; |
| 176 Table m_table; | 177 Table m_table; |
| 177 }; | 178 }; |
| 178 | 179 |
| 179 // Frame output state machine. | 180 // Frame output state machine. |
| 180 struct GIFFrameContext { | 181 struct GIFFrameContext { |
| 181 WTF_MAKE_FAST_ALLOCATED; | 182 WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(GIFFrameContext); |
| 182 public: | 183 public: |
| 183 GIFFrameContext(int id) | 184 GIFFrameContext(int id) |
| 184 : m_frameId(id) | 185 : m_frameId(id) |
| 185 , m_xOffset(0) | 186 , m_xOffset(0) |
| 186 , m_yOffset(0) | 187 , m_yOffset(0) |
| 187 , m_width(0) | 188 , m_width(0) |
| 188 , m_height(0) | 189 , m_height(0) |
| 189 , m_transparentPixel(kNotFound) | 190 , m_transparentPixel(kNotFound) |
| 190 , m_disposalMethod(WebCore::ImageFrame::DisposeNotSpecified) | 191 , m_disposalMethod(WebCore::ImageFrame::DisposeNotSpecified) |
| 191 , m_dataSize(0) | 192 , m_dataSize(0) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 OwnPtr<GIFLZWContext> m_lzwContext; | 268 OwnPtr<GIFLZWContext> m_lzwContext; |
| 268 Vector<GIFLZWBlock> m_lzwBlocks; // LZW blocks for this frame. | 269 Vector<GIFLZWBlock> m_lzwBlocks; // LZW blocks for this frame. |
| 269 GIFColorMap m_localColorMap; | 270 GIFColorMap m_localColorMap; |
| 270 | 271 |
| 271 size_t m_currentLzwBlock; | 272 size_t m_currentLzwBlock; |
| 272 bool m_isComplete; | 273 bool m_isComplete; |
| 273 bool m_isHeaderDefined; | 274 bool m_isHeaderDefined; |
| 274 bool m_isDataSizeDefined; | 275 bool m_isDataSizeDefined; |
| 275 }; | 276 }; |
| 276 | 277 |
| 277 class GIFImageReader { | 278 class PLATFORM_EXPORT GIFImageReader { |
| 278 WTF_MAKE_FAST_ALLOCATED; | 279 WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(GIFImageReader); |
| 279 public: | 280 public: |
| 280 GIFImageReader(WebCore::GIFImageDecoder* client = 0) | 281 GIFImageReader(WebCore::GIFImageDecoder* client = 0) |
| 281 : m_client(client) | 282 : m_client(client) |
| 282 , m_state(GIFType) | 283 , m_state(GIFType) |
| 283 , m_bytesToConsume(6) // Number of bytes for GIF type, either "GIF87a" o
r "GIF89a". | 284 , m_bytesToConsume(6) // Number of bytes for GIF type, either "GIF87a" o
r "GIF89a". |
| 284 , m_bytesRead(0) | 285 , m_bytesRead(0) |
| 285 , m_version(0) | 286 , m_version(0) |
| 286 , m_screenWidth(0) | 287 , m_screenWidth(0) |
| 287 , m_screenHeight(0) | 288 , m_screenHeight(0) |
| 288 , m_loopCount(cLoopCountNotSeen) | 289 , m_loopCount(cLoopCountNotSeen) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 GIFColorMap m_globalColorMap; | 354 GIFColorMap m_globalColorMap; |
| 354 int m_loopCount; // Netscape specific extension block to control the number
of animation loops a GIF renders. | 355 int m_loopCount; // Netscape specific extension block to control the number
of animation loops a GIF renders. |
| 355 | 356 |
| 356 Vector<OwnPtr<GIFFrameContext> > m_frames; | 357 Vector<OwnPtr<GIFFrameContext> > m_frames; |
| 357 | 358 |
| 358 RefPtr<WebCore::SharedBuffer> m_data; | 359 RefPtr<WebCore::SharedBuffer> m_data; |
| 359 bool m_parseCompleted; | 360 bool m_parseCompleted; |
| 360 }; | 361 }; |
| 361 | 362 |
| 362 #endif | 363 #endif |
| OLD | NEW |