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

Side by Side Diff: src/codec/SkWebpCodec.cpp

Issue 1381483002: Call rewindIfNeeded in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@codecSDmerge
Patch Set: Rebase Created 5 years, 2 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
« no previous file with comments | « src/codec/SkJpegCodec.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCodecPriv.h" 8 #include "SkCodecPriv.h"
9 #include "SkWebpCodec.h" 9 #include "SkWebpCodec.h"
10 #include "SkTemplates.h" 10 #include "SkTemplates.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // As stated below, libwebp snaps to even left and top. Make sure top and le ft are even, so we 145 // As stated below, libwebp snaps to even left and top. Make sure top and le ft are even, so we
146 // decode this exact subset. 146 // decode this exact subset.
147 // Leave right and bottom unmodified, so we suggest a slightly larger subset than requested. 147 // Leave right and bottom unmodified, so we suggest a slightly larger subset than requested.
148 desiredSubset->fLeft = (desiredSubset->fLeft >> 1) << 1; 148 desiredSubset->fLeft = (desiredSubset->fLeft >> 1) << 1;
149 desiredSubset->fTop = (desiredSubset->fTop >> 1) << 1; 149 desiredSubset->fTop = (desiredSubset->fTop >> 1) << 1;
150 return true; 150 return true;
151 } 151 }
152 152
153 SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t rowBytes, 153 SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t rowBytes,
154 const Options& options, SkPMColor*, int *) { 154 const Options& options, SkPMColor*, int *) {
155 if (!this->rewindIfNeeded()) {
156 return kCouldNotRewind;
157 }
158
159 if (!webp_conversion_possible(dstInfo, this->getInfo())) { 155 if (!webp_conversion_possible(dstInfo, this->getInfo())) {
160 return kInvalidConversion; 156 return kInvalidConversion;
161 } 157 }
162 158
163 WebPDecoderConfig config; 159 WebPDecoderConfig config;
164 if (0 == WebPInitDecoderConfig(&config)) { 160 if (0 == WebPInitDecoderConfig(&config)) {
165 // ABI mismatch. 161 // ABI mismatch.
166 // FIXME: New enum for this? 162 // FIXME: New enum for this?
167 return kInvalidInput; 163 return kInvalidInput;
168 } 164 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // Break out of the switch statement. Continue the loop. 240 // Break out of the switch statement. Continue the loop.
245 break; 241 break;
246 default: 242 default:
247 return kInvalidInput; 243 return kInvalidInput;
248 } 244 }
249 } 245 }
250 } 246 }
251 247
252 SkWebpCodec::SkWebpCodec(const SkImageInfo& info, SkStream* stream) 248 SkWebpCodec::SkWebpCodec(const SkImageInfo& info, SkStream* stream)
253 : INHERITED(info, stream) {} 249 : INHERITED(info, stream) {}
OLDNEW
« no previous file with comments | « src/codec/SkJpegCodec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698