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



commit c9f47356699c140c926ea1fa4c5fa9a1b79a3d69
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.
    
    (cherry picked from commit 47dcd4b93a82750435fae70004d39eeb069fb0ac)

 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 5441551de8..99a041a4eb 100644
--- a/libgimp/gimptile.c
+++ b/libgimp/gimptile.c
@@ -100,16 +100,25 @@ gimp_tile_ref_zero (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 64b5dd88a9..50b54dac5b 100644
--- a/libgimp/gimptile.h
+++ b/libgimp/gimptile.h
@@ -62,7 +62,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]