264fe59ded
but use integer coordinates. These are now used in ViewLayer for the coordinate system (layout, scrolling offset, view bitmap layout) * modest performance improvements by inlining some very often used methods, and by preventing to go down the entire layer tree too often, for example InvalidateScreenClipping was always called in the deep mode, therefor it is save to assume that the tree does not have to be traversed as soon as the clipping is already invalid git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19390 a95241bf-73f2-0310-859d-f6bbb57e9c96
80 lines
1.0 KiB
C++
80 lines
1.0 KiB
C++
/*
|
|
* Copyright 2001-2006, Haiku, Inc. All Rights Reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* Frans van Nispen
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
*/
|
|
|
|
|
|
#include "IntPoint.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "IntRect.h"
|
|
|
|
|
|
void
|
|
IntPoint::ConstrainTo(const IntRect& r)
|
|
{
|
|
x = max_c(min_c(x, r.right), r.left);
|
|
y = max_c(min_c(y, r.bottom), r.top);
|
|
}
|
|
|
|
|
|
void
|
|
IntPoint::PrintToStream() const
|
|
{
|
|
printf("IntPoint(x:%ld, y:%ld)\n", x, y);
|
|
}
|
|
|
|
|
|
IntPoint
|
|
IntPoint::operator+(const IntPoint& p) const
|
|
{
|
|
return IntPoint(x + p.x, y + p.y);
|
|
}
|
|
|
|
|
|
IntPoint
|
|
IntPoint::operator-(const IntPoint& p) const
|
|
{
|
|
return IntPoint(x - p.x, y - p.y);
|
|
}
|
|
|
|
|
|
IntPoint &
|
|
IntPoint::operator+=(const IntPoint& p)
|
|
{
|
|
x += p.x;
|
|
y += p.y;
|
|
|
|
return *this;
|
|
}
|
|
|
|
|
|
IntPoint &
|
|
IntPoint::operator-=(const IntPoint& p)
|
|
{
|
|
x -= p.x;
|
|
y -= p.y;
|
|
|
|
return *this;
|
|
}
|
|
|
|
|
|
bool
|
|
IntPoint::operator!=(const IntPoint& p) const
|
|
{
|
|
return x != p.x || y != p.y;
|
|
}
|
|
|
|
|
|
bool
|
|
IntPoint::operator==(const IntPoint& p) const
|
|
{
|
|
return x == p.x && y == p.y;
|
|
}
|
|
|