Commit 91b78678 authored by Sven Neumann's avatar Sven Neumann

correctly initialize the bumpmap offsets

* plug-ins/common/bumpmap.c: correctly initialize the bumpmap
  offsets

* plug-ins/common/png.c: (load_image) if the PNG cannot be loaded,
  return -1 instead of some uninitialized integer


--Sven
parent f622c868
2000-04-20 Sven Neumann <sven@gimp.org>
* plug-ins/common/bumpmap.c: correctly initialize the bumpmap
offsets
* plug-ins/common/png.c: (load_image) if the PNG cannot be loaded,
return -1 instead of some uninitialized integer
2000-04-20 Michael Natterer <mitch@gimp.org> 2000-04-20 Michael Natterer <mitch@gimp.org>
* gimprc.in * gimprc.in
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
/* Version 3.0-pre1-ac2: /* Version 3.0-pre1-ac2:
* *
* - waterlevel/ambient restricted to 0-255 * - waterlevel/ambient restricted to 0-255
* - correctly initialize bumpmap_offsets
*/ */
/* Version 3.0-pre1-ac1: /* Version 3.0-pre1-ac1:
...@@ -236,7 +237,7 @@ static void bumpmap_convert_row (guchar *row, ...@@ -236,7 +237,7 @@ static void bumpmap_convert_row (guchar *row,
static gint bumpmap_dialog (void); static gint bumpmap_dialog (void);
static void dialog_init_preview (void); static void dialog_init_preview (void);
static void dialog_new_bumpmap (void); static void dialog_new_bumpmap (gboolean init_offsets);
static void dialog_update_preview (void); static void dialog_update_preview (void);
static gint dialog_preview_events (GtkWidget *widget, GdkEvent *event); static gint dialog_preview_events (GtkWidget *widget, GdkEvent *event);
static void dialog_scroll_src (void); static void dialog_scroll_src (void);
...@@ -1300,9 +1301,8 @@ dialog_preview_events (GtkWidget *widget, ...@@ -1300,9 +1301,8 @@ dialog_preview_events (GtkWidget *widget,
} }
static void static void
dialog_new_bumpmap (void) dialog_new_bumpmap (gboolean init_offsets)
{ {
static gboolean first_call = TRUE;
GtkAdjustment *adj; GtkAdjustment *adj;
gint i; gint i;
gint yofs; gint yofs;
...@@ -1329,7 +1329,7 @@ dialog_new_bumpmap (void) ...@@ -1329,7 +1329,7 @@ dialog_new_bumpmap (void)
bmint.bm_bpp = gimp_drawable_bpp (bmint.bm_drawable->id); bmint.bm_bpp = gimp_drawable_bpp (bmint.bm_drawable->id);
bmint.bm_has_alpha = gimp_drawable_has_alpha (bmint.bm_drawable->id); bmint.bm_has_alpha = gimp_drawable_has_alpha (bmint.bm_drawable->id);
if (!first_call || bmvals.bumpmap_id == -1) if (init_offsets)
{ {
gimp_drawable_offsets (bmint.bm_drawable->id, &bump_offset_x, &bump_offset_y); gimp_drawable_offsets (bmint.bm_drawable->id, &bump_offset_x, &bump_offset_y);
gimp_drawable_offsets (drawable->id, &draw_offset_x, &draw_offset_y); gimp_drawable_offsets (drawable->id, &draw_offset_x, &draw_offset_y);
...@@ -1338,9 +1338,6 @@ dialog_new_bumpmap (void) ...@@ -1338,9 +1338,6 @@ dialog_new_bumpmap (void)
bmvals.yofs = draw_offset_y - bump_offset_y; bmvals.yofs = draw_offset_y - bump_offset_y;
} }
if (first_call)
first_call = FALSE;
adj = (GtkAdjustment *) bmint.offset_adj_x; adj = (GtkAdjustment *) bmint.offset_adj_x;
if (adj) if (adj)
{ {
...@@ -1414,9 +1411,6 @@ dialog_update_preview (void) ...@@ -1414,9 +1411,6 @@ dialog_update_preview (void)
{ {
bumpmap_row (bmint.src_rows[y] + 4 * xofs, dest_row, bumpmap_row (bmint.src_rows[y] + 4 * xofs, dest_row,
bmint.preview_width, 4, TRUE, bmint.preview_width, 4, TRUE,
/* bmint.bm_rows[(y + sel_y1) % bmint.bm_height], */
/* bmint.bm_rows[(y + sel_y1 + 1) % bmint.bm_height], */
/* bmint.bm_rows[(y + sel_y1 + 2) % bmint.bm_height], */
bmint.bm_rows[y], bmint.bm_rows[y],
bmint.bm_rows[y + 1], bmint.bm_rows[y + 1],
bmint.bm_rows[y + 2], bmint.bm_rows[y + 2],
...@@ -1792,8 +1786,15 @@ static void ...@@ -1792,8 +1786,15 @@ static void
dialog_bumpmap_callback (gint32 id, dialog_bumpmap_callback (gint32 id,
gpointer data) gpointer data)
{ {
if (bmvals.bumpmap_id == id)
{
dialog_new_bumpmap (FALSE);
}
else
{
bmvals.bumpmap_id = id; bmvals.bumpmap_id = id;
dialog_new_bumpmap (); dialog_new_bumpmap (TRUE);
}
dialog_update_preview (); dialog_update_preview ();
} }
......
...@@ -398,13 +398,9 @@ load_image (gchar *filename) /* I - File to load */ ...@@ -398,13 +398,9 @@ load_image (gchar *filename) /* I - File to load */
if (setjmp (pp->jmpbuf)) if (setjmp (pp->jmpbuf))
{ {
g_message (_("%s\nPNG error. File corrupted?"), filename); g_message (_("%s\nPNG error. File corrupted?"), filename);
return image; return -1;
} }
/* initialise variables here, thus avoiding compiler warnings */
image= -1;
/* /*
* Open the file and initialize the PNG read "engine"... * Open the file and initialize the PNG read "engine"...
*/ */
......
2000-04-20 Sven Neumann <sven@gimp.org>
* de.po: updated german translation
2000-04-19 Sven Neumann <sven@gimp.org> 2000-04-19 Sven Neumann <sven@gimp.org>
* de.po: updated german translation * de.po: updated german translation
......
This diff is collapsed.
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