| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 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 14 matching lines...) Expand all Loading... |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef FloatPoint_h | 27 #ifndef FloatPoint_h |
| 28 #define FloatPoint_h | 28 #define FloatPoint_h |
| 29 | 29 |
| 30 #include "platform/geometry/FloatSize.h" | 30 #include "platform/geometry/FloatSize.h" |
| 31 #include "platform/geometry/IntPoint.h" | 31 #include "platform/geometry/IntPoint.h" |
| 32 #include "wtf/MathExtras.h" | 32 #include "wtf/MathExtras.h" |
| 33 #include <algorithm> | 33 #include <algorithm> |
| 34 | 34 |
| 35 #if OS(MACOSX) | |
| 36 typedef struct CGPoint CGPoint; | |
| 37 | |
| 38 #ifdef __OBJC__ | |
| 39 #import <Foundation/Foundation.h> | |
| 40 #endif | |
| 41 #endif | |
| 42 | |
| 43 struct SkPoint; | 35 struct SkPoint; |
| 44 | 36 |
| 45 namespace blink { | 37 namespace blink { |
| 46 | 38 |
| 47 class IntPoint; | 39 class IntPoint; |
| 48 class IntSize; | 40 class IntSize; |
| 49 class LayoutPoint; | 41 class LayoutPoint; |
| 50 class LayoutSize; | 42 class LayoutSize; |
| 51 | 43 |
| 52 class PLATFORM_EXPORT FloatPoint { | 44 class PLATFORM_EXPORT FloatPoint { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 FloatPoint transposedPoint() const | 123 FloatPoint transposedPoint() const |
| 132 { | 124 { |
| 133 return FloatPoint(m_y, m_x); | 125 return FloatPoint(m_y, m_x); |
| 134 } | 126 } |
| 135 | 127 |
| 136 FloatPoint scaledBy(float scale) const | 128 FloatPoint scaledBy(float scale) const |
| 137 { | 129 { |
| 138 return FloatPoint(m_x * scale, m_y * scale); | 130 return FloatPoint(m_x * scale, m_y * scale); |
| 139 } | 131 } |
| 140 | 132 |
| 141 #if OS(MACOSX) | |
| 142 FloatPoint(const CGPoint&); | |
| 143 operator CGPoint() const; | |
| 144 #if defined(__OBJC__) && !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) | |
| 145 FloatPoint(const NSPoint&); | |
| 146 operator NSPoint() const; | |
| 147 #endif | |
| 148 #endif | |
| 149 | |
| 150 SkPoint data() const; | 133 SkPoint data() const; |
| 151 | 134 |
| 152 private: | 135 private: |
| 153 float m_x, m_y; | 136 float m_x, m_y; |
| 154 }; | 137 }; |
| 155 | 138 |
| 156 | 139 |
| 157 inline FloatPoint& operator+=(FloatPoint& a, const FloatSize& b) | 140 inline FloatPoint& operator+=(FloatPoint& a, const FloatSize& b) |
| 158 { | 141 { |
| 159 a.move(b.width(), b.height()); | 142 a.move(b.width(), b.height()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 222 } |
| 240 | 223 |
| 241 PLATFORM_EXPORT float findSlope(const FloatPoint& p1, const FloatPoint& p2, floa
t& c); | 224 PLATFORM_EXPORT float findSlope(const FloatPoint& p1, const FloatPoint& p2, floa
t& c); |
| 242 | 225 |
| 243 // Find point where lines through the two pairs of points intersect. Returns fal
se if the lines don't intersect. | 226 // Find point where lines through the two pairs of points intersect. Returns fal
se if the lines don't intersect. |
| 244 PLATFORM_EXPORT bool findIntersection(const FloatPoint& p1, const FloatPoint& p2
, const FloatPoint& d1, const FloatPoint& d2, FloatPoint& intersection); | 227 PLATFORM_EXPORT bool findIntersection(const FloatPoint& p1, const FloatPoint& p2
, const FloatPoint& d1, const FloatPoint& d2, FloatPoint& intersection); |
| 245 | 228 |
| 246 } | 229 } |
| 247 | 230 |
| 248 #endif | 231 #endif |
| OLD | NEW |