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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp

Issue 1812273003: Eliminate copies of encoded image data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. 2 * Copyright (C) 2006 Apple Computer, Inc.
3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
4 * 4 *
5 * Portions are Copyright (C) 2001 mozilla.org 5 * Portions are Copyright (C) 2001 mozilla.org
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Stuart Parmenter <stuart@mozilla.com> 8 * Stuart Parmenter <stuart@mozilla.com>
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 { 107 {
108 #if USE(QCMSLIB) 108 #if USE(QCMSLIB)
109 clearColorTransform(); 109 clearColorTransform();
110 #endif 110 #endif
111 png_destroy_read_struct(m_png ? &m_png : 0, m_info ? &m_info : 0, 0); 111 png_destroy_read_struct(m_png ? &m_png : 0, m_info ? &m_info : 0, 0);
112 ASSERT(!m_png && !m_info); 112 ASSERT(!m_png && !m_info);
113 113
114 m_readOffset = 0; 114 m_readOffset = 0;
115 } 115 }
116 116
117 bool decode(const SharedBuffer& data, bool sizeOnly) 117 bool decode(const SegmentReader& data, bool sizeOnly)
118 { 118 {
119 m_decodingSizeOnly = sizeOnly; 119 m_decodingSizeOnly = sizeOnly;
120 120
121 // We need to do the setjmp here. Otherwise bad things will happen. 121 // We need to do the setjmp here. Otherwise bad things will happen.
122 if (setjmp(JMPBUF(m_png))) 122 if (setjmp(JMPBUF(m_png)))
123 return m_decoder->setFailed(); 123 return m_decoder->setFailed();
124 124
125 const char* segment; 125 const char* segment;
126 while (unsigned segmentLength = data.getSomeData(segment, m_readOffset)) { 126 while (unsigned segmentLength = data.getSomeData(segment, m_readOffset)) {
127 m_readOffset += segmentLength; 127 m_readOffset += segmentLength;
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // has failed. 503 // has failed.
504 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) 504 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived())
505 setFailed(); 505 setFailed();
506 506
507 // If decoding is done or failed, we don't need the PNGImageReader anymore. 507 // If decoding is done or failed, we don't need the PNGImageReader anymore.
508 if (isComplete(this) || failed()) 508 if (isComplete(this) || failed())
509 m_reader.clear(); 509 m_reader.clear();
510 } 510 }
511 511
512 } // namespace blink 512 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698