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

Side by Side Diff: third_party/libwebp/dec/buffer.c

Issue 1546003002: libwebp: update to 0.5.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 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 | « third_party/libwebp/dec/alpha.c ('k') | third_party/libwebp/dec/common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 Google Inc. All Rights Reserved. 1 // Copyright 2011 Google Inc. All Rights Reserved.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license 3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the COPYING file in the root of the source 4 // that can be found in the COPYING file in the root of the source
5 // tree. An additional intellectual property rights grant can be found 5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may 6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree. 7 // be found in the AUTHORS file in the root of the source tree.
8 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
9 // 9 //
10 // Everything about WebPDecBuffer 10 // Everything about WebPDecBuffer
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 const int ch = options->crop_height; 182 const int ch = options->crop_height;
183 const int x = options->crop_left & ~1; 183 const int x = options->crop_left & ~1;
184 const int y = options->crop_top & ~1; 184 const int y = options->crop_top & ~1;
185 if (x < 0 || y < 0 || cw <= 0 || ch <= 0 || x + cw > w || y + ch > h) { 185 if (x < 0 || y < 0 || cw <= 0 || ch <= 0 || x + cw > w || y + ch > h) {
186 return VP8_STATUS_INVALID_PARAM; // out of frame boundary. 186 return VP8_STATUS_INVALID_PARAM; // out of frame boundary.
187 } 187 }
188 w = cw; 188 w = cw;
189 h = ch; 189 h = ch;
190 } 190 }
191 if (options->use_scaling) { 191 if (options->use_scaling) {
192 if (options->scaled_width <= 0 || options->scaled_height <= 0) { 192 int scaled_width = options->scaled_width;
193 int scaled_height = options->scaled_height;
194 if (!WebPRescalerGetScaledDimensions(
195 w, h, &scaled_width, &scaled_height)) {
193 return VP8_STATUS_INVALID_PARAM; 196 return VP8_STATUS_INVALID_PARAM;
194 } 197 }
195 w = options->scaled_width; 198 w = scaled_width;
196 h = options->scaled_height; 199 h = scaled_height;
197 } 200 }
198 } 201 }
199 out->width = w; 202 out->width = w;
200 out->height = h; 203 out->height = h;
201 204
202 // Then, allocate buffer for real. 205 // Then, allocate buffer for real.
203 status = AllocateBuffer(out); 206 status = AllocateBuffer(out);
204 if (status != VP8_STATUS_OK) return status; 207 if (status != VP8_STATUS_OK) return status;
205 208
206 #if WEBP_DECODER_ABI_VERSION > 0x0203
207 // Use the stride trick if vertical flip is needed. 209 // Use the stride trick if vertical flip is needed.
208 if (options != NULL && options->flip) { 210 if (options != NULL && options->flip) {
209 status = WebPFlipBuffer(out); 211 status = WebPFlipBuffer(out);
210 } 212 }
211 #endif
212 return status; 213 return status;
213 } 214 }
214 215
215 //------------------------------------------------------------------------------ 216 //------------------------------------------------------------------------------
216 // constructors / destructors 217 // constructors / destructors
217 218
218 int WebPInitDecBufferInternal(WebPDecBuffer* buffer, int version) { 219 int WebPInitDecBufferInternal(WebPDecBuffer* buffer, int version) {
219 if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_DECODER_ABI_VERSION)) { 220 if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_DECODER_ABI_VERSION)) {
220 return 0; // version mismatch 221 return 0; // version mismatch
221 } 222 }
(...skipping 28 matching lines...) Expand all
250 *dst = *src; 251 *dst = *src;
251 if (src->private_memory != NULL) { 252 if (src->private_memory != NULL) {
252 src->is_external_memory = 1; // src relinquishes ownership 253 src->is_external_memory = 1; // src relinquishes ownership
253 src->private_memory = NULL; 254 src->private_memory = NULL;
254 } 255 }
255 } 256 }
256 } 257 }
257 258
258 //------------------------------------------------------------------------------ 259 //------------------------------------------------------------------------------
259 260
OLDNEW
« no previous file with comments | « third_party/libwebp/dec/alpha.c ('k') | third_party/libwebp/dec/common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698