| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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); |
| OLD | NEW |