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

Side by Side Diff: include/codec/SkCodec.h

Issue 1820073002: Add SkEncodedInfo to report properties of encoded image data (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Order of param eval bug Created 4 years, 8 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 | include/codec/SkEncodedInfo.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 2015 Google Inc. 2 * Copyright 2015 Google Inc.
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 SkCodec_DEFINED 8 #ifndef SkCodec_DEFINED
9 #define SkCodec_DEFINED 9 #define SkCodec_DEFINED
10 10
11 #include "../private/SkTemplates.h" 11 #include "../private/SkTemplates.h"
12 #include "SkColor.h" 12 #include "SkColor.h"
13 #include "SkEncodedFormat.h" 13 #include "SkEncodedFormat.h"
14 #include "SkEncodedInfo.h"
14 #include "SkImageInfo.h" 15 #include "SkImageInfo.h"
15 #include "SkSize.h" 16 #include "SkSize.h"
16 #include "SkStream.h" 17 #include "SkStream.h"
17 #include "SkTypes.h" 18 #include "SkTypes.h"
18 #include "SkYUVSizeInfo.h" 19 #include "SkYUVSizeInfo.h"
19 20
20 class SkColorSpace; 21 class SkColorSpace;
21 class SkData; 22 class SkData;
22 class SkPngChunkReader; 23 class SkPngChunkReader;
23 class SkSampler; 24 class SkSampler;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 */ 94 */
94 static SkCodec* NewFromData(SkData*, SkPngChunkReader* = NULL); 95 static SkCodec* NewFromData(SkData*, SkPngChunkReader* = NULL);
95 96
96 virtual ~SkCodec(); 97 virtual ~SkCodec();
97 98
98 /** 99 /**
99 * Return the ImageInfo associated with this codec. 100 * Return the ImageInfo associated with this codec.
100 */ 101 */
101 const SkImageInfo& getInfo() const { return fSrcInfo; } 102 const SkImageInfo& getInfo() const { return fSrcInfo; }
102 103
104 const SkEncodedInfo& getEncodedInfo() const { return fEncodedInfo; }
105
103 /** 106 /**
104 * Returns the color space associated with the codec. 107 * Returns the color space associated with the codec.
105 * Does not affect ownership. 108 * Does not affect ownership.
106 * Might be NULL. 109 * Might be NULL.
107 */ 110 */
108 SkColorSpace* getColorSpace() const { return fColorSpace.get(); } 111 SkColorSpace* getColorSpace() const { return fColorSpace.get(); }
109 112
110 enum Origin { 113 enum Origin {
111 kTopLeft_Origin = 1, // Default 114 kTopLeft_Origin = 1, // Default
112 kTopRight_Origin = 2, // Reflected across y-axis 115 kTopRight_Origin = 2, // Reflected across y-axis
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 * 507 *
505 * This will equal inputScanline, except in the case of strangely 508 * This will equal inputScanline, except in the case of strangely
506 * encoded image types (bottom-up bmps, interlaced gifs). 509 * encoded image types (bottom-up bmps, interlaced gifs).
507 */ 510 */
508 int outputScanline(int inputScanline) const; 511 int outputScanline(int inputScanline) const;
509 512
510 protected: 513 protected:
511 /** 514 /**
512 * Takes ownership of SkStream* 515 * Takes ownership of SkStream*
513 */ 516 */
514 SkCodec(const SkImageInfo&, 517 SkCodec(int width,
518 int height,
519 const SkEncodedInfo&,
515 SkStream*, 520 SkStream*,
516 sk_sp<SkColorSpace> = nullptr, 521 sk_sp<SkColorSpace> = nullptr,
517 Origin = kTopLeft_Origin); 522 Origin = kTopLeft_Origin);
518 523
519 virtual SkISize onGetScaledDimensions(float /*desiredScale*/) const { 524 virtual SkISize onGetScaledDimensions(float /*desiredScale*/) const {
520 // By default, scaling is not supported. 525 // By default, scaling is not supported.
521 return this->getInfo().dimensions(); 526 return this->getInfo().dimensions();
522 } 527 }
523 528
524 // FIXME: What to do about subsets?? 529 // FIXME: What to do about subsets??
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 * Returns the number of scanlines that have been decoded so far. 640 * Returns the number of scanlines that have been decoded so far.
636 * This is unaffected by the SkScanlineOrder. 641 * This is unaffected by the SkScanlineOrder.
637 * 642 *
638 * Returns -1 if we have not started a scanline decode. 643 * Returns -1 if we have not started a scanline decode.
639 */ 644 */
640 int currScanline() const { return fCurrScanline; } 645 int currScanline() const { return fCurrScanline; }
641 646
642 virtual int onOutputScanline(int inputScanline) const; 647 virtual int onOutputScanline(int inputScanline) const;
643 648
644 private: 649 private:
650 const SkEncodedInfo fEncodedInfo;
645 const SkImageInfo fSrcInfo; 651 const SkImageInfo fSrcInfo;
646 SkAutoTDelete<SkStream> fStream; 652 SkAutoTDelete<SkStream> fStream;
647 bool fNeedsRewind; 653 bool fNeedsRewind;
648 sk_sp<SkColorSpace> fColorSpace; 654 sk_sp<SkColorSpace> fColorSpace;
649 const Origin fOrigin; 655 const Origin fOrigin;
650 656
651 // These fields are only meaningful during scanline decodes. 657 // These fields are only meaningful during scanline decodes.
652 SkImageInfo fDstInfo; 658 SkImageInfo fDstInfo;
653 SkCodec::Options fOptions; 659 SkCodec::Options fOptions;
654 int fCurrScanline; 660 int fCurrScanline;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 * not affect ownership. 706 * not affect ownership.
701 * 707 *
702 * Only valid during scanline decoding. 708 * Only valid during scanline decoding.
703 */ 709 */
704 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; } 710 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; }
705 711
706 friend class SkSampledCodec; 712 friend class SkSampledCodec;
707 friend class SkIcoCodec; 713 friend class SkIcoCodec;
708 }; 714 };
709 #endif // SkCodec_DEFINED 715 #endif // SkCodec_DEFINED
OLDNEW
« no previous file with comments | « no previous file | include/codec/SkEncodedInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698