fixup flushwindowrect coordinate handling.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@23466 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-09-12 13:00:10 +00:00
parent 28ae1c0f52
commit caae9667d4
3 changed files with 19 additions and 14 deletions

View file

@ -9,7 +9,7 @@
* Source/x11/XGServerWindow.m:
* Source/x11/XGServerEvent.m:
Get backend to generate NSEvent objects with event location given in
OpernStep coordinates.
OpenStep coordinates. Fix flushwindowrect coordinate handling.
Update art backend to try to honor the x and y window offsets
provided in the graphics state.

View file

@ -2659,6 +2659,7 @@ static BOOL didCreatePixmaps;
XGCValues values;
unsigned long valuemask;
gswindow_device_t *window;
float l, r, t, b;
window = WINDOW_WITH_TAG(win);
if (win == 0 || window == NULL)
@ -2667,7 +2668,7 @@ static BOOL didCreatePixmaps;
return;
}
NSDebugLLog(@"XGTrace", @"DPSflushwindowrect: %@ : %d",
NSDebugLLog(@"XGFlush", @"DPSflushwindowrect: %@ : %d",
NSStringFromRect(rect), win);
if (window->type == NSBackingStoreNonretained)
{
@ -2675,23 +2676,20 @@ static BOOL didCreatePixmaps;
return;
}
/* FIXME: Doesn't take into account any offset added to the window
(from PSsetgcdrawable) or possible scaling (unlikely in X-windows,
but what about other devices?) */
rect.origin.y = NSHeight(window->xframe) - NSMaxY(rect);
values.function = GXcopy;
values.plane_mask = AllPlanes;
values.clip_mask = None;
valuemask = (GCFunction | GCPlaneMask | GCClipMask);
XChangeGC(dpy, window->gc, valuemask, &values);
xi = NSMinX(rect); // width/height seems
yi = NSMinY(rect); // to require +1 pixel
width = NSWidth(rect) + 1; // to copy out
height = NSHeight(rect) + 1;
[self styleoffsets: &l : &r : &t : &b
: window->win_attrs.window_style : window->ident];
xi = NSMinX(rect) - l;
yi = NSHeight(window->xframe) + b - NSMaxY(rect);
width = NSWidth(rect);
height = NSHeight(rect);
NSDebugLLog (@"NSWindow",
NSDebugLLog (@"XGFlush",
@"copy X rect ((%d, %d), (%d, %d))", xi, yi, width, height);
if (width > 0 || height > 0)

View file

@ -245,6 +245,8 @@ static Region emptyRegion;
}
XSetRegion(XDPY, xgcntxt, clipregion);
NSDebugLLog(@"XGGraphics", @"Clip %@ set to X rect %@",
self, NSStringFromRect([self clipRect]));
}
/* Returns the clip region, which must be freed by the caller */
@ -1485,10 +1487,12 @@ static Region emptyRegion;
- (void)DPSrectclip: (float)x : (float)y : (float)w : (float)h
{
XRectangle xrect;
NSRect orect;
CHECK_GC;
xrect = XGViewRectToX(self, NSMakeRect(x, y, w, h));
orect = NSMakeRect(x, y, w, h);
xrect = XGViewRectToX(self, orect);
if (clipregion == 0)
{
@ -1522,7 +1526,10 @@ static Region emptyRegion;
[self setColor: &fillColor state: COLOR_FILL];
bounds = XGViewRectToX(self, NSMakeRect(x, y, w, h));
// Hack: Only draw when alpha is not zero
NSDebugLLog(@"XGGraphics", @"Fill %@ X rect %d,%d,%d,%d",
self, bounds.x, bounds.y, bounds.width, bounds.height);
// Hack: Only draw when alpha is not zero
if (drawingAlpha == NO || fillColor.field[AINDEX] != 0.0)
XFillRectangle(XDPY, draw, xgcntxt,
bounds.x, bounds.y, bounds.width, bounds.height);