OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef ImageOrientation_h | 26 #ifndef ImageOrientation_h |
27 #define ImageOrientation_h | 27 #define ImageOrientation_h |
28 | 28 |
29 #include "platform/PlatformExport.h" | 29 #include "platform/PlatformExport.h" |
| 30 #include "wtf/Allocator.h" |
30 | 31 |
31 namespace blink { | 32 namespace blink { |
32 | 33 |
33 class AffineTransform; | 34 class AffineTransform; |
34 class FloatSize; | 35 class FloatSize; |
35 | 36 |
36 // This enum intentionally matches the orientation values from the EXIF spec. | 37 // This enum intentionally matches the orientation values from the EXIF spec. |
37 // See JEITA CP-3451, page 18. http://www.exif.org/Exif2-2.PDF | 38 // See JEITA CP-3451, page 18. http://www.exif.org/Exif2-2.PDF |
38 enum ImageOrientationEnum { | 39 enum ImageOrientationEnum { |
39 // "TopLeft" means that the 0 row starts at the Top, the 0 column starts at
the Left. | 40 // "TopLeft" means that the 0 row starts at the Top, the 0 column starts at
the Left. |
40 OriginTopLeft = 1, // default | 41 OriginTopLeft = 1, // default |
41 OriginTopRight = 2, // mirror along y-axis | 42 OriginTopRight = 2, // mirror along y-axis |
42 OriginBottomRight = 3, // 180 degree rotation | 43 OriginBottomRight = 3, // 180 degree rotation |
43 OriginBottomLeft = 4, // mirror along the x-axis | 44 OriginBottomLeft = 4, // mirror along the x-axis |
44 OriginLeftTop = 5, // mirror along x-axis + 270 degree CW rotation | 45 OriginLeftTop = 5, // mirror along x-axis + 270 degree CW rotation |
45 OriginRightTop = 6, // 90 degree CW rotation | 46 OriginRightTop = 6, // 90 degree CW rotation |
46 OriginRightBottom = 7, // mirror along x-axis + 90 degree CW rotation | 47 OriginRightBottom = 7, // mirror along x-axis + 90 degree CW rotation |
47 OriginLeftBottom = 8, // 270 degree CW rotation | 48 OriginLeftBottom = 8, // 270 degree CW rotation |
48 // All other values are "reserved" as of EXIF 2.2 | 49 // All other values are "reserved" as of EXIF 2.2 |
49 DefaultImageOrientation = OriginTopLeft, | 50 DefaultImageOrientation = OriginTopLeft, |
50 ImageOrientationEnumEnd = OriginLeftBottom + 1, | 51 ImageOrientationEnumEnd = OriginLeftBottom + 1, |
51 }; | 52 }; |
52 | 53 |
53 enum RespectImageOrientationEnum { | 54 enum RespectImageOrientationEnum { |
54 DoNotRespectImageOrientation = 0, | 55 DoNotRespectImageOrientation = 0, |
55 RespectImageOrientation = 1 | 56 RespectImageOrientation = 1 |
56 }; | 57 }; |
57 | 58 |
58 class PLATFORM_EXPORT ImageOrientation { | 59 class PLATFORM_EXPORT ImageOrientation final { |
| 60 DISALLOW_NEW(); |
59 public: | 61 public: |
60 ImageOrientation(ImageOrientationEnum orientation = DefaultImageOrientation) | 62 ImageOrientation(ImageOrientationEnum orientation = DefaultImageOrientation) |
61 : m_orientation(orientation) | 63 : m_orientation(orientation) |
62 { | 64 { |
63 } | 65 } |
64 | 66 |
65 bool usesWidthAsHeight() const | 67 bool usesWidthAsHeight() const |
66 { | 68 { |
67 // Values 5 through 8 all flip the width/height. | 69 // Values 5 through 8 all flip the width/height. |
68 return m_orientation >= OriginLeftTop; | 70 return m_orientation >= OriginLeftTop; |
(...skipping 19 matching lines...) Expand all Loading... |
88 ImageOrientationEnum orientation() const { return m_orientation; } | 90 ImageOrientationEnum orientation() const { return m_orientation; } |
89 | 91 |
90 private: | 92 private: |
91 // FIXME: This only needs to be one byte. | 93 // FIXME: This only needs to be one byte. |
92 ImageOrientationEnum m_orientation; | 94 ImageOrientationEnum m_orientation; |
93 }; | 95 }; |
94 | 96 |
95 } // namespace blink | 97 } // namespace blink |
96 | 98 |
97 #endif // ImageOrientation_h | 99 #endif // ImageOrientation_h |
OLD | NEW |