Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: third_party/gif/SkGifImageReader.h

Issue 2445653004: Rename GIFImageReader to SkGifImageReader (Closed)
Patch Set: Remove dependent patch set Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/gif/GIFImageReader.cpp ('k') | third_party/gif/SkGifImageReader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 * of those above. If you wish to allow use of your version of this file only 28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to 29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your 30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice 31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete 32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under 33 * the provisions above, a recipient may use your version of this file under
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 SkGifImageReader_h
39 #define GIFImageReader_h 39 #define SkGifImageReader_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 class SkGifCodec; 43 class SkGifCodec;
44 44
45 #include "SkCodec.h" 45 #include "SkCodec.h"
46 #include "SkCodecPriv.h" 46 #include "SkCodecPriv.h"
47 #include "SkCodecAnimation.h" 47 #include "SkCodecAnimation.h"
48 #include "SkColorTable.h" 48 #include "SkColorTable.h"
49 #include "SkData.h" 49 #include "SkData.h"
50 #include "SkImageInfo.h" 50 #include "SkImageInfo.h"
51 #include "SkStreamBuffer.h" 51 #include "SkStreamBuffer.h"
52 #include "../private/SkTArray.h" 52 #include "../private/SkTArray.h"
53 #include <memory> 53 #include <memory>
54 #include <vector> 54 #include <vector>
55 55
56 typedef SkTArray<unsigned char, true> GIFRow; 56 typedef SkTArray<unsigned char, true> GIFRow;
dogben 2016/10/25 17:32:43 There are a ton of top-level non-static declaratio
57 57
58 58
59 #define MAX_DICTIONARY_ENTRY_BITS 12 59 #define MAX_DICTIONARY_ENTRY_BITS 12
60 #define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS 60 #define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS
61 #define MAX_COLORS 256 61 #define MAX_COLORS 256
62 #define BYTES_PER_COLORMAP_ENTRY 3 62 #define BYTES_PER_COLORMAP_ENTRY 3
63 63
64 constexpr int cLoopCountNotSeen = -2; 64 constexpr int cLoopCountNotSeen = -2;
65 constexpr size_t kNotFound = static_cast<size_t>(-1); 65 constexpr size_t kNotFound = static_cast<size_t>(-1);
66 66
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 std::unique_ptr<GIFLZWContext> m_lzwContext; 268 std::unique_ptr<GIFLZWContext> m_lzwContext;
269 std::vector<sk_sp<SkData>> m_lzwBlocks; // LZW blocks for this frame. 269 std::vector<sk_sp<SkData>> m_lzwBlocks; // LZW blocks for this frame.
270 GIFColorMap m_localColorMap; 270 GIFColorMap m_localColorMap;
271 271
272 size_t m_currentLzwBlock; 272 size_t m_currentLzwBlock;
273 bool m_isComplete; 273 bool m_isComplete;
274 bool m_isHeaderDefined; 274 bool m_isHeaderDefined;
275 bool m_isDataSizeDefined; 275 bool m_isDataSizeDefined;
276 }; 276 };
277 277
278 class GIFImageReader final : public SkNoncopyable { 278 class SkGifImageReader final : public SkNoncopyable {
279 public: 279 public:
280 // This takes ownership of stream. 280 // This takes ownership of stream.
281 GIFImageReader(SkStream* stream) 281 SkGifImageReader(SkStream* stream)
282 : m_client(nullptr) 282 : m_client(nullptr)
283 , m_state(GIFType) 283 , m_state(GIFType)
284 , 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".
285 , m_version(0) 285 , m_version(0)
286 , m_screenWidth(0) 286 , m_screenWidth(0)
287 , m_screenHeight(0) 287 , m_screenHeight(0)
288 , m_loopCount(cLoopCountNotSeen) 288 , m_loopCount(cLoopCountNotSeen)
289 , m_streamBuffer(stream) 289 , m_streamBuffer(stream)
290 , m_parseCompleted(false) 290 , m_parseCompleted(false)
291 , m_firstFrameHasAlpha(false) 291 , m_firstFrameHasAlpha(false)
292 , m_firstFrameSupportsIndex8(false) 292 , m_firstFrameSupportsIndex8(false)
293 { 293 {
294 } 294 }
295 295
296 ~GIFImageReader() 296 ~SkGifImageReader()
297 { 297 {
298 } 298 }
299 299
300 void setClient(SkGifCodec* client) { m_client = client; } 300 void setClient(SkGifCodec* client) { m_client = client; }
301 301
302 unsigned screenWidth() const { return m_screenWidth; } 302 unsigned screenWidth() const { return m_screenWidth; }
303 unsigned screenHeight() const { return m_screenHeight; } 303 unsigned screenHeight() const { return m_screenHeight; }
304 304
305 // Option to pass to parse(). All enums are negative, because a non-negative value is used to 305 // Option to pass to parse(). All enums are negative, because a non-negative value is used to
306 // indicate that the Reader should parse up to and including the frame indic ated. 306 // indicate that the Reader should parse up to and including the frame indic ated.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 SkStreamBuffer m_streamBuffer; 389 SkStreamBuffer m_streamBuffer;
390 bool m_parseCompleted; 390 bool m_parseCompleted;
391 391
392 // These values can be computed before we create a GIFFrameContext, so we 392 // These values can be computed before we create a GIFFrameContext, so we
393 // store them here instead of on m_frames[0]. 393 // store them here instead of on m_frames[0].
394 bool m_firstFrameHasAlpha; 394 bool m_firstFrameHasAlpha;
395 bool m_firstFrameSupportsIndex8; 395 bool m_firstFrameSupportsIndex8;
396 }; 396 };
397 397
398 #endif 398 #endif
OLDNEW
« no previous file with comments | « third_party/gif/GIFImageReader.cpp ('k') | third_party/gif/SkGifImageReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698