Index: include/codec/SkCodec.h |
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h |
index 3855064f614d552bcb18e9ce6f6893bdb53e3740..186b6f8ec58efc7ecda62e6fba4e0cc75bfa70e4 100644 |
--- a/include/codec/SkCodec.h |
+++ b/include/codec/SkCodec.h |
@@ -107,6 +107,25 @@ public: |
*/ |
SkColorSpace* getColorSpace() const { return fColorSpace.get(); } |
+ enum SkImageOrientation { |
+ kOriginTopLeft_SkImageOrientation = 1, // Default |
+ kOriginTopRight_SkImageOrientation = 2, // Reflected across y-axis |
+ kOriginBottomRight_SkImageOrientation = 3, // Rotated 180 |
+ kOriginBottomLeft_SkImageOrientation = 4, // Reflected across x-axis |
+ kOriginLeftTop_SkImageOrientation = 5, // Reflected across x-axis, Rotated 90 CCW |
+ kOriginRightTop_SkImageOrientation = 6, // Rotated 90 CW |
+ kOriginRightBottom_SkImageOrientation = 7, // Reflected across x-axis, Rotated 90 CW |
+ kOriginLeftBottom_SkImageOrientation = 8, // Rotated 90 CCW |
+ kDefault_SkImageOrientation = kOriginTopLeft_SkImageOrientation, |
+ kLast_SkImageOrientation = kOriginLeftBottom_SkImageOrientation, |
+ }; |
+ |
+ /** |
+ * Returns the image orientation stored in the EXIF data. |
+ * If there is no EXIF data, or if we cannot read the EXIF data, returns kOriginTopLeft. |
+ */ |
+ SkImageOrientation getOrientation() const { return fOrientation; } |
+ |
/** |
* Return a size that approximately supports the desired scale factor. |
* The codec may not be able to scale efficiently to the exact scale |
@@ -493,7 +512,10 @@ 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, |
+ SkImageOrientation = kOriginTopLeft_SkImageOrientation); |
virtual SkISize onGetScaledDimensions(float /*desiredScale*/) const { |
// By default, scaling is not supported. |
@@ -625,6 +647,7 @@ private: |
SkAutoTDelete<SkStream> fStream; |
bool fNeedsRewind; |
sk_sp<SkColorSpace> fColorSpace; |
+ SkImageOrientation fOrientation; |
// These fields are only meaningful during scanline decodes. |
SkImageInfo fDstInfo; |