| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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> SkGIFRow; |
| 57 | 57 |
| 58 | 58 |
| 59 #define MAX_DICTIONARY_ENTRY_BITS 12 | 59 #define SK_MAX_DICTIONARY_ENTRY_BITS 12 |
| 60 #define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS | 60 #define SK_MAX_DICTIONARY_ENTRIES 4096 // 2^SK_MAX_DICTIONARY_ENTRY_BITS |
| 61 #define MAX_COLORS 256 | 61 #define SK_MAX_COLORS 256 |
| 62 #define BYTES_PER_COLORMAP_ENTRY 3 | 62 #define SK_BYTES_PER_COLORMAP_ENTRY 3 |
| 63 | |
| 64 constexpr int cLoopCountNotSeen = -2; | |
| 65 constexpr size_t kNotFound = static_cast<size_t>(-1); | |
| 66 | 63 |
| 67 // List of possible parsing states. | 64 // List of possible parsing states. |
| 68 enum GIFState { | 65 enum SkGIFState { |
| 69 GIFType, | 66 SkGIFType, |
| 70 GIFGlobalHeader, | 67 SkGIFGlobalHeader, |
| 71 GIFGlobalColormap, | 68 SkGIFGlobalColormap, |
| 72 GIFImageStart, | 69 SkGIFImageStart, |
| 73 GIFImageHeader, | 70 SkGIFImageHeader, |
| 74 GIFImageColormap, | 71 SkGIFImageColormap, |
| 75 GIFImageBody, | 72 SkGIFImageBody, |
| 76 GIFLZWStart, | 73 SkGIFLZWStart, |
| 77 GIFLZW, | 74 SkGIFLZW, |
| 78 GIFSubBlock, | 75 SkGIFSubBlock, |
| 79 GIFExtension, | 76 SkGIFExtension, |
| 80 GIFControlExtension, | 77 SkGIFControlExtension, |
| 81 GIFConsumeBlock, | 78 SkGIFConsumeBlock, |
| 82 GIFSkipBlock, | 79 SkGIFSkipBlock, |
| 83 GIFDone, | 80 SkGIFDone, |
| 84 GIFCommentExtension, | 81 SkGIFCommentExtension, |
| 85 GIFApplicationExtension, | 82 SkGIFApplicationExtension, |
| 86 GIFNetscapeExtensionBlock, | 83 SkGIFNetscapeExtensionBlock, |
| 87 GIFConsumeNetscapeExtension, | 84 SkGIFConsumeNetscapeExtension, |
| 88 GIFConsumeComment | 85 SkGIFConsumeComment |
| 89 }; | 86 }; |
| 90 | 87 |
| 91 struct GIFFrameContext; | 88 struct SkGIFFrameContext; |
| 92 | 89 |
| 93 // LZW decoder state machine. | 90 // LZW decoder state machine. |
| 94 class GIFLZWContext final : public SkNoncopyable { | 91 class SkGIFLZWContext final : public SkNoncopyable { |
| 95 public: | 92 public: |
| 96 GIFLZWContext(SkGifCodec* client, const GIFFrameContext* frameContext) | 93 SkGIFLZWContext(SkGifCodec* client, const SkGIFFrameContext* frameContext) |
| 97 : codesize(0) | 94 : codesize(0) |
| 98 , codemask(0) | 95 , codemask(0) |
| 99 , clearCode(0) | 96 , clearCode(0) |
| 100 , avail(0) | 97 , avail(0) |
| 101 , oldcode(0) | 98 , oldcode(0) |
| 102 , firstchar(0) | 99 , firstchar(0) |
| 103 , bits(0) | 100 , bits(0) |
| 104 , datum(0) | 101 , datum(0) |
| 105 , ipass(0) | 102 , ipass(0) |
| 106 , irow(0) | 103 , irow(0) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 122 int clearCode; // Codeword used to trigger dictionary reset. | 119 int clearCode; // Codeword used to trigger dictionary reset. |
| 123 int avail; // Index of next available slot in dictionary. | 120 int avail; // Index of next available slot in dictionary. |
| 124 int oldcode; | 121 int oldcode; |
| 125 unsigned char firstchar; | 122 unsigned char firstchar; |
| 126 int bits; // Number of unread bits in "datum". | 123 int bits; // Number of unread bits in "datum". |
| 127 int datum; // 32-bit input buffer. | 124 int datum; // 32-bit input buffer. |
| 128 int ipass; // Interlace pass; Ranges 1-4 if interlaced. | 125 int ipass; // Interlace pass; Ranges 1-4 if interlaced. |
| 129 size_t irow; // Current output row, starting at zero. | 126 size_t irow; // Current output row, starting at zero. |
| 130 size_t rowsRemaining; // Rows remaining to be output. | 127 size_t rowsRemaining; // Rows remaining to be output. |
| 131 | 128 |
| 132 unsigned short prefix[MAX_DICTIONARY_ENTRIES]; | 129 unsigned short prefix[SK_MAX_DICTIONARY_ENTRIES]; |
| 133 unsigned char suffix[MAX_DICTIONARY_ENTRIES]; | 130 unsigned char suffix[SK_MAX_DICTIONARY_ENTRIES]; |
| 134 unsigned short suffixLength[MAX_DICTIONARY_ENTRIES]; | 131 unsigned short suffixLength[SK_MAX_DICTIONARY_ENTRIES]; |
| 135 GIFRow rowBuffer; // Single scanline temporary buffer. | 132 SkGIFRow rowBuffer; // Single scanline temporary buffer. |
| 136 unsigned char* rowIter; | 133 unsigned char* rowIter; |
| 137 | 134 |
| 138 SkGifCodec* const m_client; | 135 SkGifCodec* const m_client; |
| 139 const GIFFrameContext* m_frameContext; | 136 const SkGIFFrameContext* m_frameContext; |
| 140 }; | 137 }; |
| 141 | 138 |
| 142 class GIFColorMap final { | 139 class SkGIFColorMap final { |
| 143 public: | 140 public: |
| 144 GIFColorMap() | 141 SkGIFColorMap() |
| 145 : m_isDefined(false) | 142 : m_isDefined(false) |
| 146 , m_colors(0) | 143 , m_colors(0) |
| 147 , m_packColorProc(nullptr) | 144 , m_packColorProc(nullptr) |
| 148 { | 145 { |
| 149 } | 146 } |
| 150 | 147 |
| 151 void setNumColors(size_t colors) { | 148 void setNumColors(size_t colors) { |
| 152 m_colors = colors; | 149 m_colors = colors; |
| 153 } | 150 } |
| 154 | 151 |
| 155 size_t numColors() const { return m_colors; } | 152 size_t numColors() const { return m_colors; } |
| 156 | 153 |
| 157 void setRawData(const char* data, size_t size) | 154 void setRawData(const char* data, size_t size) |
| 158 { | 155 { |
| 159 // FIXME: Can we avoid this copy? | 156 // FIXME: Can we avoid this copy? |
| 160 m_rawData = SkData::MakeWithCopy(data, size); | 157 m_rawData = SkData::MakeWithCopy(data, size); |
| 161 SkASSERT(m_colors * BYTES_PER_COLORMAP_ENTRY == size); | 158 SkASSERT(m_colors * SK_BYTES_PER_COLORMAP_ENTRY == size); |
| 162 m_isDefined = true; | 159 m_isDefined = true; |
| 163 } | 160 } |
| 164 bool isDefined() const { return m_isDefined; } | 161 bool isDefined() const { return m_isDefined; } |
| 165 | 162 |
| 166 // Build RGBA table using the data stream. | 163 // Build RGBA table using the data stream. |
| 167 sk_sp<SkColorTable> buildTable(SkColorType dstColorType, size_t transparentP
ixel) const; | 164 sk_sp<SkColorTable> buildTable(SkColorType dstColorType, size_t transparentP
ixel) const; |
| 168 | 165 |
| 169 private: | 166 private: |
| 170 bool m_isDefined; | 167 bool m_isDefined; |
| 171 size_t m_colors; | 168 size_t m_colors; |
| 172 sk_sp<SkData> m_rawData; | 169 sk_sp<SkData> m_rawData; |
| 173 mutable PackColorProc m_packColorProc; | 170 mutable PackColorProc m_packColorProc; |
| 174 mutable sk_sp<SkColorTable> m_table; | 171 mutable sk_sp<SkColorTable> m_table; |
| 175 }; | 172 }; |
| 176 | 173 |
| 177 // LocalFrame output state machine. | 174 // LocalFrame output state machine. |
| 178 struct GIFFrameContext : SkNoncopyable { | 175 struct SkGIFFrameContext : SkNoncopyable { |
| 179 public: | 176 public: |
| 180 GIFFrameContext(int id) | 177 SkGIFFrameContext(int id) |
| 181 : m_frameId(id) | 178 : m_frameId(id) |
| 182 , m_xOffset(0) | 179 , m_xOffset(0) |
| 183 , m_yOffset(0) | 180 , m_yOffset(0) |
| 184 , m_width(0) | 181 , m_width(0) |
| 185 , m_height(0) | 182 , m_height(0) |
| 186 , m_transparentPixel(kNotFound) | 183 , m_transparentPixel(kNotFound) |
| 187 , m_disposalMethod(SkCodecAnimation::Keep_DisposalMethod) | 184 , m_disposalMethod(SkCodecAnimation::Keep_DisposalMethod) |
| 188 , m_requiredFrame(SkCodec::kNone) | 185 , m_requiredFrame(SkCodec::kNone) |
| 189 , m_dataSize(0) | 186 , m_dataSize(0) |
| 190 , m_progressiveDisplay(false) | 187 , m_progressiveDisplay(false) |
| 191 , m_interlaced(false) | 188 , m_interlaced(false) |
| 192 , m_delayTime(0) | 189 , m_delayTime(0) |
| 193 , m_currentLzwBlock(0) | 190 , m_currentLzwBlock(0) |
| 194 , m_isComplete(false) | 191 , m_isComplete(false) |
| 195 , m_isHeaderDefined(false) | 192 , m_isHeaderDefined(false) |
| 196 , m_isDataSizeDefined(false) | 193 , m_isDataSizeDefined(false) |
| 197 { | 194 { |
| 198 } | 195 } |
| 199 | 196 |
| 200 ~GIFFrameContext() | 197 static constexpr size_t kNotFound = static_cast<size_t>(-1); |
| 198 |
| 199 ~SkGIFFrameContext() |
| 201 { | 200 { |
| 202 } | 201 } |
| 203 | 202 |
| 204 void addLzwBlock(const void* data, size_t size) | 203 void addLzwBlock(const void* data, size_t size) |
| 205 { | 204 { |
| 206 m_lzwBlocks.push_back(SkData::MakeWithCopy(data, size)); | 205 m_lzwBlocks.push_back(SkData::MakeWithCopy(data, size)); |
| 207 } | 206 } |
| 208 | 207 |
| 209 bool decode(SkGifCodec* client, bool* frameDecoded); | 208 bool decode(SkGifCodec* client, bool* frameDecoded); |
| 210 | 209 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 239 { | 238 { |
| 240 m_dataSize = size; | 239 m_dataSize = size; |
| 241 m_isDataSizeDefined = true; | 240 m_isDataSizeDefined = true; |
| 242 } | 241 } |
| 243 bool progressiveDisplay() const { return m_progressiveDisplay; } | 242 bool progressiveDisplay() const { return m_progressiveDisplay; } |
| 244 void setProgressiveDisplay(bool progressiveDisplay) { m_progressiveDisplay =
progressiveDisplay; } | 243 void setProgressiveDisplay(bool progressiveDisplay) { m_progressiveDisplay =
progressiveDisplay; } |
| 245 bool interlaced() const { return m_interlaced; } | 244 bool interlaced() const { return m_interlaced; } |
| 246 void setInterlaced(bool interlaced) { m_interlaced = interlaced; } | 245 void setInterlaced(bool interlaced) { m_interlaced = interlaced; } |
| 247 | 246 |
| 248 void clearDecodeState() { m_lzwContext.reset(); } | 247 void clearDecodeState() { m_lzwContext.reset(); } |
| 249 const GIFColorMap& localColorMap() const { return m_localColorMap; } | 248 const SkGIFColorMap& localColorMap() const { return m_localColorMap; } |
| 250 GIFColorMap& localColorMap() { return m_localColorMap; } | 249 SkGIFColorMap& localColorMap() { return m_localColorMap; } |
| 251 | 250 |
| 252 private: | 251 private: |
| 253 int m_frameId; | 252 int m_frameId; |
| 254 unsigned m_xOffset; | 253 unsigned m_xOffset; |
| 255 unsigned m_yOffset; // With respect to "screen" origin. | 254 unsigned m_yOffset; // With respect to "screen" origin. |
| 256 unsigned m_width; | 255 unsigned m_width; |
| 257 unsigned m_height; | 256 unsigned m_height; |
| 258 size_t m_transparentPixel; // Index of transparent pixel. Value is kNotFound
if there is no transparent pixel. | 257 size_t m_transparentPixel; // Index of transparent pixel. Value is kNotFound
if there is no transparent pixel. |
| 259 SkCodecAnimation::DisposalMethod m_disposalMethod; // Restore to background,
leave in place, etc. | 258 SkCodecAnimation::DisposalMethod m_disposalMethod; // Restore to background,
leave in place, etc. |
| 260 size_t m_requiredFrame; | 259 size_t m_requiredFrame; |
| 261 int m_dataSize; | 260 int m_dataSize; |
| 262 | 261 |
| 263 bool m_progressiveDisplay; // If true, do Haeberli interlace hack. | 262 bool m_progressiveDisplay; // If true, do Haeberli interlace hack. |
| 264 bool m_interlaced; // True, if scanlines arrive interlaced order. | 263 bool m_interlaced; // True, if scanlines arrive interlaced order. |
| 265 | 264 |
| 266 unsigned m_delayTime; // Display time, in milliseconds, for this image in a
multi-image GIF. | 265 unsigned m_delayTime; // Display time, in milliseconds, for this image in a
multi-image GIF. |
| 267 | 266 |
| 268 std::unique_ptr<GIFLZWContext> m_lzwContext; | 267 std::unique_ptr<SkGIFLZWContext> m_lzwContext; |
| 269 std::vector<sk_sp<SkData>> m_lzwBlocks; // LZW blocks for this frame. | 268 std::vector<sk_sp<SkData>> m_lzwBlocks; // LZW blocks for this frame. |
| 270 GIFColorMap m_localColorMap; | 269 SkGIFColorMap m_localColorMap; |
| 271 | 270 |
| 272 size_t m_currentLzwBlock; | 271 size_t m_currentLzwBlock; |
| 273 bool m_isComplete; | 272 bool m_isComplete; |
| 274 bool m_isHeaderDefined; | 273 bool m_isHeaderDefined; |
| 275 bool m_isDataSizeDefined; | 274 bool m_isDataSizeDefined; |
| 276 }; | 275 }; |
| 277 | 276 |
| 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(SkGIFType) |
| 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(cLoopCountNotSeen) |
| 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 |
| 295 static constexpr int cLoopCountNotSeen = -2; |
| 296 |
| 296 ~SkGifImageReader() | 297 ~SkGifImageReader() |
| 297 { | 298 { |
| 298 } | 299 } |
| 299 | 300 |
| 300 void setClient(SkGifCodec* client) { m_client = client; } | 301 void setClient(SkGifCodec* client) { m_client = client; } |
| 301 | 302 |
| 302 unsigned screenWidth() const { return m_screenWidth; } | 303 unsigned screenWidth() const { return m_screenWidth; } |
| 303 unsigned screenHeight() const { return m_screenHeight; } | 304 unsigned screenHeight() const { return m_screenHeight; } |
| 304 | 305 |
| 305 // Option to pass to parse(). All enums are negative, because a non-negative
value is used to | 306 // 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. | 307 // indicate that the Reader should parse up to and including the frame indic
ated. |
| 307 enum GIFParseQuery { | 308 enum SkGIFParseQuery { |
| 308 // Parse enough to determine the size. Note that this parses the first f
rame's header, | 309 // Parse enough to determine the size. Note that this parses the first f
rame's header, |
| 309 // since we may decide to expand based on the frame's dimensions. | 310 // since we may decide to expand based on the frame's dimensions. |
| 310 GIFSizeQuery = -1, | 311 SkGIFSizeQuery = -1, |
| 311 // Parse to the end, so we know about all frames. | 312 // Parse to the end, so we know about all frames. |
| 312 GIFFrameCountQuery = -2, | 313 SkGIFFrameCountQuery = -2, |
| 313 }; | 314 }; |
| 314 | 315 |
| 315 // Parse incoming GIF data stream into internal data structures. | 316 // Parse incoming GIF data stream into internal data structures. |
| 316 // Non-negative values are used to indicate to parse through that frame. | 317 // Non-negative values are used to indicate to parse through that frame. |
| 317 // Return true if parsing has progressed or there is not enough data. | 318 // Return true if parsing has progressed or there is not enough data. |
| 318 // Return false if a fatal error is encountered. | 319 // Return false if a fatal error is encountered. |
| 319 bool parse(GIFParseQuery); | 320 bool parse(SkGIFParseQuery); |
| 320 | 321 |
| 321 // Decode the frame indicated by frameIndex. | 322 // Decode the frame indicated by frameIndex. |
| 322 // frameComplete will be set to true if the frame is completely decoded. | 323 // frameComplete will be set to true if the frame is completely decoded. |
| 323 // The method returns false if there is an error. | 324 // The method returns false if there is an error. |
| 324 bool decode(size_t frameIndex, bool* frameComplete); | 325 bool decode(size_t frameIndex, bool* frameComplete); |
| 325 | 326 |
| 326 size_t imagesCount() const | 327 size_t imagesCount() const |
| 327 { | 328 { |
| 328 if (m_frames.empty()) | 329 if (m_frames.empty()) |
| 329 return 0; | 330 return 0; |
| 330 | 331 |
| 331 // This avoids counting an empty frame when the file is truncated right
after | 332 // This avoids counting an empty frame when the file is truncated right
after |
| 332 // GIFControlExtension but before GIFImageHeader. | 333 // SkGIFControlExtension but before SkGIFImageHeader. |
| 333 // FIXME: This extra complexity is not necessary and we should just repo
rt m_frames.size(). | 334 // FIXME: This extra complexity is not necessary and we should just repo
rt m_frames.size(). |
| 334 return m_frames.back()->isHeaderDefined() ? m_frames.size() : m_frames.s
ize() - 1; | 335 return m_frames.back()->isHeaderDefined() ? m_frames.size() : m_frames.s
ize() - 1; |
| 335 } | 336 } |
| 336 int loopCount() const { return m_loopCount; } | 337 int loopCount() const { return m_loopCount; } |
| 337 | 338 |
| 338 const GIFColorMap& globalColorMap() const | 339 const SkGIFColorMap& globalColorMap() const |
| 339 { | 340 { |
| 340 return m_globalColorMap; | 341 return m_globalColorMap; |
| 341 } | 342 } |
| 342 | 343 |
| 343 const GIFFrameContext* frameContext(size_t index) const | 344 const SkGIFFrameContext* frameContext(size_t index) const |
| 344 { | 345 { |
| 345 return index < m_frames.size() ? m_frames[index].get() : 0; | 346 return index < m_frames.size() ? m_frames[index].get() : 0; |
| 346 } | 347 } |
| 347 | 348 |
| 348 void clearDecodeState() { | 349 void clearDecodeState() { |
| 349 for (size_t index = 0; index < m_frames.size(); index++) { | 350 for (size_t index = 0; index < m_frames.size(); index++) { |
| 350 m_frames[index]->clearDecodeState(); | 351 m_frames[index]->clearDecodeState(); |
| 351 } | 352 } |
| 352 } | 353 } |
| 353 | 354 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 367 void addFrameIfNecessary(); | 368 void addFrameIfNecessary(); |
| 368 bool currentFrameIsFirstFrame() const | 369 bool currentFrameIsFirstFrame() const |
| 369 { | 370 { |
| 370 return m_frames.empty() || (m_frames.size() == 1u && !m_frames[0]->isCom
plete()); | 371 return m_frames.empty() || (m_frames.size() == 1u && !m_frames[0]->isCom
plete()); |
| 371 } | 372 } |
| 372 | 373 |
| 373 // Unowned pointer | 374 // Unowned pointer |
| 374 SkGifCodec* m_client; | 375 SkGifCodec* m_client; |
| 375 | 376 |
| 376 // Parsing state machine. | 377 // Parsing state machine. |
| 377 GIFState m_state; // Current decoder master state. | 378 SkGIFState m_state; // Current decoder master state. |
| 378 size_t m_bytesToConsume; // Number of bytes to consume for next stage of par
sing. | 379 size_t m_bytesToConsume; // Number of bytes to consume for next stage of par
sing. |
| 379 | 380 |
| 380 // Global (multi-image) state. | 381 // Global (multi-image) state. |
| 381 int m_version; // Either 89 for GIF89 or 87 for GIF87. | 382 int m_version; // Either 89 for GIF89 or 87 for GIF87. |
| 382 unsigned m_screenWidth; // Logical screen width & height. | 383 unsigned m_screenWidth; // Logical screen width & height. |
| 383 unsigned m_screenHeight; | 384 unsigned m_screenHeight; |
| 384 GIFColorMap m_globalColorMap; | 385 SkGIFColorMap m_globalColorMap; |
| 385 int m_loopCount; // Netscape specific extension block to control the number
of animation loops a GIF renders. | 386 int m_loopCount; // Netscape specific extension block to control the number
of animation loops a GIF renders. |
| 386 | 387 |
| 387 std::vector<std::unique_ptr<GIFFrameContext>> m_frames; | 388 std::vector<std::unique_ptr<SkGIFFrameContext>> m_frames; |
| 388 | 389 |
| 389 SkStreamBuffer m_streamBuffer; | 390 SkStreamBuffer m_streamBuffer; |
| 390 bool m_parseCompleted; | 391 bool m_parseCompleted; |
| 391 | 392 |
| 392 // These values can be computed before we create a GIFFrameContext, so we | 393 // These values can be computed before we create a SkGIFFrameContext, so we |
| 393 // store them here instead of on m_frames[0]. | 394 // store them here instead of on m_frames[0]. |
| 394 bool m_firstFrameHasAlpha; | 395 bool m_firstFrameHasAlpha; |
| 395 bool m_firstFrameSupportsIndex8; | 396 bool m_firstFrameSupportsIndex8; |
| 396 }; | 397 }; |
| 397 | 398 |
| 398 #endif | 399 #endif |
| OLD | NEW |