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