[gimp] libgimp: in GimpTileBackendPlugin, don't read tile data upon TILE_SET
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: in GimpTileBackendPlugin, don't read tile data upon TILE_SET
- Date: Tue, 15 Jan 2019 07:49:19 +0000 (UTC)
commit 5ffdb9aa415c90b97c1ece736977717c50c1da1c
Author: Ell <ell_se yahoo com>
Date: Tue Jan 15 02:28:42 2019 -0500
libgimp: in GimpTileBackendPlugin, don't read tile data upon TILE_SET
Add an internal _gimp_tile_ref_noinit() function, which increases
the ref-count of a tile *without* initializing its data (in
particular, without reading its data from GIMP, or zeroing it.)
Use this function, instead of gimp_tile_ref(), when storing a tile
in GimpTileBackendPlugin, to avoid unnecessarily reading the tile
data from GIMP.
libgimp/gimptile.c | 13 +++++++++++++
libgimp/gimptile.h | 2 ++
libgimp/gimptilebackendplugin.c | 2 +-
3 files changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/libgimp/gimptile.c b/libgimp/gimptile.c
index c83c668799..8002db0ca5 100644
--- a/libgimp/gimptile.c
+++ b/libgimp/gimptile.c
@@ -86,6 +86,19 @@ gimp_tile_ref (GimpTile *tile)
gimp_tile_cache_insert (tile);
}
+void
+_gimp_tile_ref_noinit (GimpTile *tile)
+{
+ 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);
+}
+
void
gimp_tile_unref (GimpTile *tile,
gboolean dirty)
diff --git a/libgimp/gimptile.h b/libgimp/gimptile.h
index 44dd52fb68..51c34e610a 100644
--- a/libgimp/gimptile.h
+++ b/libgimp/gimptile.h
@@ -58,6 +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_cache_flush_drawable (GimpDrawable *drawable);
diff --git a/libgimp/gimptilebackendplugin.c b/libgimp/gimptilebackendplugin.c
index e089deafda..9116693aaa 100644
--- a/libgimp/gimptilebackendplugin.c
+++ b/libgimp/gimptilebackendplugin.c
@@ -261,7 +261,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 (gimp_tile);
+ _gimp_tile_ref_noinit (gimp_tile);
{
gint ewidth = gimp_tile->ewidth;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]