Commit 030ef1ef authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winex11.drv: Move the PictFormats into an array.

parent ee40cb4b
...@@ -46,8 +46,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(xrender); ...@@ -46,8 +46,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(xrender);
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/extensions/Xrender.h> #include <X11/extensions/Xrender.h>
static XRenderPictFormat *screen_format; /* format of screen */
static XRenderPictFormat *mono_format; /* format of mono bitmap */ enum drawable_depth_type {mono_drawable, color_drawable};
static XRenderPictFormat *pict_formats[2];
typedef struct typedef struct
{ {
...@@ -203,8 +204,8 @@ LOAD_OPTIONAL_FUNCPTR(XRenderSetPictureTransform) ...@@ -203,8 +204,8 @@ LOAD_OPTIONAL_FUNCPTR(XRenderSetPictureTransform)
if(pXRenderQueryExtension(gdi_display, &event_base, &xrender_error_base)) { if(pXRenderQueryExtension(gdi_display, &event_base, &xrender_error_base)) {
X11DRV_XRender_Installed = TRUE; X11DRV_XRender_Installed = TRUE;
TRACE("Xrender is up and running error_base = %d\n", xrender_error_base); TRACE("Xrender is up and running error_base = %d\n", xrender_error_base);
screen_format = pXRenderFindVisualFormat(gdi_display, visual); pict_formats[color_drawable] = pXRenderFindVisualFormat(gdi_display, visual);
if(!screen_format) if(!pict_formats[color_drawable])
{ {
/* Xrender doesn't like DirectColor visuals, try to find a TrueColor one instead */ /* Xrender doesn't like DirectColor visuals, try to find a TrueColor one instead */
if (visual->class == DirectColor) if (visual->class == DirectColor)
...@@ -213,12 +214,12 @@ LOAD_OPTIONAL_FUNCPTR(XRenderSetPictureTransform) ...@@ -213,12 +214,12 @@ LOAD_OPTIONAL_FUNCPTR(XRenderSetPictureTransform)
if (XMatchVisualInfo( gdi_display, DefaultScreen(gdi_display), if (XMatchVisualInfo( gdi_display, DefaultScreen(gdi_display),
screen_depth, TrueColor, &info )) screen_depth, TrueColor, &info ))
{ {
screen_format = pXRenderFindVisualFormat(gdi_display, info.visual); pict_formats[color_drawable] = pXRenderFindVisualFormat(gdi_display, info.visual);
if (screen_format) visual = info.visual; if (pict_formats[color_drawable]) visual = info.visual;
} }
} }
} }
if(!screen_format) /* This fails in buggy versions of libXrender.so */ if(!pict_formats[color_drawable]) /* This fails in buggy versions of libXrender.so */
{ {
wine_tsx11_unlock(); wine_tsx11_unlock();
WINE_MESSAGE( WINE_MESSAGE(
...@@ -232,10 +233,10 @@ LOAD_OPTIONAL_FUNCPTR(XRenderSetPictureTransform) ...@@ -232,10 +233,10 @@ LOAD_OPTIONAL_FUNCPTR(XRenderSetPictureTransform)
pf.depth = 1; pf.depth = 1;
pf.direct.alpha = 0; pf.direct.alpha = 0;
pf.direct.alphaMask = 1; pf.direct.alphaMask = 1;
mono_format = pXRenderFindFormat(gdi_display, PictFormatType | pict_formats[mono_drawable] = pXRenderFindFormat(gdi_display, PictFormatType |
PictFormatDepth | PictFormatAlpha | PictFormatDepth | PictFormatAlpha |
PictFormatAlphaMask, &pf, 0); PictFormatAlphaMask, &pf, 0);
if(!mono_format) { if(!pict_formats[mono_drawable]) {
ERR("mono_format == NULL?\n"); ERR("mono_format == NULL?\n");
X11DRV_XRender_Installed = FALSE; X11DRV_XRender_Installed = FALSE;
} }
...@@ -1098,6 +1099,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag ...@@ -1098,6 +1099,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
unsigned int idx; unsigned int idx;
double cosEsc, sinEsc; double cosEsc, sinEsc;
LOGFONTW lf; LOGFONTW lf;
enum drawable_depth_type depth_type = (physDev->depth == 1) ? mono_drawable : color_drawable;
/* Do we need to disable antialiasing because of palette mode? */ /* Do we need to disable antialiasing because of palette mode? */
if( !physDev->bitmap || GetObjectW( physDev->bitmap->hbitmap, sizeof(bmp), &bmp ) != sizeof(bmp) ) { if( !physDev->bitmap || GetObjectW( physDev->bitmap->hbitmap, sizeof(bmp), &bmp ) != sizeof(bmp) ) {
...@@ -1176,8 +1178,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag ...@@ -1176,8 +1178,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
wine_tsx11_lock(); wine_tsx11_lock();
physDev->xrender->pict = pXRenderCreatePicture(gdi_display, physDev->xrender->pict = pXRenderCreatePicture(gdi_display,
physDev->drawable, physDev->drawable,
(physDev->depth == 1) ? pict_formats[depth_type],
mono_format : screen_format,
CPSubwindowMode, &pa); CPSubwindowMode, &pa);
wine_tsx11_unlock(); wine_tsx11_unlock();
...@@ -1204,7 +1205,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag ...@@ -1204,7 +1205,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
if(!physDev->xrender->tile_xpm) { if(!physDev->xrender->tile_xpm) {
XRenderPictureAttributes pa; XRenderPictureAttributes pa;
XRenderPictFormat *format = (physDev->depth == 1) ? mono_format : screen_format; XRenderPictFormat *format = pict_formats[depth_type];
wine_tsx11_lock(); wine_tsx11_lock();
physDev->xrender->tile_xpm = XCreatePixmap(gdi_display, physDev->xrender->tile_xpm = XCreatePixmap(gdi_display,
root_window, root_window,
...@@ -1534,6 +1535,7 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, ...@@ -1534,6 +1535,7 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst,
POINT pts[2]; POINT pts[2];
BOOL top_down = FALSE; BOOL top_down = FALSE;
RGNDATA *rgndata; RGNDATA *rgndata;
enum drawable_depth_type dst_depth_type = (devDst->depth == 1) ? mono_drawable : color_drawable;
if(!X11DRV_XRender_Installed) { if(!X11DRV_XRender_Installed) {
FIXME("Unable to AlphaBlend without Xrender\n"); FIXME("Unable to AlphaBlend without Xrender\n");
...@@ -1616,8 +1618,7 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, ...@@ -1616,8 +1618,7 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst,
/* FIXME use devDst->xrender->pict ? */ /* FIXME use devDst->xrender->pict ? */
dst_pict = pXRenderCreatePicture(gdi_display, dst_pict = pXRenderCreatePicture(gdi_display,
devDst->drawable, devDst->drawable,
(devDst->depth == 1) ? pict_formats[dst_depth_type],
mono_format : screen_format,
CPSubwindowMode, &pa); CPSubwindowMode, &pa);
TRACE("dst_pict %08lx\n", dst_pict); TRACE("dst_pict %08lx\n", dst_pict);
TRACE("src_drawable = %08lx\n", devSrc->drawable); TRACE("src_drawable = %08lx\n", devSrc->drawable);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment