| 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 13 matching lines...) Expand all Loading... |
| 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 "third_party/skia/include/core/SkRect.h" |
| 32 #include "wtf/Vector.h" | 32 #include "wtf/Vector.h" |
| 33 | 33 |
| 34 #if OS(MACOSX) | |
| 35 typedef struct CGRect CGRect; | |
| 36 | |
| 37 #ifdef __OBJC__ | |
| 38 #import <Foundation/Foundation.h> | |
| 39 #endif | |
| 40 #endif | |
| 41 | |
| 42 namespace blink { | 34 namespace blink { |
| 43 | 35 |
| 44 class LayoutRect; | 36 class LayoutRect; |
| 45 class IntRect; | 37 class IntRect; |
| 46 | 38 |
| 47 class PLATFORM_EXPORT FloatRect { | 39 class PLATFORM_EXPORT FloatRect { |
| 48 public: | 40 public: |
| 49 enum ContainsMode { | 41 enum ContainsMode { |
| 50 InsideOrOnStroke, | 42 InsideOrOnStroke, |
| 51 InsideButNotOnStroke | 43 InsideButNotOnStroke |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void scale(float s) { scale(s, s); } | 146 void scale(float s) { scale(s, s); } |
| 155 void scale(float sx, float sy); | 147 void scale(float sx, float sy); |
| 156 | 148 |
| 157 FloatRect transposedRect() const { return FloatRect(m_location.transposedPoi
nt(), m_size.transposedSize()); } | 149 FloatRect transposedRect() const { return FloatRect(m_location.transposedPoi
nt(), m_size.transposedSize()); } |
| 158 | 150 |
| 159 // Re-initializes this rectangle to fit the sets of passed points. | 151 // Re-initializes this rectangle to fit the sets of passed points. |
| 160 void fitToPoints(const FloatPoint& p0, const FloatPoint& p1); | 152 void fitToPoints(const FloatPoint& p0, const FloatPoint& p1); |
| 161 void fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const FloatPoin
t& p2); | 153 void fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const FloatPoin
t& p2); |
| 162 void fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const FloatPoin
t& p2, const FloatPoint& p3); | 154 void fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const FloatPoin
t& p2, const FloatPoint& p3); |
| 163 | 155 |
| 164 #if OS(MACOSX) | |
| 165 FloatRect(const CGRect&); | |
| 166 operator CGRect() const; | |
| 167 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) | |
| 168 FloatRect(const NSRect&); | |
| 169 operator NSRect() const; | |
| 170 #endif | |
| 171 #endif | |
| 172 | |
| 173 operator SkRect() const { return SkRect::MakeXYWH(x(), y(), width(), height(
)); } | 156 operator SkRect() const { return SkRect::MakeXYWH(x(), y(), width(), height(
)); } |
| 174 | 157 |
| 175 private: | 158 private: |
| 176 FloatPoint m_location; | 159 FloatPoint m_location; |
| 177 FloatSize m_size; | 160 FloatSize m_size; |
| 178 | 161 |
| 179 void setLocationAndSizeFromEdges(float left, float top, float right, float b
ottom) | 162 void setLocationAndSizeFromEdges(float left, float top, float right, float b
ottom) |
| 180 { | 163 { |
| 181 m_location.set(left, top); | 164 m_location.set(left, top); |
| 182 m_size.setWidth(right - left); | 165 m_size.setWidth(right - left); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 PLATFORM_EXPORT IntRect enclosedIntRect(const FloatRect&); | 214 PLATFORM_EXPORT IntRect enclosedIntRect(const FloatRect&); |
| 232 | 215 |
| 233 PLATFORM_EXPORT IntRect roundedIntRect(const FloatRect&); | 216 PLATFORM_EXPORT IntRect roundedIntRect(const FloatRect&); |
| 234 | 217 |
| 235 // Map supplied rect from srcRect to an equivalent rect in destRect. | 218 // Map supplied rect from srcRect to an equivalent rect in destRect. |
| 236 PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, co
nst FloatRect& destRect); | 219 PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, co
nst FloatRect& destRect); |
| 237 | 220 |
| 238 } | 221 } |
| 239 | 222 |
| 240 #endif | 223 #endif |
| OLD | NEW |