xserver: Branch 'master'

Adam Jackson ajax at kemper.freedesktop.org
Sat Aug 25 12:21:34 PDT 2007


 render/picture.c    |   48 ++++++++++++++++++++++++------------------------
 render/picturestr.h |    2 +-
 2 files changed, 25 insertions(+), 25 deletions(-)

New commits:
diff-tree 6f44a2c8a8d6e8f95681ebc7b2dd5ad9c3a02c6e (from ae7f71a8b3d6756161e55d998d6eec37d2695c98)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Sun Jul 29 14:16:10 2007 -0400

    Refactor PictureInitIndexedFormats.
    
    The plural version is now static, which is fine since it was only ever called
    from within picture post-init anyway.  The body of the work is now done with
    a one-shot (public) function that operates on a single format at a time.

diff --git a/render/picture.c b/render/picture.c
index 5ddd68c..ede865f 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -452,6 +452,28 @@ PictureFindVisual (ScreenPtr pScreen, Vi
 }
 
 Bool
+PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
+{
+    PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+
+    if (format->type != PictTypeIndexed || format->index.pColormap)
+	return TRUE;
+
+    if (format->index.vid == pScreen->rootVisual) {
+	format->index.pColormap =
+	    (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
+    } else {
+	VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid);
+	if (!CreateColormap(FakeClientID (0), pScreen, pVisual,
+		    &format->index.pColormap, AllocNone, 0))
+	    return FALSE;
+    }
+    if (!ps->InitIndexed(pScreen, format))
+	return FALSE;
+    return TRUE;
+}
+
+static Bool
 PictureInitIndexedFormats (ScreenPtr pScreen)
 {
     PictureScreenPtr    ps = GetPictureScreenIfSet(pScreen);
@@ -463,30 +485,8 @@ PictureInitIndexedFormats (ScreenPtr pSc
     format = ps->formats;
     nformat = ps->nformats;
     while (nformat--)
-    {
-	if (format->type == PictTypeIndexed && !format->index.pColormap)
-	{
-	    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,
-				    pVisual,
-				    &format->index.pColormap, AllocNone,
-				    0) != Success)
-		{
-		    return FALSE;
-		}
-	    }
-	    if (!(*ps->InitIndexed) (pScreen, format))
-		return FALSE;
-	}
-	format++;
-    }
+	if (!PictureInitIndexedFormat(pScreen, format++))
+	    return FALSE;
     return TRUE;
 }
 
diff --git a/render/picturestr.h b/render/picturestr.h
index 01572ec..005c588 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -449,7 +449,7 @@ void
 PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef);
 
 Bool
-PictureInitIndexedFormats (ScreenPtr pScreen);
+PictureInitIndexedFormat (ScreenPtr pScreen, PictFormatPtr format);
 
 Bool
 PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel);


More information about the xorg-commit mailing list