diff options
author | Michel Dänzer <daenzer@vmware.com> | 2009-08-04 23:23:21 +0200 |
---|---|---|
committer | Michel Dänzer <daenzer@vmware.com> | 2009-08-04 23:23:21 +0200 |
commit | 842373104d08d47efc863cecbe30431d3faebef1 (patch) | |
tree | 63906ea9d1da6bd0f8f9907509e23abbd03780b7 /render | |
parent | 0bf7eaf3052ce24066b0a7c14860b4762fb81364 (diff) |
Add support for RENDER BGRA formats.
Diffstat (limited to 'render')
-rw-r--r-- | render/picture.c | 36 | ||||
-rw-r--r-- | render/picture.h | 3 |
2 files changed, 38 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); diff --git a/render/picture.h b/render/picture.h index 1f90f43ab..dfc2d9b05 100644 --- a/render/picture.h +++ b/render/picture.h @@ -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, |