xserver: Branch 'master' - 2 commits

Adam Jackson ajax at kemper.freedesktop.org
Fri Feb 23 18:17:34 UTC 2018


 render/picture.c |   78 +++++++++++++++++++------------------------------------
 1 file changed, 27 insertions(+), 51 deletions(-)

New commits:
commit 9339fa87d03204b29d47eb8c9406f701517b3514
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Feb 22 16:53:22 2018 -0500

    render: Cosmetic cleanup to default format creation
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/render/picture.c b/render/picture.c
index 1952785b2..f0638a39f 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -148,17 +148,17 @@ typedef struct _formatInit {
     CARD8 depth;
 } FormatInitRec, *FormatInitPtr;
 
-static int
-addFormat(FormatInitRec formats[256], int nformat, CARD32 format, CARD8 depth)
+static void
+addFormat(FormatInitRec formats[256], int *nformat, CARD32 format, CARD8 depth)
 {
     int n;
 
-    for (n = 0; n < nformat; n++)
+    for (n = 0; n < *nformat; n++)
         if (formats[n].format == format && formats[n].depth == depth)
-            return nformat;
-    formats[nformat].format = format;
-    formats[nformat].depth = depth;
-    return ++nformat;
+            return;
+    formats[*nformat].format = format;
+    formats[*nformat].depth = depth;
+    ++*nformat;
 }
 
 #define Mask(n) ((1 << (n)) - 1)
@@ -166,7 +166,7 @@ addFormat(FormatInitRec formats[256], int nformat, CARD32 format, CARD8 depth)
 static PictFormatPtr
 PictureCreateDefaultFormats(ScreenPtr pScreen, int *nformatp)
 {
-    int nformats, f;
+    int nformats = 0, f;
     PictFormatPtr pFormats;
     FormatInitRec formats[1024];
     CARD32 format;
@@ -239,18 +239,18 @@ PictureCreateDefaultFormats(ScreenPtr pScreen, int *nformatp)
             }
             if (type != PICT_TYPE_OTHER) {
                 format = PICT_FORMAT(bpp, type, 0, r, g, b);
-                nformats = addFormat(formats, nformats, format, depth);
+                addFormat(formats, &nformats, format, depth);
             }
             break;
         case StaticColor:
         case PseudoColor:
             format = PICT_VISFORMAT(bpp, PICT_TYPE_COLOR, v);
-            nformats = addFormat(formats, nformats, format, depth);
+            addFormat(formats, &nformats, format, depth);
             break;
         case StaticGray:
         case GrayScale:
             format = PICT_VISFORMAT(bpp, PICT_TYPE_GRAY, v);
-            nformats = addFormat(formats, nformats, format, depth);
+            addFormat(formats, &nformats, format, depth);
             break;
         }
     }
@@ -265,50 +265,34 @@ PictureCreateDefaultFormats(ScreenPtr pScreen, int *nformatp)
         case 16:
             /* depth 12 formats */
             if (pDepth->depth >= 12) {
-                nformats = addFormat(formats, nformats,
-                                     PICT_x4r4g4b4, pDepth->depth);
-                nformats = addFormat(formats, nformats,
-                                     PICT_x4b4g4r4, pDepth->depth);
+                addFormat(formats, &nformats, PICT_x4r4g4b4, pDepth->depth);
+                addFormat(formats, &nformats, PICT_x4b4g4r4, pDepth->depth);
             }
             /* depth 15 formats */
             if (pDepth->depth >= 15) {
-                nformats = addFormat(formats, nformats,
-                                     PICT_x1r5g5b5, pDepth->depth);
-                nformats = addFormat(formats, nformats,
-                                     PICT_x1b5g5r5, pDepth->depth);
+                addFormat(formats, &nformats, PICT_x1r5g5b5, pDepth->depth);
+                addFormat(formats, &nformats, PICT_x1b5g5r5, pDepth->depth);
             }
             /* depth 16 formats */
             if (pDepth->depth >= 16) {
-                nformats = addFormat(formats, nformats,
-                                     PICT_a1r5g5b5, pDepth->depth);
-                nformats = addFormat(formats, nformats,
-                                     PICT_a1b5g5r5, pDepth->depth);
-                nformats = addFormat(formats, nformats,
-                                     PICT_r5g6b5, pDepth->depth);
-                nformats = addFormat(formats, nformats,
-                                     PICT_b5g6r5, pDepth->depth);
-                nformats = addFormat(formats, nformats,
-                                     PICT_a4r4g4b4, pDepth->depth);
-                nformats = addFormat(formats, nformats,
-                                     PICT_a4b4g4r4, pDepth->depth);
+                addFormat(formats, &nformats, PICT_a1r5g5b5, pDepth->depth);
+                addFormat(formats, &nformats, PICT_a1b5g5r5, pDepth->depth);
+                addFormat(formats, &nformats, PICT_r5g6b5, pDepth->depth);
+                addFormat(formats, &nformats, PICT_b5g6r5, pDepth->depth);
+                addFormat(formats, &nformats, PICT_a4r4g4b4, pDepth->depth);
+                addFormat(formats, &nformats, PICT_a4b4g4r4, pDepth->depth);
             }
             break;
         case 32:
             if (pDepth->depth >= 24) {
-                nformats = addFormat(formats, nformats,
-                                     PICT_x8r8g8b8, pDepth->depth);
-                nformats = addFormat(formats, nformats,
-                                     PICT_x8b8g8r8, pDepth->depth);
+                addFormat(formats, &nformats, PICT_x8r8g8b8, pDepth->depth);
+                addFormat(formats, &nformats, PICT_x8b8g8r8, 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);
+                addFormat(formats, &nformats, PICT_a2r10g10b10, pDepth->depth);
+                addFormat(formats, &nformats, PICT_x2r10g10b10, pDepth->depth);
+                addFormat(formats, &nformats, PICT_a2b10g10r10, pDepth->depth);
+                addFormat(formats, &nformats, PICT_x2b10g10r10, pDepth->depth);
             }
             break;
         }
commit ddf752eafe951bb9723aabf2579c4725a6ffc9de
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Feb 22 16:53:21 2018 -0500

    render: Remove some 24bpp handling
    
    This can't happen anymore.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/render/picture.c b/render/picture.c
index 9e4036e7d..1952785b2 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -293,14 +293,6 @@ PictureCreateDefaultFormats(ScreenPtr pScreen, int *nformatp)
                                      PICT_a4b4g4r4, pDepth->depth);
             }
             break;
-        case 24:
-            if (pDepth->depth >= 24) {
-                nformats = addFormat(formats, nformats,
-                                     PICT_r8g8b8, pDepth->depth);
-                nformats = addFormat(formats, nformats,
-                                     PICT_b8g8r8, pDepth->depth);
-            }
-            break;
         case 32:
             if (pDepth->depth >= 24) {
                 nformats = addFormat(formats, nformats,


More information about the xorg-commit mailing list