Commit b7b9096c authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

allocate a tile cache.

2005-11-02  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/tga.c (save_image): allocate a tile cache.
parent 657488ac
2005-11-02 Sven Neumann <sven@gimp.org>
* plug-ins/common/tga.c (save_image): allocate a tile cache.
2005-11-02 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/actions/data-commands.c: add missing include file.
......
......@@ -901,11 +901,12 @@ ReadImage (FILE *fp,
fread (tga_cmap, info->colorMapLength * cmap_bytes, 1, fp) == 1)
{
if (info->colorMapSize == 32)
bgr2rgb(gimp_cmap, tga_cmap, info->colorMapLength, cmap_bytes, 1);
bgr2rgb (gimp_cmap, tga_cmap, info->colorMapLength, cmap_bytes, 1);
else if (info->colorMapSize == 24)
bgr2rgb(gimp_cmap, tga_cmap, info->colorMapLength, cmap_bytes, 0);
bgr2rgb (gimp_cmap, tga_cmap, info->colorMapLength, cmap_bytes, 0);
else if (info->colorMapSize == 16 || info->colorMapSize == 15)
upsample(gimp_cmap, tga_cmap, info->colorMapLength, cmap_bytes, info->alphaBits);
upsample (gimp_cmap, tga_cmap,
info->colorMapLength, cmap_bytes, info->alphaBits);
}
else
......@@ -938,8 +939,8 @@ ReadImage (FILE *fp,
/* Allocate the data. */
max_tileheight = gimp_tile_height ();
data = (guchar *) g_malloc (info->width * max_tileheight * drawable->bpp);
buffer = (guchar *) g_malloc (info->width * info->bytes);
data = g_new (guchar, info->width * max_tileheight * drawable->bpp);
buffer = g_new (guchar, info->width * info->bytes);
if (info->flipVert)
{
......@@ -1002,7 +1003,6 @@ save_image (const gchar *filename,
gint height;
FILE *fp;
gint tileheight;
gint out_bpp = 0;
gboolean status = TRUE;
gint i, row;
......@@ -1112,8 +1112,7 @@ save_image (const gchar *filename,
}
}
/* Allocate a new set of pixels. */
tileheight = gimp_tile_height ();
gimp_tile_cache_ntiles ((width / gimp_tile_width ()) + 1);
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, width, height, FALSE, FALSE);
......@@ -1122,29 +1121,27 @@ save_image (const gchar *filename,
for (row = 0; row < height; ++row)
{
if(tsvals.origin)
if (tsvals.origin)
{
gimp_pixel_rgn_get_rect (&pixel_rgn, pixels, 0, height-(row+1), width, 1);
gimp_pixel_rgn_get_row (&pixel_rgn, pixels, 0, height-(row+1), width);
}
else
{
gimp_pixel_rgn_get_rect (&pixel_rgn, pixels, 0, row, width, 1);
gimp_pixel_rgn_get_row (&pixel_rgn, pixels, 0, row, width);
}
if (dtype == GIMP_RGB_IMAGE)
{
bgr2rgb(data, pixels, width, drawable->bpp, 0);
bgr2rgb (data, pixels, width, drawable->bpp, 0);
}
else if (dtype == GIMP_RGBA_IMAGE)
{
bgr2rgb(data, pixels, width, drawable->bpp, 1);
bgr2rgb (data, pixels, width, drawable->bpp, 1);
}
else if (dtype == GIMP_INDEXEDA_IMAGE)
{
for (i = 0; i < width; ++i)
{
data[i]= pixels[i*2];
}
data[i]= pixels[i*2];
}
else
{
......
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