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

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

Issue 2447863002: Report repetition count in SkCodec (Closed)
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
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include <vector> 54 #include <vector>
55 55
56 typedef SkTArray<unsigned char, true> GIFRow; 56 typedef SkTArray<unsigned char, true> GIFRow;
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;
65 constexpr size_t kNotFound = static_cast<size_t>(-1); 64 constexpr size_t kNotFound = static_cast<size_t>(-1);
66 65
67 // List of possible parsing states. 66 // List of possible parsing states.
68 enum GIFState { 67 enum GIFState {
69 GIFType, 68 GIFType,
70 GIFGlobalHeader, 69 GIFGlobalHeader,
71 GIFGlobalColormap, 70 GIFGlobalColormap,
72 GIFImageStart, 71 GIFImageStart,
73 GIFImageHeader, 72 GIFImageHeader,
74 GIFImageColormap, 73 GIFImageColormap,
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 class SkGifImageReader final : public SkNoncopyable { 277 class SkGifImageReader final : public SkNoncopyable {
279 public: 278 public:
280 // This takes ownership of stream. 279 // This takes ownership of stream.
281 SkGifImageReader(SkStream* stream) 280 SkGifImageReader(SkStream* stream)
282 : m_client(nullptr) 281 : m_client(nullptr)
283 , m_state(GIFType) 282 , m_state(GIFType)
284 , m_bytesToConsume(6) // Number of bytes for GIF type, either "GIF87a" o r "GIF89a". 283 , m_bytesToConsume(6) // Number of bytes for GIF type, either "GIF87a" o r "GIF89a".
285 , m_version(0) 284 , m_version(0)
286 , m_screenWidth(0) 285 , m_screenWidth(0)
287 , m_screenHeight(0) 286 , m_screenHeight(0)
288 , m_loopCount(cLoopCountNotSeen) 287 , m_loopCount(0)
289 , m_streamBuffer(stream) 288 , m_streamBuffer(stream)
290 , m_parseCompleted(false) 289 , m_parseCompleted(false)
291 , m_firstFrameHasAlpha(false) 290 , m_firstFrameHasAlpha(false)
292 , m_firstFrameSupportsIndex8(false) 291 , m_firstFrameSupportsIndex8(false)
293 { 292 {
294 } 293 }
295 294
296 ~SkGifImageReader() 295 ~SkGifImageReader()
297 { 296 {
298 } 297 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 SkStreamBuffer m_streamBuffer; 388 SkStreamBuffer m_streamBuffer;
390 bool m_parseCompleted; 389 bool m_parseCompleted;
391 390
392 // These values can be computed before we create a GIFFrameContext, so we 391 // These values can be computed before we create a GIFFrameContext, so we
393 // store them here instead of on m_frames[0]. 392 // store them here instead of on m_frames[0].
394 bool m_firstFrameHasAlpha; 393 bool m_firstFrameHasAlpha;
395 bool m_firstFrameSupportsIndex8; 394 bool m_firstFrameSupportsIndex8;
396 }; 395 };
397 396
398 #endif 397 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698