summaryrefslogtreecommitdiff
path: root/render/picture.c
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-08-04 23:23:21 +0200
committerMichel Dänzer <daenzer@vmware.com>2009-08-04 23:23:21 +0200
commit842373104d08d47efc863cecbe30431d3faebef1 (patch)
tree63906ea9d1da6bd0f8f9907509e23abbd03780b7 /render/picture.c
parent0bf7eaf3052ce24066b0a7c14860b4762fb81364 (diff)
Add support for RENDER BGRA formats.
Diffstat (limited to 'render/picture.c')
-rw-r--r--render/picture.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/render/picture.c b/render/picture.c
index 5f86c7ce1..01f4f7a9d 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -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);