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