summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJoel Bosveld <joel.bosveld@gmail.com>2009-09-08 23:06:00 +0800
committerJoel Bosveld <joel.bosveld@gmail.com>2009-09-08 23:55:13 +0800
commit1ba17340a98a34b40f78442963aa4132e6cfae5c (patch)
treed11d814844e4ad037d146133250b73f28cdb3e31 /render
parent5e38708c3466129c3e5af40a915c044bb26e083f (diff)
parent1bdc9ec617d357b076c9e69296018bc212d91c7d (diff)
Merge branch 'upstream' (one day I will rebase rather than merge)HEADmaster
Conflicts: test/Makefile.am
Diffstat (limited to 'render')
-rw-r--r--render/animcur.c11
-rw-r--r--render/picture.c47
-rw-r--r--render/picture.h8
-rw-r--r--render/picturestr.h4
-rw-r--r--render/render.c18
5 files changed, 66 insertions, 22 deletions
diff --git a/render/animcur.c b/render/animcur.c
index e7bc4e55a..276e5e4af 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -104,17 +104,6 @@ static DevPrivateKey AnimCurScreenPrivateKey = &AnimCurScreenPrivateKeyIndex;
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
#define Unwrap(as,s,elt) ((s)->elt = (as)->elt)
-static Bool
-AnimCurDisplayCursor (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- CursorPtr pCursor);
-
-static Bool
-AnimCurSetCursorPosition (DeviceIntPtr pDev,
- ScreenPtr pScreen,
- int x,
- int y,
- Bool generateEvent);
static Bool
AnimCurCloseScreen (int index, ScreenPtr pScreen)
diff --git a/render/picture.c b/render/picture.c
index 5f86c7ce1..a3670778e 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,19 @@ 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);
+ }
+ if (pDepth->depth >= 30)
+ {
+ nformats = addFormat (formats, nformats,
+ PICT_a2r10g10b10, pDepth->depth);
+ nformats = addFormat (formats, nformats,
+ PICT_x2r10g10b10, pDepth->depth);
+ nformats = addFormat (formats, nformats,
+ PICT_a2b10g10r10, pDepth->depth);
+ nformats = addFormat (formats, nformats,
+ PICT_x2b10g10r10, pDepth->depth);
}
break;
}
@@ -366,6 +391,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 +665,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..8bd38b98e 100644
--- a/render/picture.h
+++ b/render/picture.h
@@ -62,15 +62,23 @@ 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)
/* 32bpp formats */
typedef enum _PictFormatShort {
+ PICT_a2r10g10b10 = PIXMAN_a2r10g10b10,
+ PICT_x2r10g10b10 = PIXMAN_x2r10g10b10,
+ PICT_a2b10g10r10 = PIXMAN_a2b10g10r10,
+ PICT_x2b10g10r10 = PIXMAN_x2b10g10r10,
+
PICT_a8r8g8b8 = PIXMAN_a8r8g8b8,
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,
diff --git a/render/picturestr.h b/render/picturestr.h
index 6a1cc061c..6a8d76d99 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -620,10 +620,10 @@ PictureGradientColor (PictGradientStopPtr stop1,
extern _X_EXPORT void RenderExtensionInit (void);
-extern _X_EXPORT Bool
+Bool
AnimCurInit (ScreenPtr pScreen);
-extern _X_EXPORT int
+int
AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid);
extern _X_EXPORT void
diff --git a/render/render.c b/render/render.c
index 5622994e3..995ebd956 100644
--- a/render/render.c
+++ b/render/render.c
@@ -369,7 +369,7 @@ ProcRenderQueryPictFormats (ClientPtr client)
return BadAlloc;
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
- reply->length = (rlength - sizeof(xGenericReply)) >> 2;
+ reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
reply->numFormats = nformat;
reply->numScreens = numScreens;
reply->numDepths = ndepth;
@@ -537,7 +537,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
- reply->length = (rlength - sizeof(xGenericReply)) >> 2;
+ reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
reply->numIndexValues = num;
values = (xIndexValue *) (reply + 1);
@@ -594,7 +594,7 @@ ProcRenderCreatePicture (ClientPtr client)
if (pFormat->depth != pDrawable->depth)
return BadMatch;
- len = client->req_len - (sizeof(xRenderCreatePictureReq) >> 2);
+ len = client->req_len - bytes_to_int32(sizeof(xRenderCreatePictureReq));
if (Ones(stuff->mask) != len)
return BadLength;
@@ -623,7 +623,7 @@ ProcRenderChangePicture (ClientPtr client)
VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
RenderErrBase + BadPicture);
- len = client->req_len - (sizeof(xRenderChangePictureReq) >> 2);
+ len = client->req_len - bytes_to_int32(sizeof(xRenderChangePictureReq));
if (Ones(stuff->mask) != len)
return BadLength;
@@ -681,6 +681,8 @@ PictOpValid (CARD8 op)
return TRUE;
if (PictOpConjointMinimum <= op && op <= PictOpConjointMaximum)
return TRUE;
+ if (PictOpBlendMinimum <= op && op <= PictOpBlendMaximum)
+ return TRUE;
return FALSE;
}
@@ -1235,7 +1237,7 @@ ProcRenderFreeGlyphs (ClientPtr client)
client->errorValue = stuff->glyphset;
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc;
}
- nglyph = ((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)) >> 2;
+ nglyph = bytes_to_int32((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq));
gids = (CARD32 *) (stuff + 1);
while (nglyph-- > 0)
{
@@ -1735,7 +1737,7 @@ ProcRenderQueryFilters (ClientPtr client)
nbytesName += 1 + strlen (ps->filterAliases[i].alias);
nnames = ps->nfilters + ps->nfilterAliases;
}
- len = ((nnames + 1) >> 1) + ((nbytesName + 3) >> 2);
+ len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName);
total_bytes = sizeof (xRenderQueryFiltersReply) + (len << 2);
reply = (xRenderQueryFiltersReply *) xalloc (total_bytes);
if (!reply)
@@ -1827,7 +1829,7 @@ ProcRenderSetPictureFilter (ClientPtr client)
VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
RenderErrBase + BadPicture);
name = (char *) (stuff + 1);
- params = (xFixed *) (name + ((stuff->nbytes + 3) & ~3));
+ params = (xFixed *) (name + pad_to_int32(stuff->nbytes));
nparams = ((xFixed *) stuff + client->req_len) - params;
result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams);
return result;
@@ -1849,7 +1851,7 @@ ProcRenderCreateAnimCursor (ClientPtr client)
LEGAL_NEW_RESOURCE(stuff->cid, client);
if (client->req_len & 1)
return BadLength;
- ncursor = (client->req_len - (SIZEOF(xRenderCreateAnimCursorReq) >> 2)) >> 1;
+ ncursor = (client->req_len - (bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
cursors = xalloc (ncursor * (sizeof (CursorPtr) + sizeof (CARD32)));
if (!cursors)
return BadAlloc;