compilation fix: DefaultVisual() needs Display, not WXDisplay (and code cleanup in wxGetSubPixmap() as well)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35302 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-08-24 15:41:33 +00:00
parent cfd1ac216d
commit 4c620d1900

View File

@@ -271,25 +271,27 @@ static WXPixmap wxGetSubPixmap( WXDisplay* xdisplay, WXPixmap xpixmap,
int x, int y, int width, int height,
int depth )
{
int xscreen = DefaultScreen( (Display*)xdisplay );
Window xroot = RootWindow( (Display*)xdisplay, xscreen );
Visual* xvisual = DefaultVisual( xdisplay, xscreen );
Display * const dpy = (Display *)xdisplay;
XImage* ximage = XCreateImage( (Display*)xdisplay, xvisual, depth,
int xscreen = DefaultScreen( dpy );
Window xroot = RootWindow( dpy, xscreen );
Visual* xvisual = DefaultVisual( dpy, xscreen );
XImage* ximage = XCreateImage( dpy, xvisual, depth,
ZPixmap, 0, 0, width, height, 32, 0 );
ximage->data = (char*)malloc( ximage->bytes_per_line * ximage->height );
ximage = XGetSubImage( (Display*)xdisplay, (Pixmap)xpixmap,
ximage = XGetSubImage( dpy, (Pixmap)xpixmap,
x, y, width, height,
AllPlanes, ZPixmap, ximage, 0, 0 );
GC gc = XCreateGC( (Display*)xdisplay, (Pixmap)xpixmap, 0, NULL );
Pixmap ret = XCreatePixmap( (Display*)xdisplay, xroot,
GC gc = XCreateGC( dpy, (Pixmap)xpixmap, 0, NULL );
Pixmap ret = XCreatePixmap( dpy, xroot,
width, height, depth );
XPutImage( (Display*)xdisplay, ret, gc, ximage,
XPutImage( dpy, ret, gc, ximage,
0, 0, 0, 0, width, height );
XDestroyImage( ximage );
XFreeGC( (Display*)xdisplay, gc );
XFreeGC( dpy, gc );
return (WXPixmap)ret;
}