From: Vadim Zeitlin Date: Wed, 24 Aug 2005 15:41:33 +0000 (+0000) Subject: compilation fix: DefaultVisual() needs Display, not WXDisplay (and code cleanup in... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4c620d190086830fcfce44cebadc4cbce2b6363d 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 --- diff --git a/src/x11/bitmap.cpp b/src/x11/bitmap.cpp index d2901ad3b3..6a58cb709c 100644 --- a/src/x11/bitmap.cpp +++ b/src/x11/bitmap.cpp @@ -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; + + int xscreen = DefaultScreen( dpy ); + Window xroot = RootWindow( dpy, xscreen ); + Visual* xvisual = DefaultVisual( dpy, xscreen ); - XImage* ximage = XCreateImage( (Display*)xdisplay, xvisual, depth, + 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; }