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

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

Issue 371273007: add setPreserveSrcDepth to replace PrefTable API for android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | src/images/SkImageDecoder.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 * 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 void setPrefConfigTable(const PrefConfigTable&); 198 void setPrefConfigTable(const PrefConfigTable&);
199 199
200 /** 200 /**
201 * Do not use a PrefConfigTable to determine the output config. This 201 * Do not use a PrefConfigTable to determine the output config. This
202 * 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
203 * was previously set. 203 * was previously set.
204 */ 204 */
205 void resetPrefConfigTable() { fUsePrefTable = false; } 205 void resetPrefConfigTable() { fUsePrefTable = false; }
206 #endif 206 #endif
207 207
208 /**
209 * By default, the codec will try to comply with the "pref" colortype
210 * that is passed to decode() or decodeSubset(). However, this can be calle d
211 * to override that, causing the codec to try to match the src depth instea d
212 * (as shown below).
213 *
214 * src_8Index -> kIndex_8_SkColorType
215 * src_8Gray -> kN32_SkColorType
216 * src_8bpc -> kN32_SkColorType
217 */
218 void setPreserveSrcDepth(bool preserve) {
219 fPreserveSrcDepth = preserve;
220 }
221
208 SkBitmap::Allocator* getAllocator() const { return fAllocator; } 222 SkBitmap::Allocator* getAllocator() const { return fAllocator; }
209 SkBitmap::Allocator* setAllocator(SkBitmap::Allocator*); 223 SkBitmap::Allocator* setAllocator(SkBitmap::Allocator*);
210 224
211 // sample-size, if set to > 1, tells the decoder to return a smaller than 225 // sample-size, if set to > 1, tells the decoder to return a smaller than
212 // original bitmap, sampling 1 pixel for every size pixels. e.g. if sample 226 // original bitmap, sampling 1 pixel for every size pixels. e.g. if sample
213 // size is set to 3, then the returned bitmap will be 1/3 as wide and high, 227 // size is set to 3, then the returned bitmap will be 1/3 as wide and high,
214 // and will contain 1/9 as many pixels as the original. 228 // and will contain 1/9 as many pixels as the original.
215 // Note: this is a hint, and the codec may choose to ignore this, or only 229 // Note: this is a hint, and the codec may choose to ignore this, or only
216 // approximate the sample size. 230 // approximate the sample size.
217 int getSampleSize() const { return fSampleSize; } 231 int getSampleSize() const { return fSampleSize; }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER 463 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
450 Chooser* fChooser; 464 Chooser* fChooser;
451 #endif 465 #endif
452 SkBitmap::Allocator* fAllocator; 466 SkBitmap::Allocator* fAllocator;
453 int fSampleSize; 467 int fSampleSize;
454 SkColorType fDefaultPref; // use if fUsePrefTable is false 468 SkColorType fDefaultPref; // use if fUsePrefTable is false
455 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG 469 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
456 PrefConfigTable fPrefTable; // use if fUsePrefTable is true 470 PrefConfigTable fPrefTable; // use if fUsePrefTable is true
457 bool fUsePrefTable; 471 bool fUsePrefTable;
458 #endif 472 #endif
473 bool fPreserveSrcDepth;
459 bool fDitherImage; 474 bool fDitherImage;
460 bool fSkipWritingZeroes; 475 bool fSkipWritingZeroes;
461 mutable bool fShouldCancelDecode; 476 mutable bool fShouldCancelDecode;
462 bool fPreferQualityOverSpeed; 477 bool fPreferQualityOverSpeed;
463 bool fRequireUnpremultipliedColors; 478 bool fRequireUnpremultipliedColors;
464 }; 479 };
465 480
466 /** Calling newDecoder with a stream returns a new matching imagedecoder 481 /** Calling newDecoder with a stream returns a new matching imagedecoder
467 instance, or NULL if none can be found. The caller must manage its ownership 482 instance, or NULL if none can be found. The caller must manage its ownership
468 of the stream as usual, calling unref() when it is done, as the returned 483 of the stream as usual, calling unref() when it is done, as the returned
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 DECLARE_DECODER_CREATOR(WEBPImageDecoder); 525 DECLARE_DECODER_CREATOR(WEBPImageDecoder);
511 DECLARE_DECODER_CREATOR(PKMImageDecoder); 526 DECLARE_DECODER_CREATOR(PKMImageDecoder);
512 DECLARE_DECODER_CREATOR(KTXImageDecoder); 527 DECLARE_DECODER_CREATOR(KTXImageDecoder);
513 528
514 // Typedefs to make registering decoder and formatter callbacks easier. 529 // Typedefs to make registering decoder and formatter callbacks easier.
515 // These have to be defined outside SkImageDecoder. :( 530 // These have to be defined outside SkImageDecoder. :(
516 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg; 531 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg;
517 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg; 532 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg;
518 533
519 #endif 534 #endif
OLDNEW
« no previous file with comments | « no previous file | src/images/SkImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698