gegl r1852 - in trunk: . gegl/process



Author: neo
Date: Fri Jan 18 10:01:35 2008
New Revision: 1852
URL: http://svn.gnome.org/viewvc/gegl?rev=1852&view=rev

Log:
2008-01-18  Sven Neumann  <sven gimp org>

	* gegl/process/gegl-processor.c: moved variables to inner scopes
	and removed some redundant casts.


Modified:
   trunk/ChangeLog
   trunk/gegl/process/gegl-processor.c

Modified: trunk/gegl/process/gegl-processor.c
==============================================================================
--- trunk/gegl/process/gegl-processor.c	(original)
+++ trunk/gegl/process/gegl-processor.c	Fri Jan 18 10:01:35 2008
@@ -305,15 +305,12 @@
   GeglCache *cache    = gegl_node_get_cache (processor->input);
   gint       max_area = processor->chunk_size;
 
-  GeglRectangle *dr;
-
   if (processor->dirty_rectangles)
     {
-      guchar *buf;
-      gint pxsize;
-      g_object_get (cache, "px-size", &pxsize, NULL);
+      GeglRectangle *dr = processor->dirty_rectangles->data;
+      gint           pxsize;
 
-      dr = processor->dirty_rectangles->data;
+      g_object_get (cache, "px-size", &pxsize, NULL);
 
       if (dr->height * dr->width > max_area && 1)
         {
@@ -367,35 +364,36 @@
           return TRUE;
         }
 
-      if (gegl_region_rect_in (cache->valid_region, (GeglRectangle *) dr) !=
+      if (gegl_region_rect_in (cache->valid_region, dr) !=
           GEGL_OVERLAP_RECTANGLE_IN)
         {
-          gegl_region_union_with_rect (cache->valid_region, (GeglRectangle *) dr);
+          guchar *buf;
+
+          gegl_region_union_with_rect (cache->valid_region, dr);
           buf = g_malloc (dr->width * dr->height * pxsize);
           g_assert (buf);
 
           gegl_node_blit (cache->node, 1.0, dr, cache->format, buf, GEGL_AUTO_ROWSTRIDE, GEGL_BLIT_DEFAULT);
           gegl_buffer_set (GEGL_BUFFER (cache), dr, cache->format, buf, GEGL_AUTO_ROWSTRIDE);
 
-          gegl_cache_computed (cache, (GeglRectangle *) dr);
+          gegl_cache_computed (cache, dr);
 
           g_free (buf);
         }
       g_free (dr);
     }
+
   return processor->dirty_rectangles != NULL;
 }
 
 /* returns TRUE if there is more work */
 static gboolean render_rectangle_unbuffered (GeglProcessor *processor)
 {
-  gint       max_area = processor->chunk_size;
-
-  GeglRectangle *dr;
+  const gint max_area = processor->chunk_size;
 
   if (processor->dirty_rectangles)
     {
-      dr = processor->dirty_rectangles->data;
+      GeglRectangle *dr = processor->dirty_rectangles->data;
 
       if (dr->height * dr->width > max_area && 1)
         {
@@ -449,9 +447,10 @@
         }
 
       gegl_node_blit (processor->node, 1.0, dr, NULL, NULL, GEGL_AUTO_ROWSTRIDE, GEGL_BLIT_DEFAULT);
-      gegl_region_union_with_rect (processor->valid_region, (GeglRectangle *) dr);
+      gegl_region_union_with_rect (processor->valid_region, dr);
       g_free (dr);
     }
+
   return processor->dirty_rectangles != NULL;
 }
 
@@ -600,9 +599,9 @@
 
       for (i = 0; i < n_rectangles && i < 1; i++)
         {
-          GeglRectangle  roi = *((GeglRectangle *) &rectangles[i]);
+          GeglRectangle  roi = rectangles[i];
           GeglRectangle *dr;
-          GeglRegion    *tr = gegl_region_rectangle ((void *) &roi);
+          GeglRegion    *tr = gegl_region_rectangle(&roi);
           gegl_region_subtract (processor->queued_region, tr);
           gegl_region_destroy (tr);
 
@@ -611,6 +610,7 @@
           processor->dirty_rectangles = g_slist_prepend (processor->dirty_rectangles, dr);
         }
       g_free (rectangles);
+
       if (n_rectangles != 0)
         {
           if (progress)
@@ -633,9 +633,9 @@
 
       for (i = 0; i < n_rectangles && i < 1; i++)
         {
-          GeglRectangle  roi = *((GeglRectangle *) &rectangles[i]);
+          GeglRectangle  roi = rectangles[i];
           GeglRectangle *dr;
-          GeglRegion    *tr = gegl_region_rectangle ((void *) &roi);
+          GeglRegion    *tr = gegl_region_rectangle (&roi);
           gegl_region_subtract (processor->queued_region, tr);
           gegl_region_destroy (tr);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]