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