| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2009 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef IntRect_h | 26 #ifndef IntRect_h |
| 27 #define IntRect_h | 27 #define IntRect_h |
| 28 | 28 |
| 29 #include "platform/geometry/IntPoint.h" | 29 #include "platform/geometry/IntPoint.h" |
| 30 #include "wtf/FastAllocBase.h" | 30 #include "wtf/FastAllocBase.h" |
| 31 #include "wtf/Vector.h" | 31 #include "wtf/Vector.h" |
| 32 #include "wtf/VectorTraits.h" | 32 #include "wtf/VectorTraits.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 struct SkRect; | 34 struct SkRect; |
| 43 struct SkIRect; | 35 struct SkIRect; |
| 44 | 36 |
| 45 namespace blink { | 37 namespace blink { |
| 46 | 38 |
| 47 class FloatRect; | 39 class FloatRect; |
| 48 class LayoutRect; | 40 class LayoutRect; |
| 49 | 41 |
| 50 class PLATFORM_EXPORT IntRect { | 42 class PLATFORM_EXPORT IntRect { |
| 51 WTF_MAKE_FAST_ALLOCATED; | 43 WTF_MAKE_FAST_ALLOCATED; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 m_size.setHeight(m_size.height() + dy + dy); | 136 m_size.setHeight(m_size.height() + dy + dy); |
| 145 } | 137 } |
| 146 void inflate(int d) { inflateX(d); inflateY(d); } | 138 void inflate(int d) { inflateX(d); inflateY(d); } |
| 147 void scale(float s); | 139 void scale(float s); |
| 148 | 140 |
| 149 IntSize differenceToPoint(const IntPoint&) const; | 141 IntSize differenceToPoint(const IntPoint&) const; |
| 150 int distanceSquaredToPoint(const IntPoint& p) const { return differenceToPoi
nt(p).diagonalLengthSquared(); } | 142 int distanceSquaredToPoint(const IntPoint& p) const { return differenceToPoi
nt(p).diagonalLengthSquared(); } |
| 151 | 143 |
| 152 IntRect transposedRect() const { return IntRect(m_location.transposedPoint()
, m_size.transposedSize()); } | 144 IntRect transposedRect() const { return IntRect(m_location.transposedPoint()
, m_size.transposedSize()); } |
| 153 | 145 |
| 154 #if OS(MACOSX) | |
| 155 operator CGRect() const; | |
| 156 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) | |
| 157 operator NSRect() const; | |
| 158 #endif | |
| 159 #endif | |
| 160 | |
| 161 operator SkRect() const; | 146 operator SkRect() const; |
| 162 operator SkIRect() const; | 147 operator SkIRect() const; |
| 163 | 148 |
| 164 #ifndef NDEBUG | 149 #ifndef NDEBUG |
| 165 // Prints the rect to the screen. | 150 // Prints the rect to the screen. |
| 166 void show() const; | 151 void show() const; |
| 167 #endif | 152 #endif |
| 168 | 153 |
| 169 private: | 154 private: |
| 170 IntPoint m_location; | 155 IntPoint m_location; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 190 inline bool operator==(const IntRect& a, const IntRect& b) | 175 inline bool operator==(const IntRect& a, const IntRect& b) |
| 191 { | 176 { |
| 192 return a.location() == b.location() && a.size() == b.size(); | 177 return a.location() == b.location() && a.size() == b.size(); |
| 193 } | 178 } |
| 194 | 179 |
| 195 inline bool operator!=(const IntRect& a, const IntRect& b) | 180 inline bool operator!=(const IntRect& a, const IntRect& b) |
| 196 { | 181 { |
| 197 return a.location() != b.location() || a.size() != b.size(); | 182 return a.location() != b.location() || a.size() != b.size(); |
| 198 } | 183 } |
| 199 | 184 |
| 200 #if OS(MACOSX) | |
| 201 PLATFORM_EXPORT IntRect enclosingIntRect(const CGRect&); | |
| 202 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) | |
| 203 PLATFORM_EXPORT IntRect enclosingIntRect(const NSRect&); | |
| 204 #endif | |
| 205 #endif | |
| 206 | |
| 207 } // namespace blink | 185 } // namespace blink |
| 208 | 186 |
| 209 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::IntRect); | 187 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::IntRect); |
| 210 | 188 |
| 211 #endif // IntRect_h | 189 #endif // IntRect_h |
| OLD | NEW |