[gimp] Issue #440 - libgimp/gimptilebackendplugin.c provides no pyramid



commit d0ae39f017ae0f23f0d3f16220a11c32fad3291c
Author: Ell <ell_se yahoo com>
Date:   Sat Jan 12 05:48:03 2019 -0500

    Issue #440 - libgimp/gimptilebackendplugin.c provides no pyramid
    
    In GimpTileBackendPlugin, return NULL when fetching z>0 tiles,
    instead of simply ignoring the z coordinate, so that the mipmapped
    tile is rendered locally.  Likewise, avoid storing z>0 tiles.
    
    Note that this is suboptimal, since all the necessary level-0 tiles
    need to be sent to the buffer as a result.  Ideally, we should
    extend the wire protocol to handle mipmapped tiles.

 libgimp/gimptilebackendplugin.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/libgimp/gimptilebackendplugin.c b/libgimp/gimptilebackendplugin.c
index 900e934df0..e089deafda 100644
--- a/libgimp/gimptilebackendplugin.c
+++ b/libgimp/gimptilebackendplugin.c
@@ -132,20 +132,31 @@ gimp_tile_backend_plugin_command (GeglTileSource  *tile_store,
   switch (command)
     {
     case GEGL_TILE_GET:
-      g_mutex_lock (&backend_plugin_mutex);
+      /* TODO: fetch mipmapped tiles directly from gimp, instead of returning
+       * NULL to render them locally
+       */
+      if (z == 0)
+        {
+          g_mutex_lock (&backend_plugin_mutex);
 
-      result = gimp_tile_read_mul (backend_plugin, x, y);
+          result = gimp_tile_read_mul (backend_plugin, x, y);
 
-      g_mutex_unlock (&backend_plugin_mutex);
+          g_mutex_unlock (&backend_plugin_mutex);
+        }
       break;
 
     case GEGL_TILE_SET:
-      g_mutex_lock (&backend_plugin_mutex);
+      /* TODO: actually store mipmapped tiles */
+      if (z == 0)
+        {
+          g_mutex_lock (&backend_plugin_mutex);
 
-      gimp_tile_write_mul (backend_plugin, x, y, gegl_tile_get_data (data));
-      gegl_tile_mark_as_stored (data);
+          gimp_tile_write_mul (backend_plugin, x, y, gegl_tile_get_data (data));
 
-      g_mutex_unlock (&backend_plugin_mutex);
+          g_mutex_unlock (&backend_plugin_mutex);
+        }
+
+      gegl_tile_mark_as_stored (data);
       break;
 
     case GEGL_TILE_FLUSH:


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