Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Modified configure.in to allow building with Xrender. Fixed all probl…
Browse files Browse the repository at this point in the history
…ems that prevented compilation.

Builds fine now :)
  • Loading branch information
sunnyps committed May 31, 2010
1 parent 54edf7b commit 941436d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 23 deletions.
33 changes: 28 additions & 5 deletions configure.in
Expand Up @@ -1128,16 +1128,13 @@ AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for ful
])
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
Expand Down Expand Up @@ -1199,6 +1196,32 @@ AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension
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]]]),
Expand Down
2 changes: 2 additions & 0 deletions include/SDL_config.h.in
Expand Up @@ -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
Expand Down
44 changes: 26 additions & 18 deletions src/video/x11/SDL_x11render.c
Expand Up @@ -219,7 +219,7 @@ X11_CreateRenderer(SDL_Window * window, Uint32 flags)
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;
Expand Down Expand Up @@ -285,8 +285,8 @@ X11_CreateRenderer(SDL_Window * window, Uint32 flags)
#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;
}
Expand Down Expand Up @@ -354,7 +354,7 @@ X11_DisplayModeChanged(SDL_Renderer * renderer)
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
}
}
Expand All @@ -368,10 +368,10 @@ X11_DisplayModeChanged(SDL_Renderer * renderer)
}
#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;
}
}
Expand All @@ -380,7 +380,7 @@ X11_DisplayModeChanged(SDL_Renderer * renderer)
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;
Expand Down Expand Up @@ -419,7 +419,7 @@ X11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
#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;
Expand Down Expand Up @@ -523,21 +523,24 @@ X11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
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;
Expand Down Expand Up @@ -997,8 +1000,13 @@ X11_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
#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
Expand Down

0 comments on commit 941436d

Please sign in to comment.