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

Side by Side Diff: Source/WebCore/platform/image-decoders/gif/GIFImageReader.h

Issue 13578002: Merge 147392 "Simply GIFImageReader error handling" (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1453/
Patch Set: Created 7 years, 8 months 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 , m_bytesRead(0) 233 , m_bytesRead(0)
234 , m_screenBgcolor(0) 234 , m_screenBgcolor(0)
235 , m_version(0) 235 , m_version(0)
236 , m_screenWidth(0) 236 , m_screenWidth(0)
237 , m_screenHeight(0) 237 , m_screenHeight(0)
238 , m_isGlobalColormapDefined(false) 238 , m_isGlobalColormapDefined(false)
239 , m_globalColormapPosition(0) 239 , m_globalColormapPosition(0)
240 , m_globalColormapSize(0) 240 , m_globalColormapSize(0)
241 , m_loopCount(cLoopCountNotSeen) 241 , m_loopCount(cLoopCountNotSeen)
242 , m_currentDecodingFrame(0) 242 , m_currentDecodingFrame(0)
243 , m_parseFailed(false)
244 , m_parseCompleted(false) 243 , m_parseCompleted(false)
245 { 244 {
246 } 245 }
247 246
248 ~GIFImageReader() 247 ~GIFImageReader()
249 { 248 {
250 } 249 }
251 250
252 void setData(PassRefPtr<WebCore::SharedBuffer> data) { m_data = data; } 251 void setData(PassRefPtr<WebCore::SharedBuffer> data) { m_data = data; }
253 // FIXME: haltAtFrame should be size_t. 252 // FIXME: haltAtFrame should be size_t.
(...skipping 27 matching lines...) Expand all
281 int localColormapSize(const GIFFrameContext* frame) const 280 int localColormapSize(const GIFFrameContext* frame) const
282 { 281 {
283 return frame->isLocalColormapDefined ? frame->localColormapSize : 0; 282 return frame->isLocalColormapDefined ? frame->localColormapSize : 0;
284 } 283 }
285 284
286 const GIFFrameContext* frameContext() const 285 const GIFFrameContext* frameContext() const
287 { 286 {
288 return m_currentDecodingFrame < m_frames.size() ? m_frames[m_currentDeco dingFrame].get() : 0; 287 return m_currentDecodingFrame < m_frames.size() ? m_frames[m_currentDeco dingFrame].get() : 0;
289 } 288 }
290 289
291 bool parseFailed() const { return m_parseFailed; }
292
293 private: 290 private:
294 bool parse(size_t dataPosition, size_t len, bool parseSizeOnly); 291 bool parse(size_t dataPosition, size_t len, bool parseSizeOnly);
295 void setRemainingBytes(size_t); 292 void setRemainingBytes(size_t);
296 293
297 const unsigned char* data(size_t dataPosition) const 294 const unsigned char* data(size_t dataPosition) const
298 { 295 {
299 return reinterpret_cast<const unsigned char*>(m_data->data()) + dataPosi tion; 296 return reinterpret_cast<const unsigned char*>(m_data->data()) + dataPosi tion;
300 } 297 }
301 298
302 void addFrameIfNecessary(); 299 void addFrameIfNecessary();
(...skipping 16 matching lines...) Expand all
319 unsigned m_screenHeight; 316 unsigned m_screenHeight;
320 bool m_isGlobalColormapDefined; 317 bool m_isGlobalColormapDefined;
321 size_t m_globalColormapPosition; // (3* MAX_COLORS in size) Default colormap if local not supplied, 3 bytes for each color. 318 size_t m_globalColormapPosition; // (3* MAX_COLORS in size) Default colormap if local not supplied, 3 bytes for each color.
322 int m_globalColormapSize; // Size of global colormap array. 319 int m_globalColormapSize; // Size of global colormap array.
323 int m_loopCount; // Netscape specific extension block to control the number of animation loops a GIF renders. 320 int m_loopCount; // Netscape specific extension block to control the number of animation loops a GIF renders.
324 321
325 Vector<OwnPtr<GIFFrameContext> > m_frames; 322 Vector<OwnPtr<GIFFrameContext> > m_frames;
326 size_t m_currentDecodingFrame; 323 size_t m_currentDecodingFrame;
327 324
328 RefPtr<WebCore::SharedBuffer> m_data; 325 RefPtr<WebCore::SharedBuffer> m_data;
329 bool m_parseFailed;
330 bool m_parseCompleted; 326 bool m_parseCompleted;
331 }; 327 };
332 328
333 #endif 329 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698