Remove useless checks for NULL before freeing
[profile/ivi/pixman.git] / pixman / pixman-solid-fill.c
index 1805600..852e135 100644 (file)
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include "pixman-private.h"
 
-static void
-solid_fill_get_scanline_32 (pixman_image_t *image, int x, int y, int width,
-                           uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
+void
+_pixman_solid_fill_iter_init (pixman_image_t *image, pixman_iter_t  *iter)
 {
-    uint32_t *end = buffer + width;
-    register uint32_t color = ((solid_fill_t *)image)->color;
-    
-    while (buffer < end)
-       *(buffer++) = color;
-    
-    return;
-}
+    if (iter->flags & ITER_NARROW)
+    {
+       uint32_t *b = (uint32_t *)iter->buffer;
+       uint32_t *e = b + iter->width;
+       uint32_t color = iter->image->solid.color_32;
 
-static source_pict_class_t
-solid_fill_classify (pixman_image_t *image,
-                    int             x,
-                    int             y,
-                    int             width,
-                    int             height)
-{
-    return (image->source.class = SOURCE_IMAGE_CLASS_HORIZONTAL);
-}
+       while (b < e)
+           *(b++) = color;
+    }
+    else
+    {
+       uint64_t *b = (uint64_t *)iter->buffer;
+       uint64_t *e = b + iter->width;
+       uint64_t color = image->solid.color_64;
 
-static void
-solid_fill_property_changed (pixman_image_t *image)
-{
-    image->common.get_scanline_32 = (scanFetchProc)solid_fill_get_scanline_32;
-    image->common.get_scanline_64 = (scanFetchProc)_pixman_image_get_scanline_64_generic;
+       while (b < e)
+           *(b++) = color;
+    }
+
+    iter->get_scanline = _pixman_iter_get_scanline_noop;
 }
 
 static uint32_t
 color_to_uint32 (const pixman_color_t *color)
 {
     return
-       (color->alpha >> 8 << 24) |
-       (color->red >> 8 << 16) |
+        (color->alpha >> 8 << 24) |
+        (color->red >> 8 << 16) |
         (color->green & 0xff00) |
-       (color->blue >> 8);
+        (color->blue >> 8);
+}
+
+static uint64_t
+color_to_uint64 (const pixman_color_t *color)
+{
+    return
+        ((uint64_t)color->alpha << 48) |
+        ((uint64_t)color->red << 32) |
+        ((uint64_t)color->green << 16) |
+        ((uint64_t)color->blue);
 }
 
 PIXMAN_EXPORT pixman_image_t *
 pixman_image_create_solid_fill (pixman_color_t *color)
 {
-    pixman_image_t *img = _pixman_image_allocate();
-    
+    pixman_image_t *img = _pixman_image_allocate ();
+
     if (!img)
        return NULL;
 
     img->type = SOLID;
-    img->solid.color = color_to_uint32 (color);
-
-    img->source.class = SOURCE_IMAGE_CLASS_UNKNOWN;
-    img->common.classify = solid_fill_classify;
-    img->common.property_changed = solid_fill_property_changed;
+    img->solid.color = *color;
+    img->solid.color_32 = color_to_uint32 (color);
+    img->solid.color_64 = color_to_uint64 (color);
 
-    solid_fill_property_changed (img);
-    
     return img;
 }
+