changeset 4571:97dcf6f6213c

Added a #define option for compile time Xrender support. Added some more attributes (specific to Xrender) to the X11 structs. Added some code for querying the Xrender extension.
author Sunny Sachanandani <sunnysachanandani@gmail.com>
date Mon, 24 May 2010 21:02:58 +0530
parents 36fad921c97f
children 266ec93f49af
files src/video/x11/SDL_x11render.c
diffstat 1 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/x11/SDL_x11render.c	Wed May 19 18:58:28 2010 +0530
+++ b/src/video/x11/SDL_x11render.c	Mon May 24 21:02:58 2010 +0530
@@ -95,6 +95,13 @@
     int scanline_pad;
     Window xwindow;
     Pixmap pixmaps[3];
+#ifdef SDL_VIDEO_DRIVER_X11_XRENDER
+    Picture xwindow_pict;
+    XRenderPictFormat* xwindow_pict_fmt;
+    XRenderPictureAttributes xwindow_pict_attr;
+    unsigned int xwindow_pict_attr_valuemask;
+    SDL_bool xrender_available;
+#endif
     int current_pixmap;
     Drawable drawable;
     SDL_PixelFormat format;
@@ -108,6 +115,9 @@
     SDL_SW_YUVTexture *yuv;
     Uint32 format;
     Pixmap pixmap;
+#ifdef SDL_VIDEO_DRIVER_X11_XRENDER
+    Picture picture;
+#endif
     XImage *image;
 #ifndef NO_SHARED_MEMORY
     /* MIT shared memory extension information */
@@ -198,7 +208,22 @@
     data->depth = displaydata->depth;
     data->scanline_pad = displaydata->scanline_pad;
     data->xwindow = windowdata->xwindow;
-
+#ifdef SDL_VIDEO_DRIVER_X11_XRENDER
+    int event_basep, error_basep;
+    if(XRenderQueryExtension(data->display, &event_basep, &error_basep) == True) {
+        data->xrender_available = SDL_TRUE;
+        data->xwindow_pict_fmt = XRenderFindVisualFormat(data->display, data->visual);
+        data->xwindow_pict_attr_valuemask = 0; // FIXME
+        data->xwindow_pict = XRenderCreatePicture(data->display,
+                                                  data->xwindow,
+                                                  data->xwindow_pict_fmt,
+                                                  data->xwindow_pict_attr_valuemask,
+                                                  &data->xwindow_pict_attr);
+    }
+    else {
+        data->xrender_available = SDL_FALSE;
+    }
+#endif
     renderer->DisplayModeChanged = X11_DisplayModeChanged;
     renderer->CreateTexture = X11_CreateTexture;
     renderer->QueryTexturePixels = X11_QueryTexturePixels;