Reindent and reformat pixman-general.c
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Sun, 12 Jul 2009 23:09:24 +0000 (19:09 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Mon, 13 Jul 2009 23:55:34 +0000 (19:55 -0400)
pixman/pixman-general.c

index d9bdad7..df98b98 100644 (file)
 
 static void
 general_composite_rect  (pixman_implementation_t *imp,
-                        pixman_op_t              op,
-                        pixman_image_t          *src,
-                        pixman_image_t          *mask,
-                        pixman_image_t          *dest,
-                        int32_t                  src_x,
-                        int32_t                  src_y,
-                        int32_t                  mask_x,
-                        int32_t                  mask_y,
-                        int32_t                  dest_x,
-                        int32_t                  dest_y,
-                        int32_t                  width,
-                        int32_t                  height)
+                         pixman_op_t              op,
+                         pixman_image_t *         src,
+                         pixman_image_t *         mask,
+                         pixman_image_t *         dest,
+                         int32_t                  src_x,
+                         int32_t                  src_y,
+                         int32_t                  mask_x,
+                         int32_t                  mask_y,
+                         int32_t                  dest_x,
+                         int32_t                  dest_y,
+                         int32_t                  width,
+                         int32_t                  height)
 {
     uint8_t stack_scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
-    const pixman_format_code_t src_format = src->type == BITS ? src->bits.format : 0;
-    const pixman_format_code_t mask_format = mask && mask->type == BITS ? mask->bits.format : 0;
-    const pixman_format_code_t dest_format = dest->type == BITS ? dest->bits.format : 0;
-    const int src_wide = PIXMAN_FORMAT_IS_WIDE(src_format);
-    const int mask_wide = mask && PIXMAN_FORMAT_IS_WIDE(mask_format);
-    const int dest_wide = PIXMAN_FORMAT_IS_WIDE(dest_format);
+    const pixman_format_code_t src_format =
+       src->type == BITS ? src->bits.format : 0;
+    const pixman_format_code_t mask_format =
+       mask && mask->type == BITS ? mask->bits.format : 0;
+    const pixman_format_code_t dest_format =
+       dest->type == BITS ? dest->bits.format : 0;
+    const int src_wide = PIXMAN_FORMAT_IS_WIDE (src_format);
+    const int mask_wide = mask && PIXMAN_FORMAT_IS_WIDE (mask_format);
+    const int dest_wide = PIXMAN_FORMAT_IS_WIDE (dest_format);
     const int wide = src_wide || mask_wide || dest_wide;
     const int Bpp = wide ? 8 : 4;
     uint8_t *scanline_buffer = stack_scanline_buffer;
@@ -73,45 +76,46 @@ general_composite_rect  (pixman_implementation_t *imp,
     uint32_t *bits;
     int32_t stride;
     int i;
-    
+
     if (width * Bpp > SCANLINE_BUFFER_LENGTH)
     {
        scanline_buffer = pixman_malloc_abc (width, 3, Bpp);
-       
+
        if (!scanline_buffer)
            return;
     }
-    
+
     src_buffer = scanline_buffer;
     mask_buffer = src_buffer + width * Bpp;
     dest_buffer = mask_buffer + width * Bpp;
-    
+
     src_class = _pixman_image_classify (src,
-                                      src_x, src_y,
-                                      width, height);
-    
+                                        src_x, src_y,
+                                        width, height);
+
     mask_class = SOURCE_IMAGE_CLASS_UNKNOWN;
+
     if (mask)
     {
        mask_class = _pixman_image_classify (mask,
-                                           src_x, src_y,
-                                           width, height);
+                                            src_x, src_y,
+                                            width, height);
     }
-    
+
     if (op == PIXMAN_OP_CLEAR)
-        fetch_src = NULL;
+       fetch_src = NULL;
     else if (wide)
        fetch_src = _pixman_image_get_scanline_64;
     else
        fetch_src = _pixman_image_get_scanline_32;
-    
+
     if (!mask || op == PIXMAN_OP_CLEAR)
        fetch_mask = NULL;
     else if (wide)
        fetch_mask = _pixman_image_get_scanline_64;
     else
        fetch_mask = _pixman_image_get_scanline_32;
-    
+
     if (op == PIXMAN_OP_CLEAR || op == PIXMAN_OP_SRC)
        fetch_dest = NULL;
     else if (wide)
@@ -129,15 +133,15 @@ general_composite_rect  (pixman_implementation_t *imp,
      * the destination format.
      */
     if (!wide &&
-       !dest->common.alpha_map &&
-       !dest->common.write_func && 
-       (op == PIXMAN_OP_ADD || op == PIXMAN_OP_OVER) &&
-       (dest->bits.format == PIXMAN_a8r8g8b8 ||
-        dest->bits.format == PIXMAN_x8r8g8b8))
+        !dest->common.alpha_map &&
+        !dest->common.write_func &&
+        (op == PIXMAN_OP_ADD || op == PIXMAN_OP_OVER) &&
+        (dest->bits.format == PIXMAN_a8r8g8b8 ||
+         dest->bits.format == PIXMAN_x8r8g8b8))
     {
        store = NULL;
     }
-    
+
     if (!store)
     {
        bits = dest->bits.bits;
@@ -148,15 +152,15 @@ general_composite_rect  (pixman_implementation_t *imp,
        bits = NULL;
        stride = 0;
     }
-    
+
     component_alpha =
-       fetch_src                       &&
-       fetch_mask                      &&
-       mask                            &&
-       mask->common.type == BITS       &&
-       mask->common.component_alpha    &&
-       PIXMAN_FORMAT_RGB (mask->bits.format);
-    
+        fetch_src                       &&
+        fetch_mask                      &&
+        mask                            &&
+        mask->common.type == BITS       &&
+        mask->common.component_alpha    &&
+        PIXMAN_FORMAT_RGB (mask->bits.format);
+
     if (wide)
     {
        if (component_alpha)
@@ -171,13 +175,13 @@ general_composite_rect  (pixman_implementation_t *imp,
        else
            compose = _pixman_implementation_combine_32;
     }
-    
+
     if (!compose)
        return;
-    
+
     if (!fetch_mask)
        mask_buffer = NULL;
-    
+
     for (i = 0; i < height; ++i)
     {
        /* fill first half of scanline with source */
@@ -188,105 +192,115 @@ general_composite_rect  (pixman_implementation_t *imp,
                /* fetch mask before source so that fetching of
                   source can be optimized */
                fetch_mask (mask, mask_x, mask_y + i,
-                          width, (void *)mask_buffer, 0, 0);
-               
+                           width, (void *)mask_buffer, 0, 0);
+
                if (mask_class == SOURCE_IMAGE_CLASS_HORIZONTAL)
                    fetch_mask = NULL;
            }
-           
+
            if (src_class == SOURCE_IMAGE_CLASS_HORIZONTAL)
            {
                fetch_src (src, src_x, src_y + i,
-                         width, (void *)src_buffer, 0, 0);
+                          width, (void *)src_buffer, 0, 0);
                fetch_src = NULL;
            }
            else
            {
                fetch_src (src, src_x, src_y + i,
-                         width, (void *)src_buffer, (void *)mask_buffer,
-                         0xffffffff);
+                          width, (void *)src_buffer, (void *)mask_buffer,
+                          0xffffffff);
            }
        }
        else if (fetch_mask)
        {
            fetch_mask (mask, mask_x, mask_y + i,
-                      width, (void *)mask_buffer, 0, 0);
+                       width, (void *)mask_buffer, 0, 0);
        }
-       
+
        if (store)
        {
            /* fill dest into second half of scanline */
            if (fetch_dest)
+           {
                fetch_dest (dest, dest_x, dest_y + i,
-                          width, (void *)dest_buffer, 0, 0);
-           
+                           width, (void *)dest_buffer, 0, 0);
+           }
+
            /* blend */
-           compose (imp->toplevel, op, (void *)dest_buffer, (void *)src_buffer, (void *)mask_buffer, width);
-           
+           compose (imp->toplevel, op,
+                    (void *)dest_buffer,
+                    (void *)src_buffer,
+                    (void *)mask_buffer,
+                    width);
+
            /* write back */
            store (&(dest->bits), dest_x, dest_y + i, width,
-                  (void *)dest_buffer);
+                  (void *)dest_buffer);
        }
        else
        {
            /* blend */
-           compose (imp->toplevel, op, bits + (dest_y + i) * stride +
-                    dest_x,
-                    (void *)src_buffer, (void *)mask_buffer, width);
+           compose (imp->toplevel, op,
+                    bits + (dest_y + i) * stride + dest_x,
+                    (void *)src_buffer, (void *)mask_buffer, width);
        }
     }
-    
+
     if (scanline_buffer != stack_scanline_buffer)
        free (scanline_buffer);
 }
 
 static void
-general_composite (pixman_implementation_t *   imp,
-                  pixman_op_t                  op,
-                  pixman_image_t *             src,
-                  pixman_image_t *             mask,
-                  pixman_image_t *             dest,
-                  int32_t                      src_x,
-                  int32_t                      src_y,
-                  int32_t                      mask_x,
-                  int32_t                      mask_y,
-                  int32_t                      dest_x,
-                  int32_t                      dest_y,
-                  int32_t                      width,
-                  int32_t                      height)
+general_composite (pixman_implementation_t * imp,
+                   pixman_op_t               op,
+                   pixman_image_t *          src,
+                   pixman_image_t *          mask,
+                   pixman_image_t *          dest,
+                   int32_t                   src_x,
+                   int32_t                   src_y,
+                   int32_t                   mask_x,
+                   int32_t                   mask_y,
+                   int32_t                   dest_x,
+                   int32_t                   dest_y,
+                   int32_t                   width,
+                   int32_t                   height)
 {
     _pixman_walk_composite_region (imp, op, src, mask, dest, src_x, src_y,
-                                  mask_x, mask_y, dest_x, dest_y, width, height,
-                                  general_composite_rect);
+                                   mask_x, mask_y, dest_x, dest_y,
+                                  width, height,
+                                   general_composite_rect);
 }
 
 static pixman_bool_t
 general_blt (pixman_implementation_t *imp,
-            uint32_t *src_bits,
-            uint32_t *dst_bits,
-            int src_stride,
-            int dst_stride,
-            int src_bpp,
-            int dst_bpp,
-            int src_x, int src_y,
-            int dst_x, int dst_y,
-            int width, int height)
+             uint32_t *               src_bits,
+             uint32_t *               dst_bits,
+             int                      src_stride,
+             int                      dst_stride,
+             int                      src_bpp,
+             int                      dst_bpp,
+             int                      src_x,
+             int                      src_y,
+             int                      dst_x,
+             int                      dst_y,
+             int                      width,
+             int                      height)
 {
     /* We can't blit unless we have sse2 or mmx */
-    
+
     return FALSE;
 }
 
 static pixman_bool_t
 general_fill (pixman_implementation_t *imp,
-             uint32_t *bits,
-             int stride,
-             int bpp,
-             int x,
-             int y,
-             int width,
-             int height,
-             uint32_t xor)
+              uint32_t *               bits,
+              int                      stride,
+              int                      bpp,
+              int                      x,
+              int                      y,
+              int                      width,
+              int                      height,
+              uint32_t xor)
 {
     return FALSE;
 }
@@ -298,10 +312,11 @@ _pixman_implementation_create_general (void)
 
     _pixman_setup_combiner_functions_32 (imp);
     _pixman_setup_combiner_functions_64 (imp);
-    
+
     imp->composite = general_composite;
     imp->blt = general_blt;
     imp->fill = general_fill;
-    
+
     return imp;
 }
+