Commit 0b4b3cae authored by Stuart Kreitman's avatar Stuart Kreitman
Browse files

integration of _some_ of render from modular tree in support of damage ext.

    Modified Files: Tag: DAMAGE-XFIXES picture.c
parent ee8cb1f2
/*
* $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)
......@@ -1026,6 +1047,50 @@ SetPictureClipRects (PicturePtr pPicture,
return result;
}
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)
......
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