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

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

Issue 322963002: hide SkBitmap::setConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
« no previous file with comments | « include/core/SkBitmap.h ('k') | include/gpu/GrSurface.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 /* 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 */ 431 */
432 432
433 public: 433 public:
434 bool shouldCancelDecode() const { return fShouldCancelDecode; } 434 bool shouldCancelDecode() const { return fShouldCancelDecode; }
435 435
436 protected: 436 protected:
437 SkImageDecoder(); 437 SkImageDecoder();
438 438
439 // helper function for decoders to handle the (common) case where there is o nly 439 // helper function for decoders to handle the (common) case where there is o nly
440 // once choice available in the image file. 440 // once choice available in the image file.
441 bool chooseFromOneChoice(SkBitmap::Config config, int width, int height) con st; 441 bool chooseFromOneChoice(SkColorType, int width, int height) const;
442 442
443 /* Helper for subclasses. Call this to allocate the pixel memory given the bitmap's 443 /* Helper for subclasses. Call this to allocate the pixel memory given the bitmap's
444 width/height/rowbytes/config. Returns true on success. This method handl es checking 444 width/height/rowbytes/config. Returns true on success. This method handl es checking
445 for an optional Allocator. 445 for an optional Allocator.
446 */ 446 */
447 bool allocPixelRef(SkBitmap*, SkColorTable*) const; 447 bool allocPixelRef(SkBitmap*, SkColorTable*) const;
448 448
449 /** 449 /**
450 * The raw data of the src image. 450 * The raw data of the src image.
451 */ 451 */
452 enum SrcDepth { 452 enum SrcDepth {
453 // Color-indexed. 453 // Color-indexed.
454 kIndex_SrcDepth, 454 kIndex_SrcDepth,
455 // Grayscale in 8 bits. 455 // Grayscale in 8 bits.
456 k8BitGray_SrcDepth, 456 k8BitGray_SrcDepth,
457 // 8 bits per component. Used for 24 bit if there is no alpha. 457 // 8 bits per component. Used for 24 bit if there is no alpha.
458 k32Bit_SrcDepth, 458 k32Bit_SrcDepth,
459 }; 459 };
460 /** The subclass, inside onDecode(), calls this to determine the config of 460 /** The subclass, inside onDecode(), calls this to determine the colorType o f
461 the returned bitmap. SrcDepth and hasAlpha reflect the raw data of the 461 the returned bitmap. SrcDepth and hasAlpha reflect the raw data of the
462 src image. This routine returns the caller's preference given 462 src image. This routine returns the caller's preference given
463 srcDepth and hasAlpha, or kNo_Config if there is no preference. 463 srcDepth and hasAlpha, or kUnknown_SkColorType if there is no preference .
464 464
465 Note: this also takes into account GetDeviceConfig(), so the subclass 465 Note: this also takes into account GetDeviceConfig(), so the subclass
466 need not call that. 466 need not call that.
467 */ 467 */
468 SkBitmap::Config getPrefConfig(SrcDepth, bool hasAlpha) const; 468 SkColorType getPrefColorType(SrcDepth, bool hasAlpha) const;
469 469
470 private: 470 private:
471 Peeker* fPeeker; 471 Peeker* fPeeker;
472 Chooser* fChooser; 472 Chooser* fChooser;
473 SkBitmap::Allocator* fAllocator; 473 SkBitmap::Allocator* fAllocator;
474 int fSampleSize; 474 int fSampleSize;
475 SkBitmap::Config fDefaultPref; // use if fUsePrefTable is false 475 SkBitmap::Config fDefaultPref; // use if fUsePrefTable is false
476 PrefConfigTable fPrefTable; // use if fUsePrefTable is true 476 PrefConfigTable fPrefTable; // use if fUsePrefTable is true
477 bool fDitherImage; 477 bool fDitherImage;
478 bool fUsePrefTable; 478 bool fUsePrefTable;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 DECLARE_DECODER_CREATOR(WEBPImageDecoder); 529 DECLARE_DECODER_CREATOR(WEBPImageDecoder);
530 DECLARE_DECODER_CREATOR(PKMImageDecoder); 530 DECLARE_DECODER_CREATOR(PKMImageDecoder);
531 DECLARE_DECODER_CREATOR(KTXImageDecoder); 531 DECLARE_DECODER_CREATOR(KTXImageDecoder);
532 532
533 // Typedefs to make registering decoder and formatter callbacks easier. 533 // Typedefs to make registering decoder and formatter callbacks easier.
534 // These have to be defined outside SkImageDecoder. :( 534 // These have to be defined outside SkImageDecoder. :(
535 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg; 535 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg;
536 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg; 536 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg;
537 537
538 #endif 538 #endif
OLDNEW
« no previous file with comments | « include/core/SkBitmap.h ('k') | include/gpu/GrSurface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698