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.
This commit is contained in:
@ -86,6 +86,19 @@ gimp_tile_ref (GimpTile *tile)
|
|||||||
gimp_tile_cache_insert (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
|
void
|
||||||
gimp_tile_unref (GimpTile *tile,
|
gimp_tile_unref (GimpTile *tile,
|
||||||
gboolean dirty)
|
gboolean dirty)
|
||||||
|
@ -58,6 +58,8 @@ void gimp_tile_cache_ntiles (gulong ntiles);
|
|||||||
|
|
||||||
/* private function */
|
/* private function */
|
||||||
|
|
||||||
|
G_GNUC_INTERNAL void _gimp_tile_ref_noinit (GimpTile *tile);
|
||||||
|
|
||||||
G_GNUC_INTERNAL void _gimp_tile_cache_flush_drawable (GimpDrawable *drawable);
|
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,
|
gimp_tile = gimp_drawable_get_tile (priv->drawable,
|
||||||
priv->shadow,
|
priv->shadow,
|
||||||
y+v, x+u);
|
y+v, x+u);
|
||||||
gimp_tile_ref (gimp_tile);
|
_gimp_tile_ref_noinit (gimp_tile);
|
||||||
|
|
||||||
{
|
{
|
||||||
gint ewidth = gimp_tile->ewidth;
|
gint ewidth = gimp_tile->ewidth;
|
||||||
|
Reference in New Issue
Block a user