[gimp/gimp-2-10] 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/gimp-2-10] libgimp: in GimpTileBackendPlugin, don't read tile data upon TILE_SET
- Date: Tue, 15 Jan 2019 07:49:09 +0000 (UTC)
commit 535fd3a04100dd9afecd8bca7b6d6b099d6f9e1e
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.
(cherry picked from commit 5ffdb9aa415c90b97c1ece736977717c50c1da1c)
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 bdcedcf773..5441551de8 100644
--- a/libgimp/gimptile.c
+++ b/libgimp/gimptile.c
@@ -99,6 +99,19 @@ gimp_tile_ref_zero (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 55f6b23740..64b5dd88a9 100644
--- a/libgimp/gimptile.h
+++ b/libgimp/gimptile.h
@@ -62,6 +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_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]