| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 virtual int choose() = 0; | 152 virtual int choose() = 0; |
| 153 | 153 |
| 154 private: | 154 private: |
| 155 typedef SkRefCnt INHERITED; | 155 typedef SkRefCnt INHERITED; |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 Chooser* getChooser() const { return fChooser; } | 158 Chooser* getChooser() const { return fChooser; } |
| 159 Chooser* setChooser(Chooser*); | 159 Chooser* setChooser(Chooser*); |
| 160 #endif | 160 #endif |
| 161 | 161 |
| 162 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG |
| 162 /** | 163 /** |
| 163 * Optional table describing the caller's preferred config based on | 164 * Optional table describing the caller's preferred config based on |
| 164 * information about the src data. Each field should be set to the | 165 * information about the src data. Each field should be set to the |
| 165 * preferred config for a src described in the name of the field. The | 166 * preferred config for a src described in the name of the field. The |
| 166 * src attributes are described in terms of depth (8-index, | 167 * src attributes are described in terms of depth (8-index, |
| 167 * 8bit-grayscale, or 8-bits/component) and whether there is per-pixel | 168 * 8bit-grayscale, or 8-bits/component) and whether there is per-pixel |
| 168 * alpha (does not apply to grayscale). If the caller has no preference | 169 * alpha (does not apply to grayscale). If the caller has no preference |
| 169 * for a particular src type, its slot should be set to kNo_Config. | 170 * for a particular src type, its slot should be set to kNo_Config. |
| 170 * | 171 * |
| 171 * NOTE ABOUT PREFERRED CONFIGS: | 172 * NOTE ABOUT PREFERRED CONFIGS: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 195 * decode is preferred. | 196 * decode is preferred. |
| 196 */ | 197 */ |
| 197 void setPrefConfigTable(const PrefConfigTable&); | 198 void setPrefConfigTable(const PrefConfigTable&); |
| 198 | 199 |
| 199 /** | 200 /** |
| 200 * Do not use a PrefConfigTable to determine the output config. This | 201 * Do not use a PrefConfigTable to determine the output config. This |
| 201 * is the default, so there is no need to call unless a PrefConfigTable | 202 * is the default, so there is no need to call unless a PrefConfigTable |
| 202 * was previously set. | 203 * was previously set. |
| 203 */ | 204 */ |
| 204 void resetPrefConfigTable() { fUsePrefTable = false; } | 205 void resetPrefConfigTable() { fUsePrefTable = false; } |
| 206 #endif |
| 205 | 207 |
| 206 SkBitmap::Allocator* getAllocator() const { return fAllocator; } | 208 SkBitmap::Allocator* getAllocator() const { return fAllocator; } |
| 207 SkBitmap::Allocator* setAllocator(SkBitmap::Allocator*); | 209 SkBitmap::Allocator* setAllocator(SkBitmap::Allocator*); |
| 208 | 210 |
| 209 // sample-size, if set to > 1, tells the decoder to return a smaller than | 211 // sample-size, if set to > 1, tells the decoder to return a smaller than |
| 210 // original bitmap, sampling 1 pixel for every size pixels. e.g. if sample | 212 // original bitmap, sampling 1 pixel for every size pixels. e.g. if sample |
| 211 // size is set to 3, then the returned bitmap will be 1/3 as wide and high, | 213 // size is set to 3, then the returned bitmap will be 1/3 as wide and high, |
| 212 // and will contain 1/9 as many pixels as the original. | 214 // and will contain 1/9 as many pixels as the original. |
| 213 // Note: this is a hint, and the codec may choose to ignore this, or only | 215 // Note: this is a hint, and the codec may choose to ignore this, or only |
| 214 // approximate the sample size. | 216 // approximate the sample size. |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 SkColorType getPrefColorType(SrcDepth, bool hasAlpha) const; | 466 SkColorType getPrefColorType(SrcDepth, bool hasAlpha) const; |
| 465 | 467 |
| 466 private: | 468 private: |
| 467 Peeker* fPeeker; | 469 Peeker* fPeeker; |
| 468 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER | 470 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER |
| 469 Chooser* fChooser; | 471 Chooser* fChooser; |
| 470 #endif | 472 #endif |
| 471 SkBitmap::Allocator* fAllocator; | 473 SkBitmap::Allocator* fAllocator; |
| 472 int fSampleSize; | 474 int fSampleSize; |
| 473 SkColorType fDefaultPref; // use if fUsePrefTable is false | 475 SkColorType fDefaultPref; // use if fUsePrefTable is false |
| 476 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG |
| 474 PrefConfigTable fPrefTable; // use if fUsePrefTable is true | 477 PrefConfigTable fPrefTable; // use if fUsePrefTable is true |
| 478 bool fUsePrefTable; |
| 479 #endif |
| 475 bool fDitherImage; | 480 bool fDitherImage; |
| 476 bool fUsePrefTable; | |
| 477 bool fSkipWritingZeroes; | 481 bool fSkipWritingZeroes; |
| 478 mutable bool fShouldCancelDecode; | 482 mutable bool fShouldCancelDecode; |
| 479 bool fPreferQualityOverSpeed; | 483 bool fPreferQualityOverSpeed; |
| 480 bool fRequireUnpremultipliedColors; | 484 bool fRequireUnpremultipliedColors; |
| 481 }; | 485 }; |
| 482 | 486 |
| 483 /** Calling newDecoder with a stream returns a new matching imagedecoder | 487 /** Calling newDecoder with a stream returns a new matching imagedecoder |
| 484 instance, or NULL if none can be found. The caller must manage its ownership | 488 instance, or NULL if none can be found. The caller must manage its ownership |
| 485 of the stream as usual, calling unref() when it is done, as the returned | 489 of the stream as usual, calling unref() when it is done, as the returned |
| 486 decoder may have called ref() (and if so, the decoder is responsible for | 490 decoder may have called ref() (and if so, the decoder is responsible for |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 DECLARE_DECODER_CREATOR(WEBPImageDecoder); | 531 DECLARE_DECODER_CREATOR(WEBPImageDecoder); |
| 528 DECLARE_DECODER_CREATOR(PKMImageDecoder); | 532 DECLARE_DECODER_CREATOR(PKMImageDecoder); |
| 529 DECLARE_DECODER_CREATOR(KTXImageDecoder); | 533 DECLARE_DECODER_CREATOR(KTXImageDecoder); |
| 530 | 534 |
| 531 // Typedefs to make registering decoder and formatter callbacks easier. | 535 // Typedefs to make registering decoder and formatter callbacks easier. |
| 532 // These have to be defined outside SkImageDecoder. :( | 536 // These have to be defined outside SkImageDecoder. :( |
| 533 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; | 537 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; |
| 534 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; | 538 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; |
| 535 | 539 |
| 536 #endif | 540 #endif |
| OLD | NEW |