Commit 535fd3a0 authored by Ell's avatar Ell
Browse files

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 5ffdb9aa)
parent 76e88e39
......@@ -99,6 +99,19 @@ gimp_tile_ref_zero (GimpTile *tile)
gimp_tile_cache_insert (tile);
_gimp_tile_ref_noinit (GimpTile *tile)
g_return_if_fail (tile != NULL);
if (tile->ref_count == 1)
tile->data = g_new (guchar, tile->ewidth * tile->eheight * tile->bpp);
gimp_tile_cache_insert (tile);
gimp_tile_unref (GimpTile *tile,
gboolean dirty)
......@@ -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);
......@@ -261,7 +261,7 @@ gimp_tile_write_mul (GimpTileBackendPlugin *backend_plugin,
gimp_tile = gimp_drawable_get_tile (priv->drawable,
y+v, x+u);
gimp_tile_ref (gimp_tile);
_gimp_tile_ref_noinit (gimp_tile);
gint ewidth = gimp_tile->ewidth;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment