summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Kreitman <stuart.kreitman@sun.com>2004-03-30 17:31:26 +0000
committerStuart Kreitman <stuart.kreitman@sun.com>2004-03-30 17:31:26 +0000
commit0b4b3cae27790477983a9b56dce6419383103175 (patch)
tree7eb73c26e753c8cf24427dac65d23f9aaf2febfe
parentee8cb1f24de00362ce366795edabcf3c19302ecd (diff)
integration of _some_ of render from modular tree in support of damage ext.
Modified Files: Tag: DAMAGE-XFIXES picture.c
-rw-r--r--render/picture.c87
1 files changed, 76 insertions, 11 deletions
diff --git a/render/picture.c b/render/picture.c
index ad746b277..18e9c7c84 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/programs/Xserver/render/picture.c,v 1.29 2002/11/23 02:38:15 keithp Exp $
+ * $Id$
*
* Copyright © 2000 SuSE, Inc.
*
@@ -23,6 +23,9 @@
* Author: Keith Packard, SuSE, Inc.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include "misc.h"
#include "scrnintstr.h"
#include "os.h"
@@ -367,7 +370,7 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
case PICT_TYPE_COLOR:
case PICT_TYPE_GRAY:
pFormats[f].type = PictTypeIndexed;
- pFormats[f].index.pVisual = &pScreen->visuals[PICT_FORMAT_VIS(format)];
+ pFormats[f].index.vid = pScreen->visuals[PICT_FORMAT_VIS(format)].vid;
break;
}
}
@@ -375,6 +378,21 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
return pFormats;
}
+static VisualPtr
+PictureFindVisual (ScreenPtr pScreen, VisualID visual)
+{
+ int i;
+ VisualPtr pVisual;
+ for (i = 0, pVisual = pScreen->visuals;
+ i < pScreen->numVisuals;
+ i++, pVisual++)
+ {
+ if (pVisual->vid == visual)
+ return pVisual;
+ }
+ return 0;
+}
+
Bool
PictureInitIndexedFormats (ScreenPtr pScreen)
{
@@ -390,13 +408,16 @@ PictureInitIndexedFormats (ScreenPtr pScreen)
{
if (format->type == PictTypeIndexed && !format->index.pColormap)
{
- if (format->index.pVisual->vid == pScreen->rootVisual)
+ if (format->index.vid == pScreen->rootVisual)
format->index.pColormap = (ColormapPtr) LookupIDByType(pScreen->defColormap,
RT_COLORMAP);
else
{
+ VisualPtr pVisual;
+
+ pVisual = PictureFindVisual (pScreen, format->index.vid);
if (CreateColormap (FakeClientID (0), pScreen,
- format->index.pVisual,
+ pVisual,
&format->index.pColormap, AllocNone,
0) != Success)
{
@@ -480,16 +501,16 @@ PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual)
{
if (type == PictTypeIndexed)
{
- if (format->index.pVisual == pVisual)
+ if (format->index.vid == pVisual->vid)
return format;
}
else
{
- if (format->direct.redMask << format->direct.red ==
+ if ((unsigned long) format->direct.redMask << format->direct.red ==
pVisual->redMask &&
- format->direct.greenMask << format->direct.green ==
+ (unsigned long) format->direct.greenMask << format->direct.green ==
pVisual->greenMask &&
- format->direct.blueMask << format->direct.blue ==
+ (unsigned long) format->direct.blueMask << format->direct.blue ==
pVisual->blueMask)
{
return format;
@@ -561,7 +582,7 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
return FALSE;
PictureWindowPrivateIndex = AllocateWindowPrivateIndex();
PictureGeneration = serverGeneration;
-#ifdef XResExtension
+#ifdef RES
RegisterResourceName (PictureType, "PICTURE");
RegisterResourceName (PictFormatType, "PICTFORMAT");
RegisterResourceName (GlyphSetType, "GLYPHSET");
@@ -585,7 +606,8 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
}
if (formats[n].type == PictTypeIndexed)
{
- if ((formats[n].index.pVisual->class | DynamicClass) == PseudoColor)
+ VisualPtr pVisual = PictureFindVisual (pScreen, formats[n].index.vid);
+ if ((pVisual->class | DynamicClass) == PseudoColor)
type = PICT_TYPE_COLOR;
else
type = PICT_TYPE_GRAY;
@@ -1009,7 +1031,6 @@ SetPictureClipRects (PicturePtr pPicture,
PictureScreenPtr ps = GetPictureScreen(pScreen);
RegionPtr clientClip;
int result;
-
clientClip = RECTS_TO_REGION(pScreen,
nRect, rects, CT_UNSORTED);
if (!clientClip)
@@ -1027,6 +1048,50 @@ SetPictureClipRects (PicturePtr pPicture,
}
int
+SetPictureClipRegion (PicturePtr pPicture,
+ int xOrigin,
+ int yOrigin,
+ RegionPtr pRegion)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ RegionPtr clientClip;
+ int result;
+ int type;
+
+ if (pRegion)
+ {
+ type = CT_REGION;
+ clientClip = REGION_CREATE (pScreen,
+ REGION_EXTENTS(pScreen, pRegion),
+ REGION_NUM_RECTS(pRegion));
+ if (!clientClip)
+ return BadAlloc;
+ if (!REGION_COPY (pSCreen, clientClip, pRegion))
+ {
+ REGION_DESTROY (pScreen, clientClip);
+ return BadAlloc;
+ }
+ }
+ else
+ {
+ type = CT_NONE;
+ clientClip = 0;
+ }
+
+ result =(*ps->ChangePictureClip) (pPicture, type,
+ (pointer) clientClip, 0);
+ if (result == Success)
+ {
+ pPicture->clipOrigin.x = xOrigin;
+ pPicture->clipOrigin.y = yOrigin;
+ pPicture->stateChanges |= CPClipXOrigin|CPClipYOrigin|CPClipMask;
+ pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
+ }
+ return result;
+}
+
+int
SetPictureTransform (PicturePtr pPicture,
PictTransform *transform)
{