OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkImageDecoder_DEFINED | 8 #ifndef SkImageDecoder_DEFINED |
9 #define SkImageDecoder_DEFINED | 9 #define SkImageDecoder_DEFINED |
10 | 10 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 } | 435 } |
436 }; | 436 }; |
437 | 437 |
438 // This macro declares a global (i.e., non-class owned) creation entry point | 438 // This macro declares a global (i.e., non-class owned) creation entry point |
439 // for each decoder (e.g., CreateJPEGImageDecoder) | 439 // for each decoder (e.g., CreateJPEGImageDecoder) |
440 #define DECLARE_DECODER_CREATOR(codec) \ | 440 #define DECLARE_DECODER_CREATOR(codec) \ |
441 SkImageDecoder *Create ## codec (); | 441 SkImageDecoder *Create ## codec (); |
442 | 442 |
443 // This macro defines the global creation entry point for each decoder. Each | 443 // This macro defines the global creation entry point for each decoder. Each |
444 // decoder implementation that registers with the decoder factory must call it. | 444 // decoder implementation that registers with the decoder factory must call it. |
445 #define DEFINE_DECODER_CREATOR(codec) \ | 445 #define DEFINE_DECODER_CREATOR(codec) \ |
446 SkImageDecoder *Create ## codec () { \ | 446 SkImageDecoder* Create##codec() { return new Sk##codec; } |
447 return SkNEW( Sk ## codec ); \ | |
448 } | |
449 | 447 |
450 // All the decoders known by Skia. Note that, depending on the compiler settings
, | 448 // All the decoders known by Skia. Note that, depending on the compiler settings
, |
451 // not all of these will be available | 449 // not all of these will be available |
452 DECLARE_DECODER_CREATOR(BMPImageDecoder); | 450 DECLARE_DECODER_CREATOR(BMPImageDecoder); |
453 DECLARE_DECODER_CREATOR(GIFImageDecoder); | 451 DECLARE_DECODER_CREATOR(GIFImageDecoder); |
454 DECLARE_DECODER_CREATOR(ICOImageDecoder); | 452 DECLARE_DECODER_CREATOR(ICOImageDecoder); |
455 DECLARE_DECODER_CREATOR(JPEGImageDecoder); | 453 DECLARE_DECODER_CREATOR(JPEGImageDecoder); |
456 DECLARE_DECODER_CREATOR(PNGImageDecoder); | 454 DECLARE_DECODER_CREATOR(PNGImageDecoder); |
457 DECLARE_DECODER_CREATOR(WBMPImageDecoder); | 455 DECLARE_DECODER_CREATOR(WBMPImageDecoder); |
458 DECLARE_DECODER_CREATOR(WEBPImageDecoder); | 456 DECLARE_DECODER_CREATOR(WEBPImageDecoder); |
459 DECLARE_DECODER_CREATOR(PKMImageDecoder); | 457 DECLARE_DECODER_CREATOR(PKMImageDecoder); |
460 DECLARE_DECODER_CREATOR(KTXImageDecoder); | 458 DECLARE_DECODER_CREATOR(KTXImageDecoder); |
461 DECLARE_DECODER_CREATOR(ASTCImageDecoder); | 459 DECLARE_DECODER_CREATOR(ASTCImageDecoder); |
462 | 460 |
463 // Typedefs to make registering decoder and formatter callbacks easier. | 461 // Typedefs to make registering decoder and formatter callbacks easier. |
464 // These have to be defined outside SkImageDecoder. :( | 462 // These have to be defined outside SkImageDecoder. :( |
465 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; | 463 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; |
466 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; | 464 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; |
467 | 465 |
468 #endif | 466 #endif |
OLD | NEW |