[gimp] libgimp: avoid libgimp tile-cache in the plug-in tile backend



commit 47dcd4b93a82750435fae70004d39eeb069fb0ac
Author: Ell <ell_se yahoo com>
Date:   Tue Feb 5 16:58:24 2019 -0500

    libgimp: avoid libgimp tile-cache in the plug-in tile backend
    
    In GimpTileBackendPlugin, avoid storing read/written tiles in the
    libgimp tile-cache, since caching is already done by GEGL.

 libgimp/gimptile.c              | 17 +++++++++++++----
 libgimp/gimptile.h              |  3 ++-
 libgimp/gimptilebackendplugin.c |  6 ++----
 3 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/libgimp/gimptile.c b/libgimp/gimptile.c
index 8002db0ca5..ad31adfe8f 100644
--- a/libgimp/gimptile.c
+++ b/libgimp/gimptile.c
@@ -87,16 +87,25 @@ gimp_tile_ref (GimpTile *tile)
 }
 
 void
-_gimp_tile_ref_noinit (GimpTile *tile)
+_gimp_tile_ref_nocache (GimpTile *tile,
+                        gboolean  init)
 {
   g_return_if_fail (tile != NULL);
 
   tile->ref_count++;
 
   if (tile->ref_count == 1)
-    tile->data = g_new (guchar, tile->ewidth * tile->eheight * tile->bpp);
-
-  gimp_tile_cache_insert (tile);
+    {
+      if (init)
+        {
+          gimp_tile_get (tile);
+          tile->dirty = FALSE;
+        }
+      else
+        {
+          tile->data = g_new (guchar, tile->ewidth * tile->eheight * tile->bpp);
+        }
+    }
 }
 
 void
diff --git a/libgimp/gimptile.h b/libgimp/gimptile.h
index 51c34e610a..57125cc88c 100644
--- a/libgimp/gimptile.h
+++ b/libgimp/gimptile.h
@@ -58,7 +58,8 @@ void    gimp_tile_cache_ntiles (gulong     ntiles);
 
 /*  private function  */
 
-G_GNUC_INTERNAL void _gimp_tile_ref_noinit           (GimpTile     *tile);
+G_GNUC_INTERNAL void _gimp_tile_ref_nocache          (GimpTile     *tile,
+                                                      gboolean      init);
 
 G_GNUC_INTERNAL void _gimp_tile_cache_flush_drawable (GimpDrawable *drawable);
 
diff --git a/libgimp/gimptilebackendplugin.c b/libgimp/gimptilebackendplugin.c
index fc754ea6c6..d1767fa000 100644
--- a/libgimp/gimptilebackendplugin.c
+++ b/libgimp/gimptilebackendplugin.c
@@ -93,8 +93,6 @@ _gimp_tile_backend_plugin_class_init (GimpTileBackendPluginClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->finalize = gimp_tile_backend_plugin_finalize;
-
-  gimp_tile_cache_ntiles (64);
 }
 
 static void
@@ -209,7 +207,7 @@ gimp_tile_read_mul (GimpTileBackendPlugin *backend_plugin,
           gimp_tile = gimp_drawable_get_tile (priv->drawable,
                                               priv->shadow,
                                               y + v, x + u);
-          gimp_tile_ref (gimp_tile);
+          _gimp_tile_ref_nocache (gimp_tile, TRUE);
 
           {
             gint ewidth           = gimp_tile->ewidth;
@@ -261,7 +259,7 @@ gimp_tile_write_mul (GimpTileBackendPlugin *backend_plugin,
           gimp_tile = gimp_drawable_get_tile (priv->drawable,
                                               priv->shadow,
                                               y+v, x+u);
-          _gimp_tile_ref_noinit (gimp_tile);
+          _gimp_tile_ref_nocache (gimp_tile, FALSE);
 
           {
             gint ewidth           = gimp_tile->ewidth;


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