gegl r2739 - in trunk: . gegl/buffer



Author: ok
Date: Thu Nov 13 23:33:36 2008
New Revision: 2739
URL: http://svn.gnome.org/viewvc/gegl?rev=2739&view=rev

Log:
Gave the command functions names reflecting the file they live in to
improve profile readability.
* gegl/buffer/gegl-buffer.c: 
* gegl/buffer/gegl-sampler-linear.c: 
* gegl/buffer/gegl-tile-backend-file.c:
* gegl/buffer/gegl-tile-backend-ram.c:
* gegl/buffer/gegl-tile-backend-tiledir.c:
* gegl/buffer/gegl-tile-handler-cache.c:
* gegl/buffer/gegl-tile-handler-chain.c:
* gegl/buffer/gegl-tile-handler-empty.c:
* gegl/buffer/gegl-tile-handler-log.c:
* gegl/buffer/gegl-tile-handler-zoom.c:
* gegl/buffer/gegl-tile-handler.c: 
* gegl/buffer/gegl-tile-source.c: 
* gegl/buffer/gegl-tile-source.h:


Modified:
   trunk/ChangeLog
   trunk/gegl/buffer/gegl-buffer.c
   trunk/gegl/buffer/gegl-sampler-linear.c
   trunk/gegl/buffer/gegl-tile-backend-file.c
   trunk/gegl/buffer/gegl-tile-backend-ram.c
   trunk/gegl/buffer/gegl-tile-backend-tiledir.c
   trunk/gegl/buffer/gegl-tile-handler-cache.c
   trunk/gegl/buffer/gegl-tile-handler-chain.c
   trunk/gegl/buffer/gegl-tile-handler-empty.c
   trunk/gegl/buffer/gegl-tile-handler-log.c
   trunk/gegl/buffer/gegl-tile-handler-zoom.c
   trunk/gegl/buffer/gegl-tile-handler.c
   trunk/gegl/buffer/gegl-tile-source.c
   trunk/gegl/buffer/gegl-tile-source.h

Modified: trunk/gegl/buffer/gegl-buffer.c
==============================================================================
--- trunk/gegl/buffer/gegl-buffer.c	(original)
+++ trunk/gegl/buffer/gegl-buffer.c	Thu Nov 13 23:33:36 2008
@@ -285,10 +285,10 @@
 static gint allocated_buffers    = 0;
 static gint de_allocated_buffers = 0;
 
-  /* this should only be possible if this buffer matches all the buffers down to
-   * storage, all of those parent buffers would change size as well, no tiles
-   * would be voided as a result of changing the extent.
-   */
+/* this should only be possible if this buffer matches all the buffers down to
+ * storage, all of those parent buffers would change size as well, no tiles
+ * would be voided as a result of changing the extent.
+ */
 gboolean
 gegl_buffer_set_extent (GeglBuffer          *buffer,
                         const GeglRectangle *extent)
@@ -648,11 +648,6 @@
     {
       GeglBuffer *buffer = GEGL_BUFFER (handler);
 
-      /* not sure if this plays well with shifting */
-      tile->x = x;
-      tile->y = y;
-      tile->z = z;
-
       if (x < buffer->min_x)
         buffer->min_x = x;
       if (y < buffer->min_y)
@@ -879,6 +874,17 @@
   if (extent == NULL)
     extent = gegl_buffer_get_extent (buffer);
 
+  if (extent->width < 0 || extent->height < 0)
+    {
+      g_warning ("avoiding creating buffer of size: %ix%i returning an empty buffer instead.\n", extent->width, extent->height);
+      return g_object_new (GEGL_TYPE_BUFFER,
+                           "source", buffer,
+                           "x", extent->x,
+                           "y", extent->y,
+                           "width", 0,
+                           "height", 0,
+                           NULL);
+    }
   return g_object_new (GEGL_TYPE_BUFFER,
                        "source", buffer,
                        "x", extent->x,

Modified: trunk/gegl/buffer/gegl-sampler-linear.c
==============================================================================
--- trunk/gegl/buffer/gegl-sampler-linear.c	(original)
+++ trunk/gegl/buffer/gegl-sampler-linear.c	Thu Nov 13 23:33:36 2008
@@ -98,8 +98,8 @@
   sampler_bptr = gegl_sampler_get_ptr (self, dx, dy);
 
   /* FIXME: unroll this loop */
-  for (i=0, v=dy+context_rect.y; v < dy+context_rect.height ; v++)
-    for (u=dx+context_rect.x; u < dx+context_rect.width  ; u++, i++)
+  for (i=0, v=dy; v < dy+2; v++)
+    for (u=dx; u < dx+2; u++, i++)
       {
         sampler_bptr += offsets[i];
         newval[0] += q[i] * sampler_bptr[0];

Modified: trunk/gegl/buffer/gegl-tile-backend-file.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-backend-file.c	(original)
+++ trunk/gegl/buffer/gegl-tile-backend-file.c	Thu Nov 13 23:33:36 2008
@@ -581,12 +581,12 @@
 };
 
 static gpointer
-command (GeglTileSource  *self,
-         GeglTileCommand  command,
-         gint             x,
-         gint             y,
-         gint             z,
-         gpointer         data)
+gegl_tile_backend_file_command (GeglTileSource  *self,
+                                GeglTileCommand  command,
+                                gint             x,
+                                gint             y,
+                                gint             z,
+                                gpointer         data)
 {
   switch (command)
     {
@@ -1029,7 +1029,7 @@
   gobject_class->constructor  = gegl_tile_backend_file_constructor;
   gobject_class->finalize     = finalize;
 
-  gegl_tile_source_class->command  = command;
+  gegl_tile_source_class->command = gegl_tile_backend_file_command;
 
   GEGL_BUFFER_STRUCT_CHECK_PADDING;
 

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 Nov 13 23:33:36 2008
@@ -224,12 +224,12 @@
 };
 
 static gpointer
-command (GeglTileSource     *tile_store,
-         GeglTileCommand command,
-         gint            x,
-         gint            y,
-         gint            z,
-         gpointer        data)
+gegl_tile_backend_ram_command (GeglTileSource     *tile_store,
+                               GeglTileCommand command,
+                               gint            x,
+                               gint            y,
+                               gint            z,
+                               gpointer        data)
 {
   switch (command)
     {
@@ -362,7 +362,7 @@
   gobject_class->constructor  = gegl_tile_backend_ram_constructor;
   gobject_class->finalize     = finalize;
 
-  gegl_tile_source_class->command  = command;
+  gegl_tile_source_class->command  = gegl_tile_backend_ram_command;
 }
 
 static void

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 Nov 13 23:33:36 2008
@@ -226,12 +226,12 @@
 };
 
 static gpointer
-command (GeglTileSource  *tile_store,
-         GeglTileCommand  command,
-         gint             x,
-         gint             y,
-         gint             z,
-         gpointer         data)
+gegl_tile_backend_tiledir_command (GeglTileSource  *tile_store,
+                                   GeglTileCommand  command,
+                                   gint             x,
+                                   gint             y,
+                                   gint             z,
+                                   gpointer         data)
 {
   switch (command)
     {
@@ -364,7 +364,7 @@
   gobject_class->constructor  = gegl_tile_backend_tiledir_constructor;
   gobject_class->finalize     = finalize;
 
-  gegl_tile_source_class->command  = command;
+  gegl_tile_source_class->command = gegl_tile_backend_tiledir_command;
 
 
   g_object_class_install_property (gobject_class, PROP_PATH,

Modified: trunk/gegl/buffer/gegl-tile-handler-cache.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-handler-cache.c	(original)
+++ trunk/gegl/buffer/gegl-tile-handler-cache.c	Thu Nov 13 23:33:36 2008
@@ -172,17 +172,16 @@
 }
 
 static gpointer
-command (GeglTileSource  *tile_store,
-         GeglTileCommand  command,
-         gint             x,
-         gint             y,
-         gint             z,
-         gpointer         data)
+gegl_tile_handler_cache_command (GeglTileSource  *tile_store,
+                                 GeglTileCommand  command,
+                                 gint             x,
+                                 gint             y,
+                                 gint             z,
+                                 gpointer         data)
 {
   GeglTileHandler      *handler = GEGL_HANDLER (tile_store);
   GeglTileHandlerCache *cache   = GEGL_TILE_HANDLER_CACHE (handler);
 
-  /* FIXME: replace with switch */
   switch (command)
     {
       case GEGL_TILE_FLUSH:
@@ -245,7 +244,7 @@
 
   gobject_class->finalize = finalize;
   gobject_class->dispose  = dispose;
-  source_class->command   = command;
+  source_class->command   = gegl_tile_handler_cache_command;
 }
 
 static void

Modified: trunk/gegl/buffer/gegl-tile-handler-chain.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-handler-chain.c	(original)
+++ trunk/gegl/buffer/gegl-tile-handler-chain.c	Thu Nov 13 23:33:36 2008
@@ -85,12 +85,12 @@
 }
 
 static gpointer
-command (GeglTileSource     *tile_store,
-         GeglTileCommand command,
-         gint            x,
-         gint            y,
-         gint            z,
-         gpointer        data)
+gegl_tile_handler_chain_command (GeglTileSource *tile_store,
+                                 GeglTileCommand command,
+                                 gint            x,
+                                 gint            y,
+                                 gint            z,
+                                 gpointer        data)
 {
   GeglTileHandlerChain *tile_handler_chain = (GeglTileHandlerChain *) tile_store;
   GeglTileSource *source = ((GeglTileHandler *) tile_store)->source;
@@ -115,7 +115,7 @@
   gobject_class    = (GObjectClass *) class;
   tile_store_class = (GeglTileSourceClass *) class;
 
-  tile_store_class->command  = command;
+  tile_store_class->command = gegl_tile_handler_chain_command;
 
   gobject_class->finalize = finalize;
   gobject_class->dispose  = dispose;

Modified: trunk/gegl/buffer/gegl-tile-handler-empty.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-handler-empty.c	(original)
+++ trunk/gegl/buffer/gegl-tile-handler-empty.c	Thu Nov 13 23:33:36 2008
@@ -146,12 +146,12 @@
 
 
 static gpointer
-command (GeglTileSource  *buffer,
-         GeglTileCommand  command,
-         gint             x,
-         gint             y,
-         gint             z,
-         gpointer         data)
+gegl_tile_handler_empty_command (GeglTileSource  *buffer,
+                                 GeglTileCommand  command,
+                                 gint             x,
+                                 gint             y,
+                                 gint             z,
+                                 gpointer         data)
 {
   if (command == GEGL_TILE_GET)
     return get_tile (buffer, x, y, z);
@@ -169,7 +169,7 @@
   gobject_class->finalize     = finalize;
   gobject_class->set_property = set_property;
   gobject_class->get_property = get_property;
-  source_class->command = command;
+  source_class->command = gegl_tile_handler_empty_command;
 
   g_object_class_install_property (gobject_class, PROP_BACKEND,
                                    g_param_spec_object ("backend",

Modified: trunk/gegl/buffer/gegl-tile-handler-log.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-handler-log.c	(original)
+++ trunk/gegl/buffer/gegl-tile-handler-log.c	Thu Nov 13 23:33:36 2008
@@ -41,12 +41,12 @@
 };
 
 static gpointer
-command (GeglTileSource  *gegl_tile_source,
-         GeglTileCommand  command,
-         gint             x,
-         gint             y,
-         gint             z,
-         gpointer         data)
+gegl_tile_handler_log_command (GeglTileSource  *gegl_tile_source,
+                               GeglTileCommand  command,
+                               gint             x,
+                               gint             y,
+                               gint             z,
+                               gpointer         data)
 {
   GeglTileHandler *handler = GEGL_HANDLER (gegl_tile_source);
   gpointer         result = NULL;
@@ -75,7 +75,7 @@
 {
   GeglTileSourceClass *source_class = GEGL_TILE_SOURCE_CLASS (klass);
 
-  source_class->command  = command;
+  source_class->command = gegl_tile_handler_log_command;
 }
 
 static void

Modified: trunk/gegl/buffer/gegl-tile-handler-zoom.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-handler-zoom.c	(original)
+++ trunk/gegl/buffer/gegl-tile-handler-zoom.c	Thu Nov 13 23:33:36 2008
@@ -299,13 +299,13 @@
 }
 
 static gpointer
-command (GeglTileSource  *tile_store,
-         GeglTileCommand  command,
-         gint             x,
-         gint             y,
-         gint             z,
-         gpointer         data)
-{
+gegl_tile_handler_zoom_command (GeglTileSource  *tile_store,
+                                GeglTileCommand  command,
+                                gint             x,
+                                gint             y,
+                                gint             z,
+                                gpointer         data)
+  {
   GeglTileHandler *handler  = GEGL_HANDLER (tile_store);
   /*GeglTileSource *source = handler->source;*/
 
@@ -394,7 +394,7 @@
   gobject_class->set_property = set_property;
   gobject_class->get_property = get_property;
 
-  source_class->command  = command;
+  source_class->command = gegl_tile_handler_zoom_command;
 
   g_object_class_install_property (gobject_class, PROP_TILE_STORAGE,
                                    g_param_spec_object ("tile_storage",

Modified: trunk/gegl/buffer/gegl-tile-handler.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-handler.c	(original)
+++ trunk/gegl/buffer/gegl-tile-handler.c	Thu Nov 13 23:33:36 2008
@@ -50,12 +50,12 @@
 }
 
 static gpointer
-command (GeglTileSource     *gegl_tile_source,
-         GeglTileCommand command,
-         gint            x,
-         gint            y,
-         gint            z,
-         gpointer        data)
+gegl_tile_handler_command (GeglTileSource *gegl_tile_source,
+                           GeglTileCommand command,
+                           gint            x,
+                           gint            y,
+                           gint            z,
+                           gpointer        data)
 {
   GeglTileHandler *handler = (GeglTileHandler*)gegl_tile_source;
 
@@ -142,7 +142,7 @@
   gobject_class->get_property = get_property;
   gobject_class->dispose      = dispose;
 
-  source_class->command  = command;
+  source_class->command = gegl_tile_handler_command;
 
   g_object_class_install_property (gobject_class, PROP_SOURCE,
                                    g_param_spec_object ("source",

Modified: trunk/gegl/buffer/gegl-tile-source.c
==============================================================================
--- trunk/gegl/buffer/gegl-tile-source.c	(original)
+++ trunk/gegl/buffer/gegl-tile-source.c	Thu Nov 13 23:33:36 2008
@@ -22,7 +22,7 @@
 G_DEFINE_TYPE (GeglTileSource, gegl_tile_source, G_TYPE_OBJECT)
 
 static gpointer
-command (GeglTileSource  *gegl_tile_source,
+gegl_tile_source_command_eek (GeglTileSource  *gegl_tile_source,
          GeglTileCommand  command,
          gint             x,
          gint             y,
@@ -36,7 +36,7 @@
 static void
 gegl_tile_source_class_init (GeglTileSourceClass *klass)
 {  
-  klass->command  = command;
+  klass->command = gegl_tile_source_command_eek;
 }
 
 static void

Modified: trunk/gegl/buffer/gegl-tile-source.h
==============================================================================
--- trunk/gegl/buffer/gegl-tile-source.h	(original)
+++ trunk/gegl/buffer/gegl-tile-source.h	Thu Nov 13 23:33:36 2008
@@ -54,17 +54,6 @@
 
 GType      gegl_tile_source_get_type (void) G_GNUC_CONST;
 
-#if 0
-gpointer   gegl_tile_source_command  (GeglTileSource  *tile_source,
-                                      GeglTileCommand  command,
-                                      gint             x,
-                                      gint             y,
-                                      gint             z,
-                                      gpointer         data);
-#endif
-
-
-
 /* All commands have the ability to pass commands to all tiles the handlers
  * add abstraction to the commands the documentaiton given here is valid
  * when the commands are issued to a full blown GeglBuffer instance.



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