Mercurial > sdl-ios-xcode
changeset 4577:87a2d87786d4
Modified configure.in to allow building with Xrender. Fixed all problems that prevented compilation.
Builds fine now :)
author | Sunny Sachanandani <sunnysachanandani@gmail.com> |
---|---|
date | Mon, 31 May 2010 13:27:27 +0530 |
parents | 2b98162b536a |
children | cb338fa6535c |
files | configure.in include/SDL_config.h.in src/video/x11/SDL_x11render.c |
diffstat | 3 files changed, 56 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in Sun May 30 20:06:30 2010 +0530 +++ b/configure.in Mon May 31 13:27:27 2010 +0530 @@ -1128,16 +1128,13 @@ ]) if test x$have_xrandr_h_hdr = xyes; then if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then - echo "-- dynamic libXrender -> $xrender_lib" echo "-- dynamic libXrandr -> $xrandr_lib" - AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib") AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib") definitely_enable_video_x11_xrandr=yes else - AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes) AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes) - if test x$have_xrender_lib = xyes && test x$have_xrandr_lib = xyes ; then - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr -lXrender" + if test x$have_xrandr_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr" definitely_enable_video_x11_xrandr=yes fi fi @@ -1199,6 +1196,32 @@ if test x$definitely_enable_video_x11_scrnsaver = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER) fi + AC_ARG_ENABLE(video-x11-xrender, +AC_HELP_STRING([--enable-video-x11-xrender], [enable X11 Xrender extension [[default=yes]]]), + , enable_video_x11_xrender=yes) + if test x$enable_video_x11_xrender = xyes; then + AC_CHECK_HEADER(X11/extensions/Xrender.h, + have_xrender_h_hdr=yes, + have_xrender_h_hdr=no, + [#include <X11/Xlib.h> + ]) + if test x$have_xrender_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xrender_lib != x ; then + echo "-- dynamic libXrender -> $xrender_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib") + definitely_enable_video_x11_xrender=yes + else + AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes) + if test x$have_xrender_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrender" + definitely_enable_video_x11_xrender=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_xrender = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRENDER) + fi AC_ARG_ENABLE(render-x11, AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]),
--- a/include/SDL_config.h.in Sun May 30 20:06:30 2010 +0530 +++ b/include/SDL_config.h.in Mon May 31 13:27:27 2010 +0530 @@ -280,6 +280,8 @@ #undef SDL_VIDEO_DRIVER_X11_XV #undef SDL_VIDEO_DRIVER_X11_XRENDER +#undef SDL_VIDEO_RENDER_X11 + #undef SDL_VIDEO_RENDER_D3D #undef SDL_VIDEO_RENDER_GDI #undef SDL_VIDEO_RENDER_OGL
--- a/src/video/x11/SDL_x11render.c Sun May 30 20:06:30 2010 +0530 +++ b/src/video/x11/SDL_x11render.c Mon May 31 13:27:27 2010 +0530 @@ -219,7 +219,7 @@ if(XRenderQueryExtension(data->display, &event_basep, &error_basep) == True) { data->xrender_available = SDL_TRUE; data->xwindow_pict_fmt = XRenderFindVisualFormat(data->display, data->visual); - if(!xwindow_pict_fmt) { + if(!data->xwindow_pict_fmt) { data->xrender_available = SDL_FALSE; } data->xwindow_pict_attr.graphics_exposures = False; @@ -285,8 +285,8 @@ #ifdef SDL_VIDEO_DRIVER_X11_XRENDER if(data->xrender_available == SDL_TRUE) { data->pixmap_picts[i] = - XCreatePicture(data->display, data->pixmap[i], data->xwindow_pict_fmt, - data->xwindow_pict_attr_valuemask, &xwindow_pict_attr); + XRenderCreatePicture(data->display, data->pixmaps[i], data->xwindow_pict_fmt, + data->xwindow_pict_attr_valuemask, &data->xwindow_pict_attr); if(!data->pixmap_picts[i]) { data->xrender_available = SDL_FALSE; } @@ -354,7 +354,7 @@ XFreePixmap(data->display, data->pixmaps[i]); data->pixmaps[i] = None; #ifdef SDL_VIDEO_DRIVER_X11_XRENDER - data->pictures[i] = None; + data->pixmap_picts[i] = None; #endif } } @@ -368,10 +368,10 @@ } #ifdef SDL_VIDEO_DRIVER_X11_XRENDER if(data->xrender_available == SDL_TRUE) { - data->pictures[i] = - XCreatePicture(data->display, data->pixmap[i], data->xwindow_pict_fmt, + data->pixmap_picts[i] = + XRenderCreatePicture(data->display, data->pixmaps[i], data->xwindow_pict_fmt, data->xwindow_pict_attr_valuemask, &data->xwindow_pict_attr); - if(!data->pictures[i]) { + if(!data->pixmap_picts[i]) { data->xrender_available = SDL_FALSE; } } @@ -380,7 +380,7 @@ if (n > 0) { data->drawable = data->pixmaps[0]; #ifdef SDL_VIDEO_DRIVER_X11_XRENDER - data->drawable_pict = data->pictures[0]; + data->drawable_pict = data->pixmap_picts[0]; #endif } data->current_pixmap = 0; @@ -419,7 +419,7 @@ #ifdef SDL_VIDEO_DRIVER_X11_XRENDER // Assume the texture is supported by Xrender data->xrender_available = SDL_TRUE; - if(renderdata->xrender_available == SDL_False) { + if(renderdata->xrender_available == SDL_FALSE) { if (texture->format != display->current_mode.format) { SDL_SetError("Texture format doesn't match window format"); return -1; @@ -523,21 +523,24 @@ x11_fmt_mask = (PictFormatDepth | PictFormatRedMask | PictFormatGreenMask | PictFormatBlueMask); - x11_templ_fmt.depth = (data->format).BitsPerPixel; - x11_temp_fmt.direct.redMask = (data->format).Rmask; - x11_temp_fmt.direct.greenMask = (data->format).Gmask; - x11_temp_fmt.direct.blueMask = (data->format).Bmask; - x11_temp_fmt.direct.alphaMask = (data->format).Amask; + Uint32 Rmask, Gmask, Bmask, Amask; + int bpp; + SDL_PixelFormatEnumToMasks(data->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); + x11_templ_fmt.depth = bpp; + x11_templ_fmt.direct.redMask = Rmask; + x11_templ_fmt.direct.greenMask = Gmask; + x11_templ_fmt.direct.blueMask = Bmask; + x11_templ_fmt.direct.alphaMask = Amask; /* Return one matching XRenderPictFormat */ - data->pict_fmt = + data->picture_fmt = XRenderFindFormat(renderdata->display, x11_fmt_mask, &x11_templ_fmt, 1); - if(!data->pict_fmt) { + if(!data->picture_fmt) { data->xrender_available = SDL_FALSE; } data->picture_attr_valuemask = CPGraphicsExposure; (data->picture_attr).graphics_exposures = False; data->picture = - XCreatePicture(renderdata->display, data->pixmap, data->picture_fmt, + XRenderCreatePicture(renderdata->display, data->pixmap, data->picture_fmt, data->picture_attr_valuemask, &(data->picture_attr)); if(!data->picture) { data->xrender_available = SDL_FALSE; @@ -997,8 +1000,13 @@ #ifdef SDL_VIDEO_DRIVER_X11_XRENDER if(data->xrender_available == SDL_TRUE) { + XRenderColor xrender_foreground_color; + xrender_foreground_color.red = renderer->r; + xrender_foreground_color.green = renderer->g; + xrender_foreground_color.blue = renderer->b; + xrender_foreground_color.alpha = renderer->a; XRenderFillRectangles(data->display, PictOpSrc, data->drawable_pict, - (XRenderColor)foreground, xrects, xcount); + &xrender_foreground_color, xrects, xcount); } else #endif