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 "SkImageDecoder.h" | 10 #include "SkImageDecoder.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 if (stream->read(buf, GIF_STAMP_LEN) == GIF_STAMP_LEN) { | 361 if (stream->read(buf, GIF_STAMP_LEN) == GIF_STAMP_LEN) { |
362 if (memcmp(GIF_STAMP, buf, GIF_STAMP_LEN) == 0 || | 362 if (memcmp(GIF_STAMP, buf, GIF_STAMP_LEN) == 0 || |
363 memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 || | 363 memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 || |
364 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) { | 364 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) { |
365 return true; | 365 return true; |
366 } | 366 } |
367 } | 367 } |
368 return false; | 368 return false; |
369 } | 369 } |
370 | 370 |
371 #include "SkTRegistry.h" | |
372 | |
373 static SkImageDecoder* sk_libgif_dfactory(SkStream* stream) { | 371 static SkImageDecoder* sk_libgif_dfactory(SkStream* stream) { |
374 if (is_gif(stream)) { | 372 if (is_gif(stream)) { |
375 return SkNEW(SkGIFImageDecoder); | 373 return SkNEW(SkGIFImageDecoder); |
376 } | 374 } |
377 return NULL; | 375 return NULL; |
378 } | 376 } |
379 | 377 |
380 static SkTRegistry<SkImageDecoder*, SkStream*> gReg(sk_libgif_dfactory); | 378 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); |
381 | 379 |
382 static SkImageDecoder::Format get_format_gif(SkStream* stream) { | 380 static SkImageDecoder::Format get_format_gif(SkStream* stream) { |
383 if (is_gif(stream)) { | 381 if (is_gif(stream)) { |
384 return SkImageDecoder::kGIF_Format; | 382 return SkImageDecoder::kGIF_Format; |
385 } | 383 } |
386 return SkImageDecoder::kUnknown_Format; | 384 return SkImageDecoder::kUnknown_Format; |
387 } | 385 } |
388 | 386 |
389 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_gif)
; | 387 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); |
OLD | NEW |