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 14 matching lines...) Expand all Loading... |
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 "core/platform/graphics/IntPoint.h" | 31 #include "core/platform/graphics/IntPoint.h" |
32 #include "wtf/MathExtras.h" | 32 #include "wtf/MathExtras.h" |
33 | 33 |
34 | 34 |
35 #if OS(DARWIN) | 35 #if OS(MACOSX) |
36 typedef struct CGSize CGSize; | 36 typedef struct CGSize CGSize; |
37 | 37 |
38 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES | 38 #ifdef NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES |
39 typedef struct CGSize NSSize; | 39 typedef struct CGSize NSSize; |
40 #else | 40 #else |
41 typedef struct _NSSize NSSize; | 41 typedef struct _NSSize NSSize; |
42 #endif | 42 #endif |
43 #endif | 43 #endif |
44 | 44 |
45 namespace WebCore { | 45 namespace WebCore { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 float diagonalLengthSquared() const | 98 float diagonalLengthSquared() const |
99 { | 99 { |
100 return m_width * m_width + m_height * m_height; | 100 return m_width * m_width + m_height * m_height; |
101 } | 101 } |
102 | 102 |
103 FloatSize transposedSize() const | 103 FloatSize transposedSize() const |
104 { | 104 { |
105 return FloatSize(m_height, m_width); | 105 return FloatSize(m_height, m_width); |
106 } | 106 } |
107 | 107 |
108 #if OS(DARWIN) | 108 #if OS(MACOSX) |
109 explicit FloatSize(const CGSize&); // don't do this implicitly since it's lo
ssy | 109 explicit FloatSize(const CGSize&); // don't do this implicitly since it's lo
ssy |
110 operator CGSize() const; | 110 operator CGSize() const; |
111 #if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) | 111 #if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) |
112 explicit FloatSize(const NSSize &); // don't do this implicitly since it's l
ossy | 112 explicit FloatSize(const NSSize &); // don't do this implicitly since it's l
ossy |
113 operator NSSize() const; | 113 operator NSSize() const; |
114 #endif | 114 #endif |
115 #endif | 115 #endif |
116 | 116 |
117 private: | 117 private: |
118 float m_width, m_height; | 118 float m_width, m_height; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 183 } |
184 | 184 |
185 inline IntPoint flooredIntPoint(const FloatSize& p) | 185 inline IntPoint flooredIntPoint(const FloatSize& p) |
186 { | 186 { |
187 return IntPoint(clampToInteger(floorf(p.width())), clampToInteger(floorf(p.h
eight()))); | 187 return IntPoint(clampToInteger(floorf(p.width())), clampToInteger(floorf(p.h
eight()))); |
188 } | 188 } |
189 | 189 |
190 } // namespace WebCore | 190 } // namespace WebCore |
191 | 191 |
192 #endif // FloatSize_h | 192 #endif // FloatSize_h |
OLD | NEW |