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

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

Issue 483593002: eliminate code related to SkBitmap::Config (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | « include/core/SkBitmap.h ('k') | include/gpu/SkGr.h » ('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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 virtual int choose() = 0; 153 virtual int choose() = 0;
154 154
155 private: 155 private:
156 typedef SkRefCnt INHERITED; 156 typedef SkRefCnt INHERITED;
157 }; 157 };
158 158
159 Chooser* getChooser() const { return fChooser; } 159 Chooser* getChooser() const { return fChooser; }
160 Chooser* setChooser(Chooser*); 160 Chooser* setChooser(Chooser*);
161 #endif 161 #endif
162 162
163 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
164 /**
165 * Optional table describing the caller's preferred config based on
166 * information about the src data. Each field should be set to the
167 * preferred config for a src described in the name of the field. The
168 * src attributes are described in terms of depth (8-index,
169 * 8bit-grayscale, or 8-bits/component) and whether there is per-pixel
170 * alpha (does not apply to grayscale). If the caller has no preference
171 * for a particular src type, its slot should be set to kNo_Config.
172 *
173 * NOTE ABOUT PREFERRED CONFIGS:
174 * If a config is preferred, either using a pref table or as a parameter
175 * to some flavor of decode, it is still at the discretion of the codec
176 * as to what output config is actually returned, as it may not be able
177 * to support the caller's preference.
178 *
179 * If a bitmap is decoded into SkBitmap::A8_Config, the resulting bitmap
180 * will either be a conversion of the grayscale in the case of a
181 * grayscale source or the alpha channel in the case of a source with
182 * an alpha channel.
183 */
184 struct PrefConfigTable {
185 SkBitmap::Config fPrefFor_8Index_NoAlpha_src;
186 SkBitmap::Config fPrefFor_8Index_YesAlpha_src;
187 SkBitmap::Config fPrefFor_8Gray_src;
188 SkBitmap::Config fPrefFor_8bpc_NoAlpha_src;
189 SkBitmap::Config fPrefFor_8bpc_YesAlpha_src;
190 };
191
192 /**
193 * Set an optional table for specifying the caller's preferred config
194 * based on information about the src data.
195 *
196 * The default is no preference, which will assume the config set by
197 * decode is preferred.
198 */
199 void setPrefConfigTable(const PrefConfigTable&);
200
201 /**
202 * Do not use a PrefConfigTable to determine the output config. This
203 * is the default, so there is no need to call unless a PrefConfigTable
204 * was previously set.
205 */
206 void resetPrefConfigTable() { fUsePrefTable = false; }
207 #endif
208
209 /** 163 /**
210 * By default, the codec will try to comply with the "pref" colortype 164 * By default, the codec will try to comply with the "pref" colortype
211 * that is passed to decode() or decodeSubset(). However, this can be calle d 165 * that is passed to decode() or decodeSubset(). However, this can be calle d
212 * to override that, causing the codec to try to match the src depth instea d 166 * to override that, causing the codec to try to match the src depth instea d
213 * (as shown below). 167 * (as shown below).
214 * 168 *
215 * src_8Index -> kIndex_8_SkColorType 169 * src_8Index -> kIndex_8_SkColorType
216 * src_8Gray -> kN32_SkColorType 170 * src_8Gray -> kN32_SkColorType
217 * src_8bpc -> kN32_SkColorType 171 * src_8bpc -> kN32_SkColorType
218 */ 172 */
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 SkColorType getPrefColorType(SrcDepth, bool hasAlpha) const; 414 SkColorType getPrefColorType(SrcDepth, bool hasAlpha) const;
461 415
462 private: 416 private:
463 Peeker* fPeeker; 417 Peeker* fPeeker;
464 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER 418 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER
465 Chooser* fChooser; 419 Chooser* fChooser;
466 #endif 420 #endif
467 SkBitmap::Allocator* fAllocator; 421 SkBitmap::Allocator* fAllocator;
468 int fSampleSize; 422 int fSampleSize;
469 SkColorType fDefaultPref; // use if fUsePrefTable is false 423 SkColorType fDefaultPref; // use if fUsePrefTable is false
470 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
471 PrefConfigTable fPrefTable; // use if fUsePrefTable is true
472 bool fUsePrefTable;
473 #endif
474 bool fPreserveSrcDepth; 424 bool fPreserveSrcDepth;
475 bool fDitherImage; 425 bool fDitherImage;
476 bool fSkipWritingZeroes; 426 bool fSkipWritingZeroes;
477 mutable bool fShouldCancelDecode; 427 mutable bool fShouldCancelDecode;
478 bool fPreferQualityOverSpeed; 428 bool fPreferQualityOverSpeed;
479 bool fRequireUnpremultipliedColors; 429 bool fRequireUnpremultipliedColors;
480 }; 430 };
481 431
482 /** Calling newDecoder with a stream returns a new matching imagedecoder 432 /** Calling newDecoder with a stream returns a new matching imagedecoder
483 instance, or NULL if none can be found. The caller must manage its ownership 433 instance, or NULL if none can be found. The caller must manage its ownership
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 DECLARE_DECODER_CREATOR(PKMImageDecoder); 477 DECLARE_DECODER_CREATOR(PKMImageDecoder);
528 DECLARE_DECODER_CREATOR(KTXImageDecoder); 478 DECLARE_DECODER_CREATOR(KTXImageDecoder);
529 DECLARE_DECODER_CREATOR(ASTCImageDecoder); 479 DECLARE_DECODER_CREATOR(ASTCImageDecoder);
530 480
531 // Typedefs to make registering decoder and formatter callbacks easier. 481 // Typedefs to make registering decoder and formatter callbacks easier.
532 // These have to be defined outside SkImageDecoder. :( 482 // These have to be defined outside SkImageDecoder. :(
533 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg; 483 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg;
534 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg; 484 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg;
535 485
536 #endif 486 #endif
OLDNEW
« no previous file with comments | « include/core/SkBitmap.h ('k') | include/gpu/SkGr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698