Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Side by Side Diff: include/core/SkImageDecoder.h

Issue 16410009: Add an option to create unpremultiplied bitmaps. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix for andriod only code. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gyp/tests.gyp ('k') | samplecode/SampleColorFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 to require the decoder to return a bitmap with unpremultipli ed
86 colors. The default is false, meaning the resulting bitmap will have its
87 colors premultiplied.
88 NOTE: Passing true to this function may result in a bitmap which cannot
89 be properly used by Skia.
90 */
91 void setRequireUnpremultipliedColors(bool request) {
92 fRequireUnpremultipliedColors = request;
93 }
94
95 /** Returns true if the decoder will only return bitmaps with unpremultiplie d
96 colors.
97 */
98 bool getRequireUnpremultipliedColors() const { return fRequireUnpremultiplie dColors; }
99
85 /** \class Peeker 100 /** \class Peeker
86 101
87 Base class for optional callbacks to retrieve meta/chunk data out of 102 Base class for optional callbacks to retrieve meta/chunk data out of
88 an image as it is being decoded. 103 an image as it is being decoded.
89 */ 104 */
90 class Peeker : public SkRefCnt { 105 class Peeker : public SkRefCnt {
91 public: 106 public:
92 SK_DECLARE_INST_COUNT(Peeker) 107 SK_DECLARE_INST_COUNT(Peeker)
93 108
94 /** Return true to continue decoding, or false to indicate an error, whi ch 109 /** 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
426 Peeker* fPeeker; 441 Peeker* fPeeker;
427 Chooser* fChooser; 442 Chooser* fChooser;
428 SkBitmap::Allocator* fAllocator; 443 SkBitmap::Allocator* fAllocator;
429 int fSampleSize; 444 int fSampleSize;
430 SkBitmap::Config fDefaultPref; // use if fUsePrefTable is false 445 SkBitmap::Config fDefaultPref; // use if fUsePrefTable is false
431 SkBitmap::Config fPrefTable[6]; // use if fUsePrefTable is true 446 SkBitmap::Config fPrefTable[6]; // use if fUsePrefTable is true
432 bool fDitherImage; 447 bool fDitherImage;
433 bool fUsePrefTable; 448 bool fUsePrefTable;
434 mutable bool fShouldCancelDecode; 449 mutable bool fShouldCancelDecode;
435 bool fPreferQualityOverSpeed; 450 bool fPreferQualityOverSpeed;
451 bool fRequireUnpremultipliedColors;
436 }; 452 };
437 453
438 /** Calling newDecoder with a stream returns a new matching imagedecoder 454 /** 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 455 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 456 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 457 decoder may have called ref() (and if so, the decoder is responsible for
442 balancing its ownership when it is destroyed). 458 balancing its ownership when it is destroyed).
443 */ 459 */
444 class SkImageDecoderFactory : public SkRefCnt { 460 class SkImageDecoderFactory : public SkRefCnt {
445 public: 461 public:
(...skipping 29 matching lines...) Expand all
475 // not all of these will be available 491 // not all of these will be available
476 DECLARE_DECODER_CREATOR(BMPImageDecoder); 492 DECLARE_DECODER_CREATOR(BMPImageDecoder);
477 DECLARE_DECODER_CREATOR(GIFImageDecoder); 493 DECLARE_DECODER_CREATOR(GIFImageDecoder);
478 DECLARE_DECODER_CREATOR(ICOImageDecoder); 494 DECLARE_DECODER_CREATOR(ICOImageDecoder);
479 DECLARE_DECODER_CREATOR(JPEGImageDecoder); 495 DECLARE_DECODER_CREATOR(JPEGImageDecoder);
480 DECLARE_DECODER_CREATOR(PNGImageDecoder); 496 DECLARE_DECODER_CREATOR(PNGImageDecoder);
481 DECLARE_DECODER_CREATOR(WBMPImageDecoder); 497 DECLARE_DECODER_CREATOR(WBMPImageDecoder);
482 DECLARE_DECODER_CREATOR(WEBPImageDecoder); 498 DECLARE_DECODER_CREATOR(WEBPImageDecoder);
483 499
484 #endif 500 #endif
OLDNEW
« no previous file with comments | « gyp/tests.gyp ('k') | samplecode/SampleColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698