[xorg-commit-diffs] xc/programs/Xserver/render picture.c, 1.1.4.1, 1.1.4.1.2.1

Stuart Kreitman xorg-commit at pdx.freedesktop.org
Tue Mar 30 09:31:32 PST 2004


Committed by: stukreit

Update of /cvs/xorg/xc/programs/Xserver/render
In directory pdx:/tmp/cvs-serv21906

Modified Files:
      Tag: DAMAGE-XFIXES
	picture.c 
Log Message:
integration of _some_ of render from modular tree in support of damage ext.
Modified Files:
  Tag: DAMAGE-XFIXES
 	picture.c 


Index: picture.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/render/picture.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- a/picture.c	5 Mar 2004 13:41:11 -0000	1.1.4.1
+++ b/picture.c	30 Mar 2004 17:31:26 -0000	1.1.4.1.2.1
@@ -1,5 +1,5 @@
 /*
- * $XFree86: xc/programs/Xserver/render/picture.c,v 1.29 2002/11/23 02:38:15 keithp Exp $
+ * $Id: picture.c,v 1.35 2003/11/18 07:10:14 keithp Exp $
  *
  * 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 @@
 	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 @@
     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 @@
     {
 	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 @@
 	{
 	    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 @@
 	    return FALSE;
 	PictureWindowPrivateIndex = AllocateWindowPrivateIndex();
 	PictureGeneration = serverGeneration;
-#ifdef XResExtension
+#ifdef RES
 	RegisterResourceName (PictureType, "PICTURE");
 	RegisterResourceName (PictFormatType, "PICTFORMAT");
 	RegisterResourceName (GlyphSetType, "GLYPHSET");
@@ -585,7 +606,8 @@
 	}
 	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 @@
     PictureScreenPtr	ps = GetPictureScreen(pScreen);
     RegionPtr		clientClip;
     int			result;
-
     clientClip = RECTS_TO_REGION(pScreen,
 				 nRect, rects, CT_UNSORTED);
     if (!clientClip)
@@ -1027,6 +1048,50 @@
 }
 
 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)
 {




More information about the xorg-commit-diffs mailing list