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 #include "SkMovie_gif.h" |
10 #include "SkMovie.h" | |
11 #include "SkColor.h" | 10 #include "SkColor.h" |
12 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
13 #include "SkStream.h" | 12 #include "SkStream.h" |
14 #include "SkTemplates.h" | 13 #include "SkTemplates.h" |
15 #include "SkUtils.h" | 14 #include "SkUtils.h" |
16 | 15 |
17 #include "gif_lib.h" | 16 #include "gif_lib.h" |
18 | 17 |
19 class SkGIFMovie : public SkMovie { | 18 class SkGIFMovie : public SkMovie { |
20 public: | 19 public: |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 if (i == lastIndex || !checkIfWillBeCleared(cur)) { | 418 if (i == lastIndex || !checkIfWillBeCleared(cur)) { |
420 drawFrame(bm, cur, gif->SColorMap); | 419 drawFrame(bm, cur, gif->SColorMap); |
421 } | 420 } |
422 } | 421 } |
423 | 422 |
424 // save index | 423 // save index |
425 fLastDrawIndex = lastIndex; | 424 fLastDrawIndex = lastIndex; |
426 return true; | 425 return true; |
427 } | 426 } |
428 | 427 |
429 /////////////////////////////////////////////////////////////////////////////// | 428 SkMovie* SkGIFMovieCreate(SkStreamRewindable* stream) { |
430 | |
431 #include "SkTRegistry.h" | |
432 | |
433 SkMovie* Factory(SkStreamRewindable* stream) { | |
434 char buf[GIF_STAMP_LEN]; | 429 char buf[GIF_STAMP_LEN]; |
435 if (stream->read(buf, GIF_STAMP_LEN) == GIF_STAMP_LEN) { | 430 if (stream->read(buf, GIF_STAMP_LEN) == GIF_STAMP_LEN) { |
436 if (memcmp(GIF_STAMP, buf, GIF_STAMP_LEN) == 0 || | 431 if (memcmp(GIF_STAMP, buf, GIF_STAMP_LEN) == 0 || |
437 memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 || | 432 memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 || |
438 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) { | 433 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) { |
439 // must rewind here, since our construct wants to re-read the data | 434 // must rewind here, since our construct wants to re-read the data |
440 stream->rewind(); | 435 stream->rewind(); |
441 return SkNEW_ARGS(SkGIFMovie, (stream)); | 436 return SkNEW_ARGS(SkGIFMovie, (stream)); |
442 } | 437 } |
443 } | 438 } |
444 return NULL; | 439 return NULL; |
445 } | 440 } |
446 | 441 |
447 static SkTRegistry<SkMovie*(*)(SkStreamRewindable*)> gReg(Factory); | |
OLD | NEW |