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

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

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