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

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

Issue 143073008: add installPixels (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/SkGrPixelRef.cpp ('k') | src/lazy/SkDiscardablePixelRef.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 bm->setConfig(SkBitmap::kARGB_8888_Config, width, height, 0); 367 if (!bm->allocPixels(SkImageInfo::MakeN32Premul(width, height))) {
368 if (!bm->allocPixels(NULL)) {
369 return false; 368 return false;
370 } 369 }
371 // create bitmap for backup 370 // create bitmap for backup
372 fBackup.setConfig(SkBitmap::kARGB_8888_Config, width, height, 0); 371 if (!fBackup.allocPixels(SkImageInfo::MakeN32Premul(width, height))) {
373 if (!fBackup.allocPixels(NULL)) {
374 return false; 372 return false;
375 } 373 }
376 } else if (startIndex > fCurrIndex) { 374 } else if (startIndex > fCurrIndex) {
377 // rewind to 1st frame for repeat 375 // rewind to 1st frame for repeat
378 startIndex = 0; 376 startIndex = 0;
379 } 377 }
380 378
381 int lastIndex = fCurrIndex; 379 int lastIndex = fCurrIndex;
382 if (lastIndex < 0) { 380 if (lastIndex < 0) {
383 // first time 381 // first time
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) { 438 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) {
441 // 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
442 stream->rewind(); 440 stream->rewind();
443 return SkNEW_ARGS(SkGIFMovie, (stream)); 441 return SkNEW_ARGS(SkGIFMovie, (stream));
444 } 442 }
445 } 443 }
446 return NULL; 444 return NULL;
447 } 445 }
448 446
449 static SkTRegistry<SkMovie*(*)(SkStreamRewindable*)> gReg(Factory); 447 static SkTRegistry<SkMovie*(*)(SkStreamRewindable*)> gReg(Factory);
OLDNEW
« no previous file with comments | « src/gpu/SkGrPixelRef.cpp ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698