| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 }; | 477 }; |
| 478 | 478 |
| 479 class SkDefaultImageDecoderFactory : SkImageDecoderFactory { | 479 class SkDefaultImageDecoderFactory : SkImageDecoderFactory { |
| 480 public: | 480 public: |
| 481 // calls SkImageDecoder::Factory(stream) | 481 // calls SkImageDecoder::Factory(stream) |
| 482 virtual SkImageDecoder* newDecoder(SkStreamRewindable* stream) { | 482 virtual SkImageDecoder* newDecoder(SkStreamRewindable* stream) { |
| 483 return SkImageDecoder::Factory(stream); | 483 return SkImageDecoder::Factory(stream); |
| 484 } | 484 } |
| 485 }; | 485 }; |
| 486 | 486 |
| 487 // This macro declares a global (i.e., non-class owned) creation entry point | |
| 488 // for each decoder (e.g., CreateJPEGImageDecoder) | |
| 489 #define DECLARE_DECODER_CREATOR(codec) \ | |
| 490 SkImageDecoder *Create ## codec (); | |
| 491 | |
| 492 // This macro defines the global creation entry point for each decoder. Each | |
| 493 // decoder implementation that registers with the decoder factory must call it. | |
| 494 #define DEFINE_DECODER_CREATOR(codec) \ | |
| 495 SkImageDecoder *Create ## codec () { \ | |
| 496 return SkNEW( Sk ## codec ); \ | |
| 497 } | |
| 498 | |
| 499 // All the decoders known by Skia. Note that, depending on the compiler settings
, | |
| 500 // not all of these will be available | |
| 501 DECLARE_DECODER_CREATOR(BMPImageDecoder); | |
| 502 DECLARE_DECODER_CREATOR(GIFImageDecoder); | |
| 503 DECLARE_DECODER_CREATOR(ICOImageDecoder); | |
| 504 DECLARE_DECODER_CREATOR(JPEGImageDecoder); | |
| 505 DECLARE_DECODER_CREATOR(PNGImageDecoder); | |
| 506 DECLARE_DECODER_CREATOR(WBMPImageDecoder); | |
| 507 DECLARE_DECODER_CREATOR(WEBPImageDecoder); | |
| 508 DECLARE_DECODER_CREATOR(PKMImageDecoder); | |
| 509 DECLARE_DECODER_CREATOR(KTXImageDecoder); | |
| 510 DECLARE_DECODER_CREATOR(ASTCImageDecoder); | |
| 511 | |
| 512 // Typedefs to make registering decoder and formatter callbacks easier. | |
| 513 // These have to be defined outside SkImageDecoder. :( | |
| 514 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; | |
| 515 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; | |
| 516 | |
| 517 #endif | 487 #endif |
| OLD | NEW |