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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp

Issue 2206263003: Remove SK_SUPPORT_LEGACY_DATA_FACTORIES. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Gotta catch 'em all. Created 4 years, 4 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 WEBPImageDecoder::~WEBPImageDecoder() 138 WEBPImageDecoder::~WEBPImageDecoder()
139 { 139 {
140 clear(); 140 clear();
141 } 141 }
142 142
143 void WEBPImageDecoder::clear() 143 void WEBPImageDecoder::clear()
144 { 144 {
145 WebPDemuxDelete(m_demux); 145 WebPDemuxDelete(m_demux);
146 m_demux = 0; 146 m_demux = 0;
147 m_consolidatedData.clear(); 147 m_consolidatedData.reset();
148 clearDecoder(); 148 clearDecoder();
149 } 149 }
150 150
151 void WEBPImageDecoder::clearDecoder() 151 void WEBPImageDecoder::clearDecoder()
152 { 152 {
153 WebPIDelete(m_decoder); 153 WebPIDelete(m_decoder);
154 m_decoder = 0; 154 m_decoder = 0;
155 m_decodedHeight = 0; 155 m_decodedHeight = 0;
156 m_frameBackgroundHasAlpha = false; 156 m_frameBackgroundHasAlpha = false;
157 } 157 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 const unsigned webpHeaderSize = 30; 194 const unsigned webpHeaderSize = 30;
195 if (m_data->size() < webpHeaderSize) 195 if (m_data->size() < webpHeaderSize)
196 return false; // Await VP8X header so WebPDemuxPartial succeeds. 196 return false; // Await VP8X header so WebPDemuxPartial succeeds.
197 197
198 WebPDemuxDelete(m_demux); 198 WebPDemuxDelete(m_demux);
199 m_consolidatedData = m_data->getAsSkData(); 199 m_consolidatedData = m_data->getAsSkData();
200 WebPData inputData = { reinterpret_cast<const uint8_t*>(m_consolidatedData-> data()), m_consolidatedData->size() }; 200 WebPData inputData = { reinterpret_cast<const uint8_t*>(m_consolidatedData-> data()), m_consolidatedData->size() };
201 m_demux = WebPDemuxPartial(&inputData, &m_demuxState); 201 m_demux = WebPDemuxPartial(&inputData, &m_demuxState);
202 if (!m_demux || (isAllDataReceived() && m_demuxState != WEBP_DEMUX_DONE)) { 202 if (!m_demux || (isAllDataReceived() && m_demuxState != WEBP_DEMUX_DONE)) {
203 if (!m_demux) 203 if (!m_demux)
204 m_consolidatedData.clear(); 204 m_consolidatedData.reset();
205 return setFailed(); 205 return setFailed();
206 } 206 }
207 207
208 ASSERT(m_demuxState > WEBP_DEMUX_PARSING_HEADER); 208 ASSERT(m_demuxState > WEBP_DEMUX_PARSING_HEADER);
209 if (!WebPDemuxGetI(m_demux, WEBP_FF_FRAME_COUNT)) 209 if (!WebPDemuxGetI(m_demux, WEBP_FF_FRAME_COUNT))
210 return false; // Wait until the encoded image frame data arrives. 210 return false; // Wait until the encoded image frame data arrives.
211 211
212 if (!isDecodedSizeAvailable()) { 212 if (!isDecodedSizeAvailable()) {
213 int width = WebPDemuxGetI(m_demux, WEBP_FF_CANVAS_WIDTH); 213 int width = WebPDemuxGetI(m_demux, WEBP_FF_CANVAS_WIDTH);
214 int height = WebPDemuxGetI(m_demux, WEBP_FF_CANVAS_HEIGHT); 214 int height = WebPDemuxGetI(m_demux, WEBP_FF_CANVAS_HEIGHT);
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 return false; 505 return false;
506 } 506 }
507 // FALLTHROUGH 507 // FALLTHROUGH
508 default: 508 default:
509 clear(); 509 clear();
510 return setFailed(); 510 return setFailed();
511 } 511 }
512 } 512 }
513 513
514 } // namespace blink 514 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698