Revision: 154 http://trac.macosforge.org/projects/xquartz/changeset/154 Author: gstaplin@apple.com Date: 2009-02-16 15:46:31 -0800 (Mon, 16 Feb 2009) Log Message: ----------- Make the AppleDRI interface a bit more robust with regard to buffer sizes, and changes to the implementation, if for example another surface library is used at some point in the future. Modified Paths: -------------- AppleSGLX/trunk/apple_glx_pixmap.c AppleSGLX/trunk/appledri.c AppleSGLX/trunk/appledri.h AppleSGLX/trunk/appledristr.h Modified: AppleSGLX/trunk/apple_glx_pixmap.c =================================================================== --- AppleSGLX/trunk/apple_glx_pixmap.c 2009-02-16 23:42:57 UTC (rev 153) +++ AppleSGLX/trunk/apple_glx_pixmap.c 2009-02-16 23:46:31 UTC (rev 154) @@ -40,7 +40,7 @@ struct apple_glx_pixmap { GLXPixmap xpixmap; void *buffer; - int width, height; + int width, height, pitch, /*bytes per pixel*/ bpp; size_t size; char path[PATH_MAX]; int fd; @@ -98,8 +98,8 @@ p->buffer = NULL; if(!XAppleDRICreatePixmap(dpy, screen, pixmap, - &p->width, &p->height, &p->size, - p->path, PATH_MAX)) { + &p->width, &p->height, &p->pitch, &p->bpp, + &p->size, p->path, PATH_MAX)) { free(p); return true; } Modified: AppleSGLX/trunk/appledri.c =================================================================== --- AppleSGLX/trunk/appledri.c 2009-02-16 23:42:57 UTC (rev 153) +++ AppleSGLX/trunk/appledri.c 2009-02-16 23:46:31 UTC (rev 154) @@ -370,8 +370,8 @@ } Bool XAppleDRICreatePixmap(Display *dpy, int screen, Drawable drawable, - int *width, int *height, size_t *size, - char *bufname, size_t bufnamesize) { + int *width, int *height, int *pitch, int *bpp, + size_t *size, char *bufname, size_t bufnamesize) { XExtDisplayInfo *info = find_display(dpy); xAppleDRICreatePixmapReq *req; xAppleDRICreatePixmapReply rep; @@ -402,6 +402,8 @@ *width = rep.width; *height = rep.height; + *pitch = rep.pitch; + *bpp = rep.bpp; *size = rep.size; UnlockDisplay(dpy); Modified: AppleSGLX/trunk/appledri.h =================================================================== --- AppleSGLX/trunk/appledri.h 2009-02-16 23:42:57 UTC (rev 153) +++ AppleSGLX/trunk/appledri.h 2009-02-16 23:46:31 UTC (rev 154) @@ -113,8 +113,8 @@ Bool XAppleDRISwapBuffers(Display *dpy, int screen, Drawable drawable); Bool XAppleDRICreatePixmap(Display *dpy, int screen, Drawable drawable, - int *width, int *height, size_t *size, - char *bufname, size_t bufnamesize); + int *width, int *height, int *pitch, int *bpp, + size_t *size, char *bufname, size_t bufnamesize); Bool XAppleDRIDestroyPixmap(Display *dpy, Pixmap pixmap); Modified: AppleSGLX/trunk/appledristr.h =================================================================== --- AppleSGLX/trunk/appledristr.h 2009-02-16 23:42:57 UTC (rev 153) +++ AppleSGLX/trunk/appledristr.h 2009-02-16 23:46:31 UTC (rev 154) @@ -215,10 +215,10 @@ CARD32 length B32; /*8*/ CARD32 width B32; /*12*/ CARD32 height B32; /*16*/ - CARD32 size B32; /*20*/ - CARD32 stringLength B32; /*24*/ - CARD32 pad2; /*28*/ - CARD32 pad3; /*32*/ + CARD32 pitch B32; /*20*/ + CARD32 bpp B32; /*24*/ + CARD32 size B32; /*28*/ + CARD32 stringLength B32; /*32*/ } xAppleDRICreatePixmapReply; #define sz_xAppleDRICreatePixmapReply 32
participants (1)
-
source_changes@macosforge.org