diff options
author | 2016-03-21 08:04:40 -0700 | |
---|---|---|
committer | 2016-03-21 08:04:40 -0700 | |
commit | 0e6274f54084d816abd70d445dded8657eb01abd (patch) | |
tree | c80aa88eeaa6ef846df754e1c1ac44d8d8ea8f83 /include | |
parent | 85c9447d4da7b9a12b0fe2894267bd0dc7e6d0f8 (diff) |
Parse icc profiles and exif orientation from jpeg markers
New resources should be fine to add since they are already
checked into chromium.
BUG=skia:3834
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1813273002
Review URL: https://codereview.chromium.org/1813273002
Diffstat (limited to 'include')
-rw-r--r-- | include/codec/SkCodec.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h index 3855064f61..629274d21c 100644 --- a/include/codec/SkCodec.h +++ b/include/codec/SkCodec.h @@ -107,6 +107,25 @@ public: */ SkColorSpace* getColorSpace() const { return fColorSpace.get(); } + enum Origin { + kTopLeft_Origin = 1, // Default + kTopRight_Origin = 2, // Reflected across y-axis + kBottomRight_Origin = 3, // Rotated 180 + kBottomLeft_Origin = 4, // Reflected across x-axis + kLeftTop_Origin = 5, // Reflected across x-axis, Rotated 90 CCW + kRightTop_Origin = 6, // Rotated 90 CW + kRightBottom_Origin = 7, // Reflected across x-axis, Rotated 90 CW + kLeftBottom_Origin = 8, // Rotated 90 CCW + kDefault_Origin = kTopLeft_Origin, + kLast_Origin = kLeftBottom_Origin, + }; + + /** + * Returns the image orientation stored in the EXIF data. + * If there is no EXIF data, or if we cannot read the EXIF data, returns kTopLeft. + */ + Origin getOrigin() const { return fOrigin; } + /** * Return a size that approximately supports the desired scale factor. * The codec may not be able to scale efficiently to the exact scale @@ -491,9 +510,11 @@ public: protected: /** * Takes ownership of SkStream* - * Does not affect ownership of SkColorSpace* */ - SkCodec(const SkImageInfo&, SkStream*, sk_sp<SkColorSpace> = nullptr); + SkCodec(const SkImageInfo&, + SkStream*, + sk_sp<SkColorSpace> = nullptr, + Origin = kTopLeft_Origin); virtual SkISize onGetScaledDimensions(float /*desiredScale*/) const { // By default, scaling is not supported. @@ -625,6 +646,7 @@ private: SkAutoTDelete<SkStream> fStream; bool fNeedsRewind; sk_sp<SkColorSpace> fColorSpace; + const Origin fOrigin; // These fields are only meaningful during scanline decodes. SkImageInfo fDstInfo; |