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 #ifndef SkImageDecoder_DEFINED | 10 #ifndef SkImageDecoder_DEFINED |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 bool getPreferQualityOverSpeed() const { return fPreferQualityOverSpeed; } | 75 bool getPreferQualityOverSpeed() const { return fPreferQualityOverSpeed; } |
76 | 76 |
77 /** Set to true if the the decoder should try to decode the | 77 /** Set to true if the the decoder should try to decode the |
78 resulting image to a higher quality even at the expense of | 78 resulting image to a higher quality even at the expense of |
79 the decoding speed. | 79 the decoding speed. |
80 */ | 80 */ |
81 void setPreferQualityOverSpeed(bool qualityOverSpeed) { | 81 void setPreferQualityOverSpeed(bool qualityOverSpeed) { |
82 fPreferQualityOverSpeed = qualityOverSpeed; | 82 fPreferQualityOverSpeed = qualityOverSpeed; |
83 } | 83 } |
84 | 84 |
| 85 /** Set to true if the decoder should return a bitmap with unpremultiplied |
| 86 colors. The decoder is free to ignore this request. The default is |
| 87 false, meaning the resulting bitmap will have its colors premultiplied. |
| 88 */ |
| 89 void setRequestUnpremultipliedColors(bool request) { |
| 90 fRequestUnpremultipliedColors = request; |
| 91 } |
| 92 |
| 93 /** Returns true if the decoder should try to return a bitmap with unpremult
iplied |
| 94 colors. |
| 95 */ |
| 96 bool getRequestUnpremultipliedColors() const { return fRequestUnpremultiplie
dColors; } |
| 97 |
85 /** \class Peeker | 98 /** \class Peeker |
86 | 99 |
87 Base class for optional callbacks to retrieve meta/chunk data out of | 100 Base class for optional callbacks to retrieve meta/chunk data out of |
88 an image as it is being decoded. | 101 an image as it is being decoded. |
89 */ | 102 */ |
90 class Peeker : public SkRefCnt { | 103 class Peeker : public SkRefCnt { |
91 public: | 104 public: |
92 SK_DECLARE_INST_COUNT(Peeker) | 105 SK_DECLARE_INST_COUNT(Peeker) |
93 | 106 |
94 /** Return true to continue decoding, or false to indicate an error, whi
ch | 107 /** Return true to continue decoding, or false to indicate an error, whi
ch |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 Peeker* fPeeker; | 439 Peeker* fPeeker; |
427 Chooser* fChooser; | 440 Chooser* fChooser; |
428 SkBitmap::Allocator* fAllocator; | 441 SkBitmap::Allocator* fAllocator; |
429 int fSampleSize; | 442 int fSampleSize; |
430 SkBitmap::Config fDefaultPref; // use if fUsePrefTable is false | 443 SkBitmap::Config fDefaultPref; // use if fUsePrefTable is false |
431 SkBitmap::Config fPrefTable[6]; // use if fUsePrefTable is true | 444 SkBitmap::Config fPrefTable[6]; // use if fUsePrefTable is true |
432 bool fDitherImage; | 445 bool fDitherImage; |
433 bool fUsePrefTable; | 446 bool fUsePrefTable; |
434 mutable bool fShouldCancelDecode; | 447 mutable bool fShouldCancelDecode; |
435 bool fPreferQualityOverSpeed; | 448 bool fPreferQualityOverSpeed; |
| 449 bool fRequestUnpremultipliedColors; |
436 }; | 450 }; |
437 | 451 |
438 /** Calling newDecoder with a stream returns a new matching imagedecoder | 452 /** Calling newDecoder with a stream returns a new matching imagedecoder |
439 instance, or NULL if none can be found. The caller must manage its ownership | 453 instance, or NULL if none can be found. The caller must manage its ownership |
440 of the stream as usual, calling unref() when it is done, as the returned | 454 of the stream as usual, calling unref() when it is done, as the returned |
441 decoder may have called ref() (and if so, the decoder is responsible for | 455 decoder may have called ref() (and if so, the decoder is responsible for |
442 balancing its ownership when it is destroyed). | 456 balancing its ownership when it is destroyed). |
443 */ | 457 */ |
444 class SkImageDecoderFactory : public SkRefCnt { | 458 class SkImageDecoderFactory : public SkRefCnt { |
445 public: | 459 public: |
(...skipping 29 matching lines...) Expand all Loading... |
475 // not all of these will be available | 489 // not all of these will be available |
476 DECLARE_DECODER_CREATOR(BMPImageDecoder); | 490 DECLARE_DECODER_CREATOR(BMPImageDecoder); |
477 DECLARE_DECODER_CREATOR(GIFImageDecoder); | 491 DECLARE_DECODER_CREATOR(GIFImageDecoder); |
478 DECLARE_DECODER_CREATOR(ICOImageDecoder); | 492 DECLARE_DECODER_CREATOR(ICOImageDecoder); |
479 DECLARE_DECODER_CREATOR(JPEGImageDecoder); | 493 DECLARE_DECODER_CREATOR(JPEGImageDecoder); |
480 DECLARE_DECODER_CREATOR(PNGImageDecoder); | 494 DECLARE_DECODER_CREATOR(PNGImageDecoder); |
481 DECLARE_DECODER_CREATOR(WBMPImageDecoder); | 495 DECLARE_DECODER_CREATOR(WBMPImageDecoder); |
482 DECLARE_DECODER_CREATOR(WEBPImageDecoder); | 496 DECLARE_DECODER_CREATOR(WEBPImageDecoder); |
483 | 497 |
484 #endif | 498 #endif |
OLD | NEW |