winex11: Move glyph code over to get_xrender_format.

This commit is contained in:
Roderick Colenbrander 2009-07-05 21:03:48 +02:00 committed by Alexandre Julliard
parent bf86daa0b6
commit e13865285e
1 changed files with 25 additions and 44 deletions

View File

@ -54,10 +54,11 @@ static BOOL X11DRV_XRender_Installed = FALSE;
#define RepeatReflect 3 #define RepeatReflect 3
#endif #endif
#define MAX_FORMATS 9 #define MAX_FORMATS 10
typedef enum wine_xrformat typedef enum wine_xrformat
{ {
WXR_FORMAT_MONO, WXR_FORMAT_MONO,
WXR_FORMAT_GRAY,
WXR_FORMAT_X1R5G5B5, WXR_FORMAT_X1R5G5B5,
WXR_FORMAT_X1B5G5R5, WXR_FORMAT_X1B5G5R5,
WXR_FORMAT_R5G6B5, WXR_FORMAT_R5G6B5,
@ -86,6 +87,7 @@ static const WineXRenderFormatTemplate wxr_formats_template[] =
{ {
/* Format depth alpha mask red mask green mask blue mask*/ /* Format depth alpha mask red mask green mask blue mask*/
{WXR_FORMAT_MONO, 1, 0, 0x01, 0, 0, 0, 0, 0, 0 }, {WXR_FORMAT_MONO, 1, 0, 0x01, 0, 0, 0, 0, 0, 0 },
{WXR_FORMAT_GRAY, 8, 0, 0xff, 0, 0, 0, 0, 0, 0 },
{WXR_FORMAT_X1R5G5B5, 16, 0, 0, 10, 0x1f, 5, 0x1f, 0, 0x1f }, {WXR_FORMAT_X1R5G5B5, 16, 0, 0, 10, 0x1f, 5, 0x1f, 0, 0x1f },
{WXR_FORMAT_X1B5G5R5, 16, 0, 0, 0, 0x1f, 5, 0x1f, 10, 0x1f }, {WXR_FORMAT_X1B5G5R5, 16, 0, 0, 0, 0x1f, 5, 0x1f, 10, 0x1f },
{WXR_FORMAT_R5G6B5, 16, 0, 0, 11, 0x1f, 5, 0x3f, 0, 0x1f }, {WXR_FORMAT_R5G6B5, 16, 0, 0, 11, 0x1f, 5, 0x3f, 0, 0x1f },
@ -121,7 +123,7 @@ typedef enum { AA_None = 0, AA_Grey, AA_RGB, AA_BGR, AA_VRGB, AA_VBGR, AA_MAXVAL
typedef struct typedef struct
{ {
GlyphSet glyphset; GlyphSet glyphset;
XRenderPictFormat *font_format; WineXRenderFormat *font_format;
int nrealized; int nrealized;
BOOL *realized; BOOL *realized;
void **bitmaps; void **bitmaps;
@ -828,8 +830,7 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format)
gsCacheEntry *entry = glyphsetCache + physDev->xrender->cache_index; gsCacheEntry *entry = glyphsetCache + physDev->xrender->cache_index;
gsCacheEntryFormat *formatEntry; gsCacheEntryFormat *formatEntry;
UINT ggo_format = GGO_GLYPH_INDEX; UINT ggo_format = GGO_GLYPH_INDEX;
XRenderPictFormat pf; WXRFormat wxr_format;
unsigned long pf_mask;
static const char zero[4]; static const char zero[4];
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
@ -918,48 +919,28 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format)
if(formatEntry->glyphset == 0 && X11DRV_XRender_Installed) { if(formatEntry->glyphset == 0 && X11DRV_XRender_Installed) {
switch(format) { switch(format) {
case AA_Grey: case AA_Grey:
pf_mask = PictFormatType | PictFormatDepth | PictFormatAlpha | PictFormatAlphaMask, wxr_format = WXR_FORMAT_GRAY;
pf.type = PictTypeDirect; break;
pf.depth = 8;
pf.direct.alpha = 0;
pf.direct.alphaMask = 0xff;
break;
case AA_RGB: case AA_RGB:
case AA_BGR: case AA_BGR:
case AA_VRGB: case AA_VRGB:
case AA_VBGR: case AA_VBGR:
pf_mask = PictFormatType | PictFormatDepth | PictFormatRed | PictFormatRedMask | wxr_format = WXR_FORMAT_A8R8G8B8;
PictFormatGreen | PictFormatGreenMask | PictFormatBlue | break;
PictFormatBlueMask | PictFormatAlpha | PictFormatAlphaMask;
pf.type = PictTypeDirect;
pf.depth = 32;
pf.direct.red = 16;
pf.direct.redMask = 0xff;
pf.direct.green = 8;
pf.direct.greenMask = 0xff;
pf.direct.blue = 0;
pf.direct.blueMask = 0xff;
pf.direct.alpha = 24;
pf.direct.alphaMask = 0xff;
break;
default: default:
ERR("aa = %d - not implemented\n", format); ERR("aa = %d - not implemented\n", format);
case AA_None: case AA_None:
pf_mask = PictFormatType | PictFormatDepth | PictFormatAlpha | PictFormatAlphaMask, wxr_format = WXR_FORMAT_MONO;
pf.type = PictTypeDirect; break;
pf.depth = 1; }
pf.direct.alpha = 0;
pf.direct.alphaMask = 1;
break;
}
wine_tsx11_lock(); wine_tsx11_lock();
formatEntry->font_format = pXRenderFindFormat(gdi_display, pf_mask, &pf, 0); formatEntry->font_format = get_xrender_format(wxr_format);
formatEntry->glyphset = pXRenderCreateGlyphSet(gdi_display, formatEntry->font_format); formatEntry->glyphset = pXRenderCreateGlyphSet(gdi_display, formatEntry->font_format->pict_format);
wine_tsx11_unlock(); wine_tsx11_unlock();
} }
@ -1571,7 +1552,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
pXRenderCompositeText16(gdi_display, render_op, pXRenderCompositeText16(gdi_display, render_op,
tile_pict, tile_pict,
physDev->xrender->pict, physDev->xrender->pict,
formatEntry->font_format, formatEntry->font_format->pict_format,
0, 0, 0, 0, elts, count); 0, 0, 0, 0, elts, count);
wine_tsx11_unlock(); wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, elts); HeapFree(GetProcessHeap(), 0, elts);