Index: include/codec/SkCodec.h |
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h |
index 3855064f614d552bcb18e9ce6f6893bdb53e3740..2dc071f49b56ff747cee303757285011edefb3bd 100644 |
--- a/include/codec/SkCodec.h |
+++ b/include/codec/SkCodec.h |
@@ -107,6 +107,25 @@ public: |
*/ |
SkColorSpace* getColorSpace() const { return fColorSpace.get(); } |
+ enum Orientation { |
+ kOriginTopLeft_Orientation = 1, // Default |
+ kOriginTopRight_Orientation = 2, // Reflected across y-axis |
+ kOriginBottomRight_Orientation = 3, // Rotated 180 |
+ kOriginBottomLeft_Orientation = 4, // Reflected across x-axis |
+ kOriginLeftTop_Orientation = 5, // Reflected across x-axis, Rotated 90 CCW |
+ kOriginRightTop_Orientation = 6, // Rotated 90 CW |
+ kOriginRightBottom_Orientation = 7, // Reflected across x-axis, Rotated 90 CW |
+ kOriginLeftBottom_Orientation = 8, // Rotated 90 CCW |
+ kDefault_Orientation = kOriginTopLeft_Orientation, |
+ kLast_Orientation = kOriginLeftBottom_Orientation, |
+ }; |
+ |
+ /** |
+ * 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. |
+ */ |
+ Orientation 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* |
scroggo
2016/03/18 22:38:17
This comment can be removed, I think.
msarett
2016/03/21 14:28:45
Done.
|
*/ |
- SkCodec(const SkImageInfo&, SkStream*, sk_sp<SkColorSpace> = nullptr); |
+ SkCodec(const SkImageInfo&, |
+ SkStream*, |
+ sk_sp<SkColorSpace> = nullptr, |
+ Orientation = kOriginTopLeft_Orientation); |
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; |
+ Orientation fOrientation; |
scroggo
2016/03/18 22:38:17
Can this be const?
msarett
2016/03/21 14:28:45
Yes! Done.
|
// These fields are only meaningful during scanline decodes. |
SkImageInfo fDstInfo; |