Add an explicit IntRect constructor that takes a FloatRect.
* platform/graphics/IntRect.cpp:
(WebCore::IntRect::IntRect):
* platform/graphics/IntRect.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17900
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-11-27 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Adam.
+
+ Add an explicit IntRect constructor that takes a FloatRect.
+
+ * platform/graphics/IntRect.cpp:
+ (WebCore::IntRect::IntRect):
+ * platform/graphics/IntRect.h:
+
2006-11-27 Ada Chan <adachan@apple.com>
Reviewed by Adam.
#include "config.h"
#include "IntRect.h"
+#include "FloatRect.h"
#include <algorithm>
using std::max;
namespace WebCore {
+IntRect::IntRect(const FloatRect& r)
+ : m_location(IntPoint(r.x(), r.y()))
+ , m_size(IntSize(r.width(), r.height()))
+{
+}
+
bool IntRect::intersects(const IntRect& other) const
{
// Checking emptiness handles negative widths as well as zero.
namespace WebCore {
+class FloatRect;
+
class IntRect {
public:
IntRect() { }
IntRect(int x, int y, int width, int height)
: m_location(IntPoint(x, y)), m_size(IntSize(width, height)) { }
+ explicit IntRect(const FloatRect& rect); // don't do this implicitly since it's lossy
+
IntPoint location() const { return m_location; }
IntSize size() const { return m_size; }