OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2005 Nokia. All rights reserved. | 3 * Copyright (C) 2005 Nokia. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef FloatRect_h | 27 #ifndef FloatRect_h |
28 #define FloatRect_h | 28 #define FloatRect_h |
29 | 29 |
30 #include "platform/geometry/FloatPoint.h" | 30 #include "platform/geometry/FloatPoint.h" |
| 31 #include "third_party/skia/include/core/SkRect.h" |
31 #include "wtf/Vector.h" | 32 #include "wtf/Vector.h" |
32 | 33 |
33 #if OS(MACOSX) | 34 #if OS(MACOSX) |
34 typedef struct CGRect CGRect; | 35 typedef struct CGRect CGRect; |
35 | 36 |
36 #ifdef __OBJC__ | 37 #ifdef __OBJC__ |
37 #import <Foundation/Foundation.h> | 38 #import <Foundation/Foundation.h> |
38 #endif | 39 #endif |
39 #endif | 40 #endif |
40 | 41 |
41 struct SkRect; | |
42 | |
43 namespace WebCore { | 42 namespace WebCore { |
44 | 43 |
45 class LayoutRect; | 44 class LayoutRect; |
46 class IntRect; | 45 class IntRect; |
47 class IntPoint; | 46 class IntPoint; |
48 | 47 |
49 class PLATFORM_EXPORT FloatRect { | 48 class PLATFORM_EXPORT FloatRect { |
50 public: | 49 public: |
51 enum ContainsMode { | 50 enum ContainsMode { |
52 InsideOrOnStroke, | 51 InsideOrOnStroke, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 164 |
166 #if OS(MACOSX) | 165 #if OS(MACOSX) |
167 FloatRect(const CGRect&); | 166 FloatRect(const CGRect&); |
168 operator CGRect() const; | 167 operator CGRect() const; |
169 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) | 168 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) |
170 FloatRect(const NSRect&); | 169 FloatRect(const NSRect&); |
171 operator NSRect() const; | 170 operator NSRect() const; |
172 #endif | 171 #endif |
173 #endif | 172 #endif |
174 | 173 |
175 operator SkRect() const; | 174 operator SkRect() const { return SkRect::MakeXYWH(x(), y(), width(), height(
)); } |
176 | 175 |
177 private: | 176 private: |
178 FloatPoint m_location; | 177 FloatPoint m_location; |
179 FloatSize m_size; | 178 FloatSize m_size; |
180 | 179 |
181 void setLocationAndSizeFromEdges(float left, float top, float right, float b
ottom) | 180 void setLocationAndSizeFromEdges(float left, float top, float right, float b
ottom) |
182 { | 181 { |
183 m_location.set(left, top); | 182 m_location.set(left, top); |
184 m_size.setWidth(right - left); | 183 m_size.setWidth(right - left); |
185 m_size.setHeight(bottom - top); | 184 m_size.setHeight(bottom - top); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 PLATFORM_EXPORT IntRect enclosedIntRect(const FloatRect&); | 232 PLATFORM_EXPORT IntRect enclosedIntRect(const FloatRect&); |
234 | 233 |
235 PLATFORM_EXPORT IntRect roundedIntRect(const FloatRect&); | 234 PLATFORM_EXPORT IntRect roundedIntRect(const FloatRect&); |
236 | 235 |
237 // Map supplied rect from srcRect to an equivalent rect in destRect. | 236 // Map supplied rect from srcRect to an equivalent rect in destRect. |
238 PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, co
nst FloatRect& destRect); | 237 PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, co
nst FloatRect& destRect); |
239 | 238 |
240 } | 239 } |
241 | 240 |
242 #endif | 241 #endif |
OLD | NEW |