| 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 26 matching lines...) Expand all Loading... |
| 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/image-decoders/FastSharedBufferReader.h" | 43 #include "platform/image-decoders/FastSharedBufferReader.h" |
| 44 #include "platform/image-decoders/gif/GIFImageDecoder.h" | 44 #include "platform/image-decoders/gif/GIFImageDecoder.h" |
| 45 #include "wtf/Allocator.h" | 45 #include "wtf/Allocator.h" |
| 46 #include "wtf/Noncopyable.h" | 46 #include "wtf/Noncopyable.h" |
| 47 #include "wtf/OwnPtr.h" |
| 48 #include "wtf/PassOwnPtr.h" |
| 47 #include "wtf/Vector.h" | 49 #include "wtf/Vector.h" |
| 48 #include <memory> | |
| 49 | 50 |
| 50 #define MAX_DICTIONARY_ENTRY_BITS 12 | 51 #define MAX_DICTIONARY_ENTRY_BITS 12 |
| 51 #define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS | 52 #define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS |
| 52 #define MAX_COLORS 256 | 53 #define MAX_COLORS 256 |
| 53 #define BYTES_PER_COLORMAP_ENTRY 3 | 54 #define BYTES_PER_COLORMAP_ENTRY 3 |
| 54 | 55 |
| 55 const int cLoopCountNotSeen = -2; | 56 const int cLoopCountNotSeen = -2; |
| 56 | 57 |
| 57 // List of possible parsing states. | 58 // List of possible parsing states. |
| 58 enum GIFState { | 59 enum GIFState { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 unsigned m_height; | 260 unsigned m_height; |
| 260 size_t m_transparentPixel; // Index of transparent pixel. Value is kNotFound
if there is no transparent pixel. | 261 size_t m_transparentPixel; // Index of transparent pixel. Value is kNotFound
if there is no transparent pixel. |
| 261 blink::ImageFrame::DisposalMethod m_disposalMethod; // Restore to background
, leave in place, etc. | 262 blink::ImageFrame::DisposalMethod m_disposalMethod; // Restore to background
, leave in place, etc. |
| 262 int m_dataSize; | 263 int m_dataSize; |
| 263 | 264 |
| 264 bool m_progressiveDisplay; // If true, do Haeberli interlace hack. | 265 bool m_progressiveDisplay; // If true, do Haeberli interlace hack. |
| 265 bool m_interlaced; // True, if scanlines arrive interlaced order. | 266 bool m_interlaced; // True, if scanlines arrive interlaced order. |
| 266 | 267 |
| 267 unsigned m_delayTime; // Display time, in milliseconds, for this image in a
multi-image GIF. | 268 unsigned m_delayTime; // Display time, in milliseconds, for this image in a
multi-image GIF. |
| 268 | 269 |
| 269 std::unique_ptr<GIFLZWContext> m_lzwContext; | 270 OwnPtr<GIFLZWContext> m_lzwContext; |
| 270 Vector<GIFLZWBlock> m_lzwBlocks; // LZW blocks for this frame. | 271 Vector<GIFLZWBlock> m_lzwBlocks; // LZW blocks for this frame. |
| 271 GIFColorMap m_localColorMap; | 272 GIFColorMap m_localColorMap; |
| 272 | 273 |
| 273 size_t m_currentLzwBlock; | 274 size_t m_currentLzwBlock; |
| 274 bool m_isComplete; | 275 bool m_isComplete; |
| 275 bool m_isHeaderDefined; | 276 bool m_isHeaderDefined; |
| 276 bool m_isDataSizeDefined; | 277 bool m_isDataSizeDefined; |
| 277 }; | 278 }; |
| 278 | 279 |
| 279 class PLATFORM_EXPORT GIFImageReader final { | 280 class PLATFORM_EXPORT GIFImageReader final { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 size_t m_bytesRead; // Number of bytes processed. | 346 size_t m_bytesRead; // Number of bytes processed. |
| 346 | 347 |
| 347 // Global (multi-image) state. | 348 // Global (multi-image) state. |
| 348 int m_version; // Either 89 for GIF89 or 87 for GIF87. | 349 int m_version; // Either 89 for GIF89 or 87 for GIF87. |
| 349 unsigned m_screenWidth; // Logical screen width & height. | 350 unsigned m_screenWidth; // Logical screen width & height. |
| 350 unsigned m_screenHeight; | 351 unsigned m_screenHeight; |
| 351 bool m_sentSizeToClient; | 352 bool m_sentSizeToClient; |
| 352 GIFColorMap m_globalColorMap; | 353 GIFColorMap m_globalColorMap; |
| 353 int m_loopCount; // Netscape specific extension block to control the number
of animation loops a GIF renders. | 354 int m_loopCount; // Netscape specific extension block to control the number
of animation loops a GIF renders. |
| 354 | 355 |
| 355 Vector<std::unique_ptr<GIFFrameContext>> m_frames; | 356 Vector<OwnPtr<GIFFrameContext>> m_frames; |
| 356 | 357 |
| 357 RefPtr<blink::SegmentReader> m_data; | 358 RefPtr<blink::SegmentReader> m_data; |
| 358 bool m_parseCompleted; | 359 bool m_parseCompleted; |
| 359 }; | 360 }; |
| 360 | 361 |
| 361 #endif | 362 #endif |
| OLD | NEW |