mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
Add support for RENDER BGRA formats.
This commit is contained in:
@@ -200,6 +200,12 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
|
||||
formats[nformats].format = PICT_x8r8g8b8;
|
||||
formats[nformats].depth = 32;
|
||||
nformats++;
|
||||
formats[nformats].format = PICT_b8g8r8a8;
|
||||
formats[nformats].depth = 32;
|
||||
nformats++;
|
||||
formats[nformats].format = PICT_b8g8r8x8;
|
||||
formats[nformats].depth = 32;
|
||||
nformats++;
|
||||
|
||||
/* now look through the depths and visuals adding other formats */
|
||||
for (v = 0; v < pScreen->numVisuals; v++)
|
||||
@@ -233,6 +239,12 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
|
||||
{
|
||||
type = PICT_TYPE_ABGR;
|
||||
}
|
||||
else if (pVisual->offsetRed == pVisual->offsetGreen - r &&
|
||||
pVisual->offsetGreen == pVisual->offsetBlue - g &&
|
||||
pVisual->offsetBlue == bpp - b)
|
||||
{
|
||||
type = PICT_TYPE_BGRA;
|
||||
}
|
||||
if (type != PICT_TYPE_OTHER)
|
||||
{
|
||||
format = PICT_FORMAT(bpp, type, 0, r, g, b);
|
||||
@@ -310,6 +322,8 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
|
||||
PICT_x8r8g8b8, pDepth->depth);
|
||||
nformats = addFormat (formats, nformats,
|
||||
PICT_x8b8g8r8, pDepth->depth);
|
||||
nformats = addFormat (formats, nformats,
|
||||
PICT_b8g8r8x8, pDepth->depth);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -366,6 +380,24 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
|
||||
pFormats[f].direct.red = 0;
|
||||
break;
|
||||
|
||||
case PICT_TYPE_BGRA:
|
||||
pFormats[f].type = PictTypeDirect;
|
||||
|
||||
pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format));
|
||||
pFormats[f].direct.blue = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format));
|
||||
|
||||
pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format));
|
||||
pFormats[f].direct.green = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
|
||||
PICT_FORMAT_G(format));
|
||||
|
||||
pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format));
|
||||
pFormats[f].direct.red = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
|
||||
PICT_FORMAT_G(format) - PICT_FORMAT_R(format));
|
||||
|
||||
pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
|
||||
pFormats[f].direct.alpha = 0;
|
||||
break;
|
||||
|
||||
case PICT_TYPE_A:
|
||||
pFormats[f].type = PictTypeDirect;
|
||||
|
||||
@@ -622,8 +654,10 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||
type = PICT_TYPE_A;
|
||||
else if (formats[n].direct.red > formats[n].direct.blue)
|
||||
type = PICT_TYPE_ARGB;
|
||||
else
|
||||
else if (formats[n].direct.red == 0)
|
||||
type = PICT_TYPE_ABGR;
|
||||
else
|
||||
type = PICT_TYPE_BGRA;
|
||||
a = Ones (formats[n].direct.alphaMask);
|
||||
r = Ones (formats[n].direct.redMask);
|
||||
g = Ones (formats[n].direct.greenMask);
|
||||
|
||||
@@ -62,6 +62,7 @@ typedef struct _Picture *PicturePtr;
|
||||
#define PICT_TYPE_ABGR PIXMAN_TYPE_ABGR
|
||||
#define PICT_TYPE_COLOR PIXMAN_TYPE_COLOR
|
||||
#define PICT_TYPE_GRAY PIXMAN_TYPE_GRAY
|
||||
#define PICT_TYPE_BGRA PIXMAN_TYPE_BGRA
|
||||
|
||||
#define PICT_FORMAT_COLOR(f) PIXMAN_FORMAT_COLOR(f)
|
||||
|
||||
@@ -71,6 +72,8 @@ typedef enum _PictFormatShort {
|
||||
PICT_x8r8g8b8 = PIXMAN_x8r8g8b8,
|
||||
PICT_a8b8g8r8 = PIXMAN_a8b8g8r8,
|
||||
PICT_x8b8g8r8 = PIXMAN_x8b8g8r8,
|
||||
PICT_b8g8r8a8 = PIXMAN_b8g8r8a8,
|
||||
PICT_b8g8r8x8 = PIXMAN_b8g8r8x8,
|
||||
|
||||
/* 24bpp formats */
|
||||
PICT_r8g8b8 = PIXMAN_r8g8b8,
|
||||
|
||||
Reference in New Issue
Block a user