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

Commit

Permalink
Added a #define option for compile time Xrender support.
Browse files Browse the repository at this point in the history
Added some more attributes (specific to Xrender) to the X11 structs.
Added some code for querying the Xrender extension.
  • Loading branch information
sunnyps committed May 24, 2010
1 parent 0a4a775 commit bcb2a5a
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/video/x11/SDL_x11render.c
Expand Up @@ -95,6 +95,13 @@ typedef struct
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;
Expand All @@ -108,6 +115,9 @@ typedef struct
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 */
Expand Down Expand Up @@ -198,7 +208,22 @@ X11_CreateRenderer(SDL_Window * window, Uint32 flags)
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;
Expand Down

0 comments on commit bcb2a5a

Please sign in to comment.