summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/FloatRect.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-07-13 10:14:36 +0100
committerBen Murdoch <benm@google.com>2011-07-13 11:03:14 +0100
commitd0147a863b872ecaa451ab0dce2a348760e99e2c (patch)
treeb4819830b7ab03f384ed8ab83734ac0f46193263 /Source/WebCore/platform/graphics/FloatRect.cpp
parent65b45b34343dc5d5b9dbeda52e9de428e146c8f7 (diff)
downloadexternal_webkit-d0147a863b872ecaa451ab0dce2a348760e99e2c.zip
external_webkit-d0147a863b872ecaa451ab0dce2a348760e99e2c.tar.gz
external_webkit-d0147a863b872ecaa451ab0dce2a348760e99e2c.tar.bz2
Merge WebKit at branches/chromium/742 r89068: Initial merge by Git.
Take us to top of Chrome 12 release branch (12.0.742.130) Change-Id: I4408a97e343a118cf4a1bb9d71367bcc2c16ae48
Diffstat (limited to 'Source/WebCore/platform/graphics/FloatRect.cpp')
-rw-r--r--Source/WebCore/platform/graphics/FloatRect.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/Source/WebCore/platform/graphics/FloatRect.cpp b/Source/WebCore/platform/graphics/FloatRect.cpp
index 165ef76..7afc92b 100644
--- a/Source/WebCore/platform/graphics/FloatRect.cpp
+++ b/Source/WebCore/platform/graphics/FloatRect.cpp
@@ -182,18 +182,6 @@ void FloatRect::fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const Fl
setLocationAndSizeFromEdges(left, top, right, bottom);
}
-static inline int safeFloatToInt(float x)
-{
- static const int s_intMax = std::numeric_limits<int>::max();
- static const int s_intMin = std::numeric_limits<int>::min();
-
- if (x >= static_cast<float>(s_intMax))
- return s_intMax;
- if (x < static_cast<float>(s_intMin))
- return s_intMin;
- return static_cast<int>(x);
-}
-
IntRect enclosingIntRect(const FloatRect& rect)
{
float left = floorf(rect.x());
@@ -201,8 +189,8 @@ IntRect enclosingIntRect(const FloatRect& rect)
float width = ceilf(rect.maxX()) - left;
float height = ceilf(rect.maxY()) - top;
- return IntRect(safeFloatToInt(left), safeFloatToInt(top),
- safeFloatToInt(width), safeFloatToInt(height));
+ return IntRect(clampToInteger(left), clampToInteger(top),
+ clampToInteger(width), clampToInteger(height));
}
FloatRect mapRect(const FloatRect& r, const FloatRect& srcRect, const FloatRect& destRect)