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

Side by Side Diff: src/images/SkMovie_gif.cpp

Issue 510423005: make allocPixels throw on failure (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 3 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/images/SkImageDecoder_libwebp.cpp ('k') | src/lazy/SkCachingPixelRef.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkMovie.h" 10 #include "SkMovie.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 return true; 357 return true;
358 } 358 }
359 359
360 int startIndex = fLastDrawIndex + 1; 360 int startIndex = fLastDrawIndex + 1;
361 if (fLastDrawIndex < 0 || !bm->readyToDraw()) { 361 if (fLastDrawIndex < 0 || !bm->readyToDraw()) {
362 // first time 362 // first time
363 363
364 startIndex = 0; 364 startIndex = 0;
365 365
366 // create bitmap 366 // create bitmap
367 if (!bm->allocPixels(SkImageInfo::MakeN32Premul(width, height))) { 367 if (!bm->tryAllocN32Pixels(width, height)) {
368 return false; 368 return false;
369 } 369 }
370 // create bitmap for backup 370 // create bitmap for backup
371 if (!fBackup.allocPixels(SkImageInfo::MakeN32Premul(width, height))) { 371 if (!fBackup.tryAllocN32Pixels(width, height)) {
372 return false; 372 return false;
373 } 373 }
374 } else if (startIndex > fCurrIndex) { 374 } else if (startIndex > fCurrIndex) {
375 // rewind to 1st frame for repeat 375 // rewind to 1st frame for repeat
376 startIndex = 0; 376 startIndex = 0;
377 } 377 }
378 378
379 int lastIndex = fCurrIndex; 379 int lastIndex = fCurrIndex;
380 if (lastIndex < 0) { 380 if (lastIndex < 0) {
381 // first time 381 // first time
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) { 438 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) {
439 // must rewind here, since our construct wants to re-read the data 439 // must rewind here, since our construct wants to re-read the data
440 stream->rewind(); 440 stream->rewind();
441 return SkNEW_ARGS(SkGIFMovie, (stream)); 441 return SkNEW_ARGS(SkGIFMovie, (stream));
442 } 442 }
443 } 443 }
444 return NULL; 444 return NULL;
445 } 445 }
446 446
447 static SkTRegistry<SkMovie*(*)(SkStreamRewindable*)> gReg(Factory); 447 static SkTRegistry<SkMovie*(*)(SkStreamRewindable*)> gReg(Factory);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libwebp.cpp ('k') | src/lazy/SkCachingPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698