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

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

Issue 23477009: Change SkImageDecoders to take an SkStreamRewindable. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Only switch to SkStreamRewindable when necessary. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/images/SkMovie.cpp ('k') | src/ports/SkImageDecoder_CG.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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 425
426 // save index 426 // save index
427 fLastDrawIndex = lastIndex; 427 fLastDrawIndex = lastIndex;
428 return true; 428 return true;
429 } 429 }
430 430
431 /////////////////////////////////////////////////////////////////////////////// 431 ///////////////////////////////////////////////////////////////////////////////
432 432
433 #include "SkTRegistry.h" 433 #include "SkTRegistry.h"
434 434
435 SkMovie* Factory(SkStream* stream) { 435 SkMovie* Factory(SkStreamRewindable* stream) {
436 char buf[GIF_STAMP_LEN]; 436 char buf[GIF_STAMP_LEN];
437 if (stream->read(buf, GIF_STAMP_LEN) == GIF_STAMP_LEN) { 437 if (stream->read(buf, GIF_STAMP_LEN) == GIF_STAMP_LEN) {
438 if (memcmp(GIF_STAMP, buf, GIF_STAMP_LEN) == 0 || 438 if (memcmp(GIF_STAMP, buf, GIF_STAMP_LEN) == 0 ||
439 memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 || 439 memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 ||
440 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) { 440 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) {
441 // must rewind here, since our construct wants to re-read the data 441 // must rewind here, since our construct wants to re-read the data
442 stream->rewind(); 442 stream->rewind();
443 return SkNEW_ARGS(SkGIFMovie, (stream)); 443 return SkNEW_ARGS(SkGIFMovie, (stream));
444 } 444 }
445 } 445 }
446 return NULL; 446 return NULL;
447 } 447 }
448 448
449 static SkTRegistry<SkMovie*(*)(SkStream*)> gReg(Factory); 449 static SkTRegistry<SkMovie*(*)(SkStreamRewindable*)> gReg(Factory);
OLDNEW
« no previous file with comments | « src/images/SkMovie.cpp ('k') | src/ports/SkImageDecoder_CG.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698