| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 | 209 |
| 210 inline float operator*(const FloatPoint& a, const FloatPoint& b) | 210 inline float operator*(const FloatPoint& a, const FloatPoint& b) |
| 211 { | 211 { |
| 212 // dot product | 212 // dot product |
| 213 return a.dot(b); | 213 return a.dot(b); |
| 214 } | 214 } |
| 215 | 215 |
| 216 inline IntPoint roundedIntPoint(const FloatPoint& p) | 216 inline IntPoint roundedIntPoint(const FloatPoint& p) |
| 217 { | 217 { |
| 218 return IntPoint(clampToInteger(roundf(p.x())), clampToInteger(roundf(p.y()))
); | 218 return IntPoint(clampTo<int>(roundf(p.x())), clampTo<int>(roundf(p.y()))); |
| 219 } | 219 } |
| 220 | 220 |
| 221 inline IntPoint flooredIntPoint(const FloatPoint& p) | 221 inline IntPoint flooredIntPoint(const FloatPoint& p) |
| 222 { | 222 { |
| 223 return IntPoint(clampToInteger(floorf(p.x())), clampToInteger(floorf(p.y()))
); | 223 return IntPoint(clampTo<int>(floorf(p.x())), clampTo<int>(floorf(p.y()))); |
| 224 } | 224 } |
| 225 | 225 |
| 226 inline IntPoint ceiledIntPoint(const FloatPoint& p) | 226 inline IntPoint ceiledIntPoint(const FloatPoint& p) |
| 227 { | 227 { |
| 228 return IntPoint(clampToInteger(ceilf(p.x())), clampToInteger(ceilf(p.y()))); | 228 return IntPoint(clampTo<int>(ceilf(p.x())), clampTo<int>(ceilf(p.y()))); |
| 229 } | 229 } |
| 230 | 230 |
| 231 inline IntSize flooredIntSize(const FloatPoint& p) | 231 inline IntSize flooredIntSize(const FloatPoint& p) |
| 232 { | 232 { |
| 233 return IntSize(clampToInteger(floorf(p.x())), clampToInteger(floorf(p.y())))
; | 233 return IntSize(clampTo<int>(floorf(p.x())), clampTo<int>(floorf(p.y()))); |
| 234 } | 234 } |
| 235 | 235 |
| 236 inline FloatSize toFloatSize(const FloatPoint& a) | 236 inline FloatSize toFloatSize(const FloatPoint& a) |
| 237 { | 237 { |
| 238 return FloatSize(a.x(), a.y()); | 238 return FloatSize(a.x(), a.y()); |
| 239 } | 239 } |
| 240 | 240 |
| 241 PLATFORM_EXPORT float findSlope(const FloatPoint& p1, const FloatPoint& p2, floa
t& c); | 241 PLATFORM_EXPORT float findSlope(const FloatPoint& p1, const FloatPoint& p2, floa
t& c); |
| 242 | 242 |
| 243 // Find point where lines through the two pairs of points intersect. Returns fal
se if the lines don't intersect. | 243 // 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); | 244 PLATFORM_EXPORT bool findIntersection(const FloatPoint& p1, const FloatPoint& p2
, const FloatPoint& d1, const FloatPoint& d2, FloatPoint& intersection); |
| 245 | 245 |
| 246 } | 246 } |
| 247 | 247 |
| 248 #endif | 248 #endif |
| OLD | NEW |