Fix x coordinate offset error

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@23462 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-09-12 10:32:18 +00:00
parent eedc280b9d
commit 45fbea927a
2 changed files with 10 additions and 8 deletions

View file

@ -6,7 +6,8 @@
Copyright (C) 2001-2005 Free Software Foundation, Inc. Copyright (C) 2001-2005 Free Software Foundation, Inc.
Written by: <author name="Wim Oudshoorn"><email>woudshoo@xs4all.nl</email></author> Written by: <author name="Wim Oudshoorn">
<email>woudshoo@xs4all.nl</email></author>
Date: Nov, 2001 Date: Nov, 2001
This file is part of the GNU Objective C User Interface Library. This file is part of the GNU Objective C User Interface Library.
@ -23,7 +24,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
/* /*
@ -115,7 +117,7 @@ static inline XRectangle
XGIntersectionRect (XRectangle aRect, XRectangle bRect) XGIntersectionRect (XRectangle aRect, XRectangle bRect)
{ {
if (XGMaxX (aRect) <= XGMinX (bRect) || XGMaxX (bRect) <= XGMinX (aRect) if (XGMaxX (aRect) <= XGMinX (bRect) || XGMaxX (bRect) <= XGMinX (aRect)
|| XGMaxY (aRect) <= XGMinY (bRect) || XGMaxY (bRect) <= XGMinY (aRect)) || XGMaxY (aRect) <= XGMinY (bRect) || XGMaxY (bRect) <= XGMinY (aRect))
{ {
return XGMakeRect (0, 0, 0, 0); return XGMakeRect (0, 0, 0, 0);
} }
@ -207,8 +209,7 @@ XGWindowPointToX (XGGState *s, NSPoint p)
{ {
XPoint newPoint; XPoint newPoint;
newPoint.x = gs_floor(p.x + s->offset.x); newPoint.x = gs_floor(p.x - s->offset.x);
newPoint.y = gs_floor(s->offset.y - p.y); newPoint.y = gs_floor(s->offset.y - p.y);
return newPoint; return newPoint;
@ -219,9 +220,9 @@ XGWindowRectToX (XGGState *s, NSRect r)
{ {
XRectangle newRect; XRectangle newRect;
newRect.x = gs_floor(r.origin.x + s->offset.x); newRect.x = gs_floor(r.origin.x - s->offset.x);
/* We gs_floor the extreme points, and get the width as the difference */ /* We gs_floor the extreme points, and get the width as the difference */
newRect.width = gs_floor(r.origin.x + s->offset.x + r.size.width) newRect.width = gs_floor(r.origin.x - s->offset.x + r.size.width)
- newRect.x; - newRect.x;
newRect.y = gs_floor(s->offset.y - r.origin.y - r.size.height); newRect.y = gs_floor(s->offset.y - r.origin.y - r.size.height);

View file

@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include "config.h" #include "config.h"