diff options
author | Leon Scroggins III <scroggo@google.com> | 2017-10-18 11:43:29 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-18 17:38:15 +0000 |
commit | 5411a60e0d7370a5d47b5049de845a06fe52e98b (patch) | |
tree | 8995da6236e7f37419a4d3075c35bbdc36049672 /include/codec/SkCodec.h | |
parent | 1d014105ac8e5968b6d260745c807ab45dfee956 (diff) |
Add an Option for orientation on JPEG encodes
Move Origin to its own header so that SkPixmap and SkJpegEncoder need
not depend on SkCodec.
Add libexif, which is already used by Android, and use it to write the
orientation. Write a makefile based on the Android.bp in Android, minus
warnings. (libexif has an LGPL license.)
Add a test that verifies all the orientations work.
Optionally enable writing the orientation (and therefore including
libexif). Chromium does not currently need it, and Android does not
expose an API that would allow using it. Disable on Windows, where we
still have build errors to fix.
Bug: skia:7138
Change-Id: Iaeff44c36aebe0e639666979dc00e1b7594bbeb1
Reviewed-on: https://skia-review.googlesource.com/60721
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'include/codec/SkCodec.h')
-rw-r--r-- | include/codec/SkCodec.h | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h index 6e9c8280b9..d3035a7a71 100644 --- a/include/codec/SkCodec.h +++ b/include/codec/SkCodec.h @@ -14,6 +14,7 @@ #include "SkColorSpaceXform.h" #include "SkEncodedImageFormat.h" #include "SkEncodedInfo.h" +#include "SkEncodedOrigin.h" #include "SkImageInfo.h" #include "SkPixmap.h" #include "SkSize.h" @@ -170,24 +171,11 @@ public: const SkEncodedInfo& getEncodedInfo() const { return fEncodedInfo; } - 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; } + SkEncodedOrigin getOrigin() const { return fOrigin; } /** * Return a size that approximately supports the desired scale factor. @@ -682,7 +670,7 @@ protected: XformFormat srcFormat, std::unique_ptr<SkStream>, sk_sp<SkColorSpace>, - Origin = kTopLeft_Origin); + SkEncodedOrigin = kTopLeft_SkEncodedOrigin); /** * Allows the subclass to set the recommended SkImageInfo @@ -691,7 +679,7 @@ protected: const SkImageInfo&, XformFormat srcFormat, std::unique_ptr<SkStream>, - Origin = kTopLeft_Origin); + SkEncodedOrigin = kTopLeft_SkEncodedOrigin); virtual SkISize onGetScaledDimensions(float /*desiredScale*/) const { // By default, scaling is not supported. @@ -841,7 +829,7 @@ private: const XformFormat fSrcXformFormat; std::unique_ptr<SkStream> fStream; bool fNeedsRewind; - const Origin fOrigin; + const SkEncodedOrigin fOrigin; SkImageInfo fDstInfo; Options fOptions; |