Commit b37c5153 authored by Keith Packard's avatar Keith Packard

Add support for x4a4 format (depth 4 at 8bpp). Bug #6325.

parent c947d796
2006-04-19 Keith Packard <keithp@keithp.com>
* fb/fbcompose.c: (fbFetch_x4a4), (fetchProcForPicture),
(fbStore_x4a4), (storeProcForPicture):
* render/picture.c: (PictureCreateDefaultFormats):
* render/picture.h:
Add support for x4a4 format (depth 4 at 8bpp). Bug #6325.
2006-04-18 Eric Anholt <anholt@FreeBSD.org>
* exa/exa.c: (exaDriverInit):
......
/*
* $XdotOrg: xserver/xorg/fb/fbcompose.c,v 1.26 2005/12/09 18:35:20 ajax Exp $
* $XdotOrg: xserver/xorg/fb/fbcompose.c,v 1.27 2006-02-10 22:00:21 anholt Exp $
* $XFree86: xc/programs/Xserver/fb/fbcompose.c,v 1.17tsi Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
......@@ -385,6 +385,17 @@ fbFetch_c8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr i
}
}
static FASTCALL void
fbFetch_x4a4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed)
{
const CARD8 *pixel = (const CARD8 *)bits + x;
const CARD8 *end = pixel + width;
while (pixel < end) {
CARD8 p = (*pixel++) & 0xf;
*buffer++ = (p | (p << 4)) << 24;
}
}
#define Fetch8(l,o) (((CARD8 *) (l))[(o) >> 2])
#if IMAGE_BYTE_ORDER == MSBFirst
#define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) & 0xf : Fetch8(l,o) >> 4)
......@@ -548,7 +559,8 @@ static fetchProc fetchProcForPicture (PicturePtr pict)
case PICT_a2b2g2r2: return fbFetch_a2b2g2r2;
case PICT_c8: return fbFetch_c8;
case PICT_g8: return fbFetch_c8;
case PICT_x4a4: return fbFetch_x4a4;
/* 4bpp formats */
case PICT_a4: return fbFetch_a4;
case PICT_r1g2b1: return fbFetch_r1g2b1;
......@@ -1261,6 +1273,16 @@ fbStore_c8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr i
}
}
static FASTCALL void
fbStore_x4a4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed)
{
int i;
CARD8 *pixel = ((CARD8 *) bits) + x;
for (i = 0; i < width; ++i) {
*pixel++ = values[i] >> 28;
}
}
#define Store8(l,o,v) (((CARD8 *) l)[(o) >> 3] = (v))
#if IMAGE_BYTE_ORDER == MSBFirst
#define Store4(l,o,v) Store8(l,o,((o) & 4 ? \
......@@ -1412,6 +1434,7 @@ static storeProc storeProcForPicture (PicturePtr pict)
case PICT_a2r2g2b2: return fbStore_a2r2g2b2;
case PICT_c8: return fbStore_c8;
case PICT_g8: return fbStore_c8;
case PICT_x4a4: return fbStore_x4a4;
/* 4bpp formats */
case PICT_a4: return fbStore_a4;
......
......@@ -234,10 +234,14 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
formats[nformats].format = PICT_a1;
formats[nformats].depth = 1;
nformats++;
formats[nformats].format = PICT_a8;
formats[nformats].format = PICT_FORMAT(BitsPerPixel(8),
PICT_TYPE_A,
8, 0, 0, 0);
formats[nformats].depth = 8;
nformats++;
formats[nformats].format = PICT_a4;
formats[nformats].format = PICT_FORMAT(BitsPerPixel(4),
PICT_TYPE_A,
4, 0, 0, 0);
formats[nformats].depth = 4;
nformats++;
formats[nformats].format = PICT_a8r8g8b8;
......
......@@ -100,6 +100,15 @@ typedef struct _Picture *PicturePtr;
#define PICT_c8 PICT_FORMAT(8,PICT_TYPE_COLOR,0,0,0,0)
#define PICT_g8 PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0)
#define PICT_x4a4 PICT_FORMAT(8,PICT_TYPE_A,4,0,0,0)
#define PICT_x4r1g2b1 PICT_FORMAT(8,PICT_TYPE_ARGB,0,1,2,1)
#define PICT_x4b1g2r1 PICT_FORMAT(8,PICT_TYPE_ABGR,0,1,2,1)
#define PICT_x4a1r1g1b1 PICT_FORMAT(8,PICT_TYPE_ARGB,1,1,1,1)
#define PICT_x4a1b1g1r1 PICT_FORMAT(8,PICT_TYPE_ABGR,1,1,1,1)
#define PICT_x4c4 PICT_FORMAT(8,PICT_TYPE_COLOR,0,0,0,0)
#define PICT_x4g4 PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0)
/* 4bpp formats */
#define PICT_a4 PICT_FORMAT(4,PICT_TYPE_A,4,0,0,0)
#define PICT_r1g2b1 PICT_FORMAT(4,PICT_TYPE_ARGB,0,1,2,1)
......
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