gegl r2991 - in trunk: . examples examples/util gegl/buffer gegl/property-types operations/common operations/core operations/external



Author: martinn
Date: Thu Mar 26 18:27:44 2009
New Revision: 2991
URL: http://svn.gnome.org/viewvc/gegl?rev=2991&view=rev

Log:
Some vendor compilers can't compile non-constant elements of compound struct initializers

Patch from Gary V. Vaughan.

Modified:
   trunk/ChangeLog
   trunk/examples/gegl-paint.c
   trunk/examples/util/gegl-view.c
   trunk/gegl/buffer/gegl-buffer-access.c
   trunk/gegl/buffer/gegl-buffer-iterator.c
   trunk/gegl/buffer/gegl-buffer.c
   trunk/gegl/buffer/gegl-sampler-lanczos.c
   trunk/gegl/buffer/gegl-tile-backend-ram.c
   trunk/gegl/buffer/gegl-tile-backend-tiledir.c
   trunk/gegl/property-types/gegl-curve.c
   trunk/gegl/property-types/gegl-path.c
   trunk/operations/common/raw-load.c
   trunk/operations/common/snn-mean.c
   trunk/operations/common/stretch-contrast.c
   trunk/operations/core/crop.c
   trunk/operations/external/jpg-load.c
   trunk/operations/external/pixbuf.c
   trunk/operations/external/png-save.c
   trunk/operations/external/svg-load.c

Modified: trunk/examples/gegl-paint.c
==============================================================================
--- trunk/examples/gegl-paint.c	(original)
+++ trunk/examples/gegl-paint.c	Thu Mar 26 18:27:44 2009
@@ -97,8 +97,10 @@
 
       gegl_path_get_bounds (vector, &x0, &x1, &y0, &y1);
 
-      roi      = (GeglRectangle){x0 - LINEWIDTH, y0 - LINEWIDTH,
-                                 x1 - x0 + LINEWIDTH * 2, y1 - y0 + LINEWIDTH * 2};
+      roi.x = x0 - LINEWIDTH;
+      roi.y = y0 - LINEWIDTH;
+      roi.width = x1 - x0 + LINEWIDTH * 2;
+      roi.height = y1 - y0 + LINEWIDTH * 2;
 
       writebuf = gegl_node_new_child (gegl,
                                       "operation", "gegl:write-buffer",

Modified: trunk/examples/util/gegl-view.c
==============================================================================
--- trunk/examples/util/gegl-view.c	(original)
+++ trunk/examples/util/gegl-view.c	Thu Mar 26 18:27:44 2009
@@ -501,9 +501,12 @@
 {
   GtkWidget       *widget = GTK_WIDGET (view);
   GeglViewPrivate *priv   = GEGL_VIEW_GET_PRIVATE (view);
-  GeglRectangle    roi    = { priv->x / priv->scale, priv->y / priv->scale,
-                              ceil(widget->allocation.width / priv->scale+1),
-                              ceil(widget->allocation.height / priv->scale+1) };
+  GeglRectangle    roi;
+
+  roi.x = priv->x / priv->scale;
+  roi.y = priv->y / priv->scale;
+  roi.width = ceil(widget->allocation.width / priv->scale+1);
+  roi.height = ceil(widget->allocation.height / priv->scale+1);
 
 #if 0
   /* forget all already queued repaints */

Modified: trunk/gegl/buffer/gegl-buffer-access.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-access.c	(original)
+++ trunk/gegl/buffer/gegl-buffer-access.c	Thu Mar 26 18:27:44 2009
@@ -986,15 +986,17 @@
       gint          buf_width   = rect->width / scale;
       gint          buf_height  = rect->height / scale;
       gint          bpp         = babl_format_get_bytes_per_pixel (format);
-      GeglRectangle sample_rect = { floor(rect->x/scale),
-                                    floor(rect->y/scale),
-                                    buf_width,
-                                    buf_height };
+      GeglRectangle sample_rect;
       void         *sample_buf;
       gint          factor = 1;
       gdouble       offset_x;
       gdouble       offset_y;
 
+      sample_rect.x = floor(rect->x/scale);
+      sample_rect.y = floor(rect->y/scale);
+      sample_rect.width = buf_width;
+      sample_rect.height = buf_height;
+
       while (scale <= 0.5)
         {
           scale  *= 2;

Modified: trunk/gegl/buffer/gegl-buffer-iterator.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer-iterator.c	(original)
+++ trunk/gegl/buffer/gegl-buffer-iterator.c	Thu Mar 26 18:27:44 2009
@@ -329,7 +329,8 @@
         }
     }
   {
-    BufInfo info = {size, 1, NULL};
+    BufInfo info = {0, 1, NULL};
+    info.size = size;
     info.buf = gegl_malloc (size);
     g_array_append_val (buf_pool, info);
     return info.buf;

Modified: trunk/gegl/buffer/gegl-buffer.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer.c	(original)
+++ trunk/gegl/buffer/gegl-buffer.c	Thu Mar 26 18:27:44 2009
@@ -645,19 +645,20 @@
    */
   if (GEGL_IS_BUFFER (source))
     {
-      GeglRectangle parent = {
-        GEGL_BUFFER (source)->abyss.x - buffer->shift_x,
-        GEGL_BUFFER (source)->abyss.y - buffer->shift_y,
-        GEGL_BUFFER (source)->abyss.width,
-        GEGL_BUFFER (source)->abyss.height
-      };
-      GeglRectangle request = {
-        buffer->abyss.x,
-        buffer->abyss.y,
-        buffer->abyss.width,
-        buffer->abyss.height
-      };
+      GeglRectangle parent;
+      GeglRectangle request;
       GeglRectangle self;
+
+      parent.x = GEGL_BUFFER (source)->abyss.x - buffer->shift_x;
+      parent.y = GEGL_BUFFER (source)->abyss.y - buffer->shift_y;
+      parent.width = GEGL_BUFFER (source)->abyss.width;
+      parent.height = GEGL_BUFFER (source)->abyss.height;
+      
+      request.x = buffer->abyss.x;
+      request.y = buffer->abyss.y;
+      request.width = buffer->abyss.width;
+      request.height = buffer->abyss.height;
+
       gegl_rectangle_intersect (&self, &parent, &request);
 
       buffer->abyss.x      = self.x;

Modified: trunk/gegl/buffer/gegl-sampler-lanczos.c
==============================================================================
--- trunk/gegl/buffer/gegl-sampler-lanczos.c	(original)
+++ trunk/gegl/buffer/gegl-sampler-lanczos.c	Thu Mar 26 18:27:44 2009
@@ -162,8 +162,11 @@
   /* FIXME: move the initialization of these arrays into the _prepare function
    * to speed up actual resampling
    */
-  gfloat                   x_kernel[width2], /* 1-D kernels of Lanczos window coeffs */
-                           y_kernel[width2];
+  gfloat                  *x_kernel, /* 1-D kernels of Lanczos window coeffs */
+                          *y_kernel;
+
+  x_kernel = g_newa (gfloat, width2);
+  y_kernel = g_newa (gfloat, width2);
 
   self->interpolate_format = babl_format ("RaGaBaA float");
 

Modified: trunk/gegl/buffer/gegl-tile-backend-ram.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-backend-ram.c	(original)
+++ trunk/gegl/buffer/gegl-tile-backend-ram.c	Thu Mar 26 18:27:44 2009
@@ -124,7 +124,12 @@
               gint         y,
               gint         z)
 {
-  RamEntry key = { x, y, z, 0 };
+  RamEntry key;
+
+  key.x = x;
+  key.y = y;
+  key.z = z;
+  key.offset = 0;
 
   return g_hash_table_lookup (self->entries, &key);
 }

Modified: trunk/gegl/buffer/gegl-tile-backend-tiledir.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-backend-tiledir.c	(original)
+++ trunk/gegl/buffer/gegl-tile-backend-tiledir.c	Thu Mar 26 18:27:44 2009
@@ -146,7 +146,11 @@
 
  if (exist_tile (tile_store, NULL, x, y, z))
   {
-    GioEntry entry = {x,y,z};
+    GioEntry       entry;
+
+    entry.x = x;
+    entry.y = y;
+    entry.z = z;
 
     tile             = gegl_tile_new (backend->tile_size);
     tile->stored_rev = 1;
@@ -167,8 +171,11 @@
 {
   GeglTileBackend         *backend   = GEGL_TILE_BACKEND (store);
   GeglTileBackendTileDir *tile_backend_tiledir = GEGL_TILE_BACKEND_TILE_DIR (backend);
+  GioEntry       entry;
 
-  GioEntry       entry = {x,y,z};
+  entry.x = x;
+  entry.y = y;
+  entry.z = z;
 
   gio_entry_write (tile_backend_tiledir, &entry, tile->data);
   tile->stored_rev = tile->rev;

Modified: trunk/gegl/property-types/gegl-curve.c
==============================================================================
--- trunk/gegl/property-types/gegl-curve.c	(original)
+++ trunk/gegl/property-types/gegl-curve.c	Thu Mar 26 18:27:44 2009
@@ -185,7 +185,10 @@
                       gdouble       y)
 {
   GeglCurvePrivate *priv  = GEGL_CURVE_GET_PRIVATE (GEGL_CURVE (self));
-  GeglCurvePoint    point = { x, y };
+  GeglCurvePoint    point;
+
+  point.x = x;
+  point.y = y;
 
   g_array_append_val (priv->points, point);
 
@@ -217,7 +220,10 @@
                       gdouble         y)
 {
   GeglCurvePrivate *priv  = GEGL_CURVE_GET_PRIVATE (GEGL_CURVE (self));
-  GeglCurvePoint    point = { x, y };
+  GeglCurvePoint    point;
+
+  point.x = x;
+  point.y = y;
 
   g_assert (index < priv->points->len);
   g_array_index (priv->points, GeglCurvePoint, index) = point;

Modified: trunk/gegl/property-types/gegl-path.c
==============================================================================
--- trunk/gegl/property-types/gegl-path.c	(original)
+++ trunk/gegl/property-types/gegl-path.c	Thu Mar 26 18:27:44 2009
@@ -1798,10 +1798,9 @@
   extent.height = ceil (ymax) - extent.y;
 
   {
-    GSList *scanlines[extent.height * versubi];
-
-    gdouble xs[samples];
-    gdouble ys[samples];
+    GSList **scanlines;
+    gdouble *xs;
+    gdouble *ys;
 
     gint i;
     gdouble prev_x;
@@ -1811,9 +1810,12 @@
     gint    lastline=-1;
     gint    lastdir=-2;
 
+    xs = g_newa (gdouble, samples);
+    ys = g_newa (gdouble, samples);
     path_calc_values (priv->flat_path, samples, xs, ys);
 
     /* clear scanline intersection lists */
+    scanlines = g_newa (GSList*, extent.height * versubi);
     for (i=0; i < extent.height * versub; i++)
       scanlines[i]=NULL;
 
@@ -1907,7 +1909,12 @@
 
             for (j=0;j<horsub;j++)
             {
-              GeglRectangle roi={(startx+j)/horsub, extent.y + i/versub, (endx - startx-j + horsub) / horsub, 1};
+              GeglRectangle roi;
+
+              roi.x = (startx+j)/horsub;
+              roi.y = extent.y + i/versub;
+              roi.width = (endx - startx-j + horsub) / horsub;
+              roi.height = 1;
               gegl_buffer_accumulate (buffer, &roi, col);
             }
 
@@ -1954,12 +1961,13 @@
                                       we will ultimately leak the last valid
                                       cached brush. */
 
-  GeglRectangle roi = {floor(x-radius),
-                       floor(y-radius),
-                       ceil (x+radius) - floor (x-radius),
-                       ceil (y+radius) - floor (y-radius)};
-
   GeglRectangle temp;
+  GeglRectangle roi;
+
+  roi.x = floor(x-radius);
+  roi.y = floor(y-radius);
+  roi.width = ceil (x+radius) - floor (x-radius);
+  roi.height = ceil (y+radius) - floor (y-radius);
 
   gegl_color_get_rgba4f (color, col);
 

Modified: trunk/operations/common/raw-load.c
==============================================================================
--- trunk/operations/common/raw-load.c	(original)
+++ trunk/operations/common/raw-load.c	Thu Mar 26 18:27:44 2009
@@ -72,7 +72,9 @@
         }
 
         {
-          GeglRectangle extent = { 0, 0, width, height };
+          GeglRectangle extent = { 0, 0, 0, 0 };
+          extent.width = width;
+          extent.height = height;
           op_raw_load->chant_data = (gpointer) gegl_buffer_new (&extent,
                                                    babl_format_new (
                                                      babl_model ("RGB"),

Modified: trunk/operations/common/snn-mean.c
==============================================================================
--- trunk/operations/common/snn-mean.c	(original)
+++ trunk/operations/common/snn-mean.c	Thu Mar 26 18:27:44 2009
@@ -152,8 +152,16 @@
                     /* compute the coordinates of the symmetric pairs for
                      * this locaiton in the quadrant
                      */
-                    gint xs[4] = {x+u+radius, x-u+radius, x-u+radius, x+u+radius};
-                    gint ys[4] = {y+v+radius, y-v+radius, y+v+radius, y-v+radius};
+                    gint xs[4], ys[4];
+
+                    xs[0] = x+u+radius;
+                    xs[1] = x-u+radius;
+                    xs[2] = x-u+radius;
+                    xs[3] = x+u+radius;
+                    ys[0] = y+v+radius;
+                    ys[1] = y-v+radius;
+                    ys[2] = y+v+radius;
+                    ys[3] = y-v+radius;
 
                     /* check which member of the symmetric quadruple to use */
                     for (i=0;i<pairs*2;i++)

Modified: trunk/operations/common/stretch-contrast.c
==============================================================================
--- trunk/operations/common/stretch-contrast.c	(original)
+++ trunk/operations/common/stretch-contrast.c	Thu Mar 26 18:27:44 2009
@@ -116,10 +116,12 @@
     for (row = 0; row < result->height; row = consumed)
       {
         gint chunk = consumed+chunk_size<result->height?chunk_size:result->height-consumed;
-        GeglRectangle line = { result->x,
-                               result->y + row,
-                               result->width,
-                               chunk};
+        GeglRectangle line;
+
+        line.x = result->x;
+        line.y = result->y + row;
+        line.width = result->width;
+        line.height = chunk;
 
         gegl_buffer_get (input, 1.0, &line, babl_format ("RGBA float"), buf, GEGL_AUTO_ROWSTRIDE);
         inner_process (min, max, buf, result->width  * chunk);

Modified: trunk/operations/core/crop.c
==============================================================================
--- trunk/operations/core/crop.c	(original)
+++ trunk/operations/core/crop.c	Thu Mar 26 18:27:44 2009
@@ -79,7 +79,12 @@
                                      const GeglRectangle *input_region)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
-  GeglRectangle result = {o->x, o->y, o->width, o->height};
+  GeglRectangle result;
+
+  result.x = o->x;
+  result.y = o->y;
+  result.width = o->width;
+  result.height = o->height;
 
   gegl_rectangle_intersect (&result, &result, input_region);
 
@@ -92,7 +97,13 @@
                                    const GeglRectangle *roi)
 {
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
-  GeglRectangle result = {o->x, o->y, o->width, o->height};
+  GeglRectangle result;
+
+  result.x = o->x;
+  result.y = o->y;
+  result.width = o->width;
+  result.height = o->height;
+
   gegl_rectangle_intersect (&result, &result, roi);
   return result;
 }
@@ -106,7 +117,12 @@
   GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
   GeglBuffer   *input;
   gboolean      success = FALSE;
-  GeglRectangle extent = {o->x, o->y, o->width, o->height};
+  GeglRectangle extent;
+
+  extent.x = o->x;
+  extent.y = o->y;
+  extent.width = o->width;
+  extent.height = o->height;
 
   if (strcmp (output_prop, "output"))
     {

Modified: trunk/operations/external/jpg-load.c
==============================================================================
--- trunk/operations/external/jpg-load.c	(original)
+++ trunk/operations/external/jpg-load.c	Thu Mar 26 18:27:44 2009
@@ -117,7 +117,12 @@
 
   while (cinfo.output_scanline < cinfo.output_height)
     {
-      GeglRectangle rect = {dest_x, dest_y + row++, cinfo.output_width, 1};
+      GeglRectangle rect;
+
+      rect.x = dest_x;
+      rect.y = dest_y + row++;
+      rect.width = cinfo.output_width;
+      rect.height = 1;
 
       jpeg_read_scanlines (&cinfo, buffer, 1);
       gegl_buffer_set (gegl_buffer, &rect, babl_format ("R'G'B' u8"), buffer[0],

Modified: trunk/operations/external/pixbuf.c
==============================================================================
--- trunk/operations/external/pixbuf.c	(original)
+++ trunk/operations/external/pixbuf.c	Thu Mar 26 18:27:44 2009
@@ -67,9 +67,13 @@
 
   if (o->pixbuf)
     {
-      GeglRectangle extent = {0,0,
-                              gdk_pixbuf_get_width (o->pixbuf),
-                              gdk_pixbuf_get_height (o->pixbuf)};
+      GeglRectangle extent;
+
+      extent.x = 0;
+      extent.y = 0;
+      extent.width = gdk_pixbuf_get_width (o->pixbuf);
+      extent.height = gdk_pixbuf_get_height (o->pixbuf);
+
       gegl_buffer_set (output, &extent, NULL, gdk_pixbuf_get_pixels (o->pixbuf),
                        GEGL_AUTO_ROWSTRIDE);
     }

Modified: trunk/operations/external/png-save.c
==============================================================================
--- trunk/operations/external/png-save.c	(original)
+++ trunk/operations/external/png-save.c	Thu Mar 26 18:27:44 2009
@@ -153,7 +153,13 @@
 
   for (i=0; i< height; i++)
     {
-      GeglRectangle rect = {src_x, src_y+i, width, 1};
+      GeglRectangle rect;
+
+      rect.x = src_x;
+      rect.y = src_y+i;
+      rect.width = width;
+      rect.height = 1;
+
       gegl_buffer_get (gegl_buffer, 1.0, &rect, babl_format (format_string), pixels, GEGL_AUTO_ROWSTRIDE);
 
       png_write_rows (png, &pixels, 1);

Modified: trunk/operations/external/svg-load.c
==============================================================================
--- trunk/operations/external/svg-load.c	(original)
+++ trunk/operations/external/svg-load.c	Thu Mar 26 18:27:44 2009
@@ -88,7 +88,12 @@
     if (pixbuf)
     {
       guchar        *pixeldata;
-      GeglRectangle  rect = {dest_x, dest_y, width, height};
+      GeglRectangle  rect;
+
+      rect.x = dest_x;
+      rect.y = dest_y;
+      rect.width = width;
+      rect.height = height;
 
       pixeldata = gdk_pixbuf_get_pixels (pixbuf);
       gegl_buffer_set (gegl_buffer, &rect, babl_format ("R'G'B'A u8"), pixeldata, GEGL_AUTO_ROWSTRIDE);



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