OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2005 Nokia. All rights reserved. | 3 * Copyright (C) 2005 Nokia. All rights reserved. |
4 * 2008 Eric Seidel <eric@webkit.org> | 4 * 2008 Eric Seidel <eric@webkit.org> |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 13 matching lines...) Expand all Loading... |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #ifndef FloatSize_h | 28 #ifndef FloatSize_h |
29 #define FloatSize_h | 29 #define FloatSize_h |
30 | 30 |
31 #include "platform/geometry/IntPoint.h" | 31 #include "platform/geometry/IntPoint.h" |
32 #include "wtf/MathExtras.h" | 32 #include "wtf/MathExtras.h" |
33 | 33 |
34 | |
35 #if OS(MACOSX) | 34 #if OS(MACOSX) |
36 typedef struct CGSize CGSize; | 35 typedef struct CGSize CGSize; |
37 | 36 |
38 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES | 37 #ifdef __OBJC__ |
39 typedef struct CGSize NSSize; | 38 #import <Foundation/Foundation.h> |
40 #else | |
41 typedef struct _NSSize NSSize; | |
42 #endif | 39 #endif |
43 #endif | 40 #endif |
44 | 41 |
45 namespace WebCore { | 42 namespace WebCore { |
46 | 43 |
47 class IntSize; | 44 class IntSize; |
48 class LayoutSize; | 45 class LayoutSize; |
49 | 46 |
50 class PLATFORM_EXPORT FloatSize { | 47 class PLATFORM_EXPORT FloatSize { |
51 public: | 48 public: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 98 } |
102 | 99 |
103 FloatSize transposedSize() const | 100 FloatSize transposedSize() const |
104 { | 101 { |
105 return FloatSize(m_height, m_width); | 102 return FloatSize(m_height, m_width); |
106 } | 103 } |
107 | 104 |
108 #if OS(MACOSX) | 105 #if OS(MACOSX) |
109 explicit FloatSize(const CGSize&); // don't do this implicitly since it's lo
ssy | 106 explicit FloatSize(const CGSize&); // don't do this implicitly since it's lo
ssy |
110 operator CGSize() const; | 107 operator CGSize() const; |
111 #if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) | 108 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) |
112 explicit FloatSize(const NSSize &); // don't do this implicitly since it's l
ossy | 109 explicit FloatSize(const NSSize &); // don't do this implicitly since it's l
ossy |
113 operator NSSize() const; | 110 operator NSSize() const; |
114 #endif | 111 #endif |
115 #endif | 112 #endif |
116 | 113 |
117 private: | 114 private: |
118 float m_width, m_height; | 115 float m_width, m_height; |
119 }; | 116 }; |
120 | 117 |
121 inline FloatSize& operator+=(FloatSize& a, const FloatSize& b) | 118 inline FloatSize& operator+=(FloatSize& a, const FloatSize& b) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 180 } |
184 | 181 |
185 inline IntPoint flooredIntPoint(const FloatSize& p) | 182 inline IntPoint flooredIntPoint(const FloatSize& p) |
186 { | 183 { |
187 return IntPoint(clampToInteger(floorf(p.width())), clampToInteger(floorf(p.h
eight()))); | 184 return IntPoint(clampToInteger(floorf(p.width())), clampToInteger(floorf(p.h
eight()))); |
188 } | 185 } |
189 | 186 |
190 } // namespace WebCore | 187 } // namespace WebCore |
191 | 188 |
192 #endif // FloatSize_h | 189 #endif // FloatSize_h |
OLD | NEW |