mirror of https://github.com/GNOME/gimp.git
app/core/gimpdrawable-preview.c added sanity so we don't just plain crash
2004-05-06 Sven Neumann <sven@gimp.org> * app/core/gimpdrawable-preview.c * app/core/gimpimage-projection.c: added sanity so we don't just plain crash when an indexed image doesn't have a colormap. * plug-ins/common/png.c: keep at least one entry in the colormap. Fixes bug #142029.
This commit is contained in:
parent
4549d5a902
commit
2e76c29d4a
|
@ -1,3 +1,12 @@
|
|||
2004-05-06 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimpdrawable-preview.c
|
||||
* app/core/gimpimage-projection.c: added sanity so we don't just
|
||||
plain crash when an indexed image doesn't have a colormap.
|
||||
|
||||
* plug-ins/common/png.c: keep at least one entry in the colormap.
|
||||
Fixes bug #142029.
|
||||
|
||||
2004-05-06 Maurits Rijk <m.rijk@chello.nl>
|
||||
|
||||
* plug-ins/fp/fp_gdk.c
|
||||
|
|
|
@ -51,7 +51,7 @@ static TempBuf * gimp_drawable_preview_private (GimpDrawable *drawable,
|
|||
gint width,
|
||||
gint height);
|
||||
static void gimp_drawable_preview_scale (GimpImageBaseType type,
|
||||
guchar *cmap,
|
||||
const guchar *cmap,
|
||||
PixelRegion *srcPR,
|
||||
PixelRegion *destPR,
|
||||
gint subsample);
|
||||
|
@ -195,7 +195,7 @@ gimp_drawable_preview_private (GimpDrawable *drawable,
|
|||
|
||||
static void
|
||||
gimp_drawable_preview_scale (GimpImageBaseType type,
|
||||
guchar *cmap,
|
||||
const guchar *cmap,
|
||||
PixelRegion *srcPR,
|
||||
PixelRegion *destPR,
|
||||
gint subsample)
|
||||
|
@ -217,6 +217,8 @@ gimp_drawable_preview_scale (GimpImageBaseType type,
|
|||
gint frac;
|
||||
gboolean advance_dest;
|
||||
|
||||
g_return_if_fail (type != GIMP_INDEXED || cmap != NULL);
|
||||
|
||||
orig_width = srcPR->w / subsample;
|
||||
orig_height = srcPR->h / subsample;
|
||||
width = destPR->w;
|
||||
|
|
|
@ -717,6 +717,8 @@ project_indexed (GimpImage *gimage,
|
|||
PixelRegion *src,
|
||||
PixelRegion *dest)
|
||||
{
|
||||
g_return_if_fail (gimage->cmap != NULL);
|
||||
|
||||
if (! gimage->construct_flag)
|
||||
initial_region (src, dest, NULL, gimage->cmap,
|
||||
layer->opacity * 255.999,
|
||||
|
@ -734,6 +736,8 @@ project_indexed_alpha (GimpImage *gimage,
|
|||
PixelRegion *dest,
|
||||
PixelRegion *mask)
|
||||
{
|
||||
g_return_if_fail (gimage->cmap != NULL);
|
||||
|
||||
if (! gimage->construct_flag)
|
||||
initial_region (src, dest, mask, gimage->cmap,
|
||||
layer->opacity * 255.999,
|
||||
|
|
|
@ -717,6 +717,8 @@ project_indexed (GimpImage *gimage,
|
|||
PixelRegion *src,
|
||||
PixelRegion *dest)
|
||||
{
|
||||
g_return_if_fail (gimage->cmap != NULL);
|
||||
|
||||
if (! gimage->construct_flag)
|
||||
initial_region (src, dest, NULL, gimage->cmap,
|
||||
layer->opacity * 255.999,
|
||||
|
@ -734,6 +736,8 @@ project_indexed_alpha (GimpImage *gimage,
|
|||
PixelRegion *dest,
|
||||
PixelRegion *mask)
|
||||
{
|
||||
g_return_if_fail (gimage->cmap != NULL);
|
||||
|
||||
if (! gimage->construct_flag)
|
||||
initial_region (src, dest, mask, gimage->cmap,
|
||||
layer->opacity * 255.999,
|
||||
|
|
|
@ -894,8 +894,11 @@ load_image (const gchar *filename,
|
|||
#if PNG_LIBPNG_VER > 99
|
||||
if (png_get_valid (pp, info, PNG_INFO_tRNS))
|
||||
{
|
||||
for (empty = 0; empty < 256 && alpha[empty] == 0; ++empty);
|
||||
/* Calculates number of fully transparent "empty" entries */
|
||||
for (empty = 0; empty < 256 && alpha[empty] == 0; ++empty)
|
||||
/* Calculates number of fully transparent "empty" entries */;
|
||||
|
||||
/* keep at least one entry */
|
||||
empty = MIN (empty, info->num_palette - 1);
|
||||
|
||||
gimp_image_set_cmap (image, (guchar *) (info->palette + empty),
|
||||
info->num_palette - empty);
|
||||
|
|
Loading…
Reference in New Issue