diff options
author | Leon Scroggins III <scroggo@google.com> | 2017-10-18 14:42:43 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-18 19:08:16 +0000 |
commit | b6ab10f34b407d9db9efb69b31849cef010328e3 (patch) | |
tree | 624d6a43a23a8046aeaa87039ca9f56b547b6839 /include | |
parent | 2240be96d97b5ac0886381d74a21f1e2a0928f55 (diff) |
Move SkCodec::Origin into its own file
It is now used by SkPixmap and will soon be in SkJpegEncoder. No need
for those to depend on SkCodec.
Bug: 768878
TBR=reed@google.com
(reed@ already approved the API change in
https://skia-review.googlesource.com/60721)
Change-Id: If1a6e1d5b60a7a3d8c97818e15a48d28ba804668
Reviewed-on: https://skia-review.googlesource.com/61680
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/codec/SkCodec.h | 22 | ||||
-rw-r--r-- | include/codec/SkEncodedOrigin.h | 23 |
2 files changed, 28 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; diff --git a/include/codec/SkEncodedOrigin.h b/include/codec/SkEncodedOrigin.h new file mode 100644 index 0000000000..622ade1555 --- /dev/null +++ b/include/codec/SkEncodedOrigin.h @@ -0,0 +1,23 @@ +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkEncodedOrigin_DEFINED +#define SkEncodedOrigin_DEFINED +// These values match the orientation www.exif.org/Exif2-2.PDF. +enum SkEncodedOrigin { + kTopLeft_SkEncodedOrigin = 1, // Default + kTopRight_SkEncodedOrigin = 2, // Reflected across y-axis + kBottomRight_SkEncodedOrigin = 3, // Rotated 180 + kBottomLeft_SkEncodedOrigin = 4, // Reflected across x-axis + kLeftTop_SkEncodedOrigin = 5, // Reflected across x-axis, Rotated 90 CCW + kRightTop_SkEncodedOrigin = 6, // Rotated 90 CW + kRightBottom_SkEncodedOrigin = 7, // Reflected across x-axis, Rotated 90 CW + kLeftBottom_SkEncodedOrigin = 8, // Rotated 90 CCW + kDefault_SkEncodedOrigin = kTopLeft_SkEncodedOrigin, + kLast_SkEncodedOrigin = kLeftBottom_SkEncodedOrigin, +}; +#endif // SkEncodedOrigin_DEFINED |