diff --git a/ChangeLog b/ChangeLog index a00de4b827..b0f9fa6752 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2001-01-29 Michael Natterer + + * app/channel.[ch]: removed channel_update() because channel.c + should not call gdisplays_update(). Use drawable_update() and + a subsequent gdisplays_update() instead. + + * app/qmask.c: do as described above. + + * app/channel_ops.c + * app/channels_dialog.c + * app/commands.c + * app/convert.c + * app/disp_callbacks.c + * app/equalize.c + * app/fileops.c + * app/floating_sel.c + * app/gdisplay.c + * app/gimage.c + * app/gimage_mask.c + * app/gimpdnd.c + * app/gimpdrawablepreview.c + * app/gimphistogram.c + * app/gimplayermask.c + * app/global_edit.c + * app/histogramwidget.c + * app/histogramwidget.h + * app/image_map.c + * app/image_new.c + * app/invert.c + * app/layer.c + * app/layer_select.c + * app/paths_dialog.c + * app/plug_in.c + * app/scan_convert.c + * app/undo_history.c + * app/xcf.c: include gimpdrawable.h instead of drawable.h where + possible, removed useless includes, minor other cleanups. + 2001-01-29 Michael Natterer * app/Makefile.am diff --git a/app/actions/help-commands.c b/app/actions/help-commands.c index 38474c3c47..0cd423fd73 100644 --- a/app/actions/help-commands.c +++ b/app/actions/help-commands.c @@ -41,7 +41,6 @@ #include "devices.h" #include "docindex.h" #include "channel_ops.h" -#include "drawable.h" #include "equalize.h" #include "errorconsole.h" #include "fileops.h" @@ -49,6 +48,7 @@ #include "gdisplay_ops.h" #include "gimage_mask.h" #include "gimpcontext.h" +#include "gimpdrawable.h" #include "gimphelp.h" #include "gimpimage.h" #include "gimprc.h" diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index a57eb4132f..e5fbdba59f 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/actions/qmask-commands.c b/app/actions/qmask-commands.c index 3d078909c9..9f0d18e430 100644 --- a/app/actions/qmask-commands.c +++ b/app/actions/qmask-commands.c @@ -364,7 +364,13 @@ edit_qmask_query_ok_callback (GtkWidget *widget, if (gimp_rgba_distance (&color, &channel->color) > 0.0001) { channel->color = color; - gimp_channel_update (channel); + + drawable_update (GIMP_DRAWABLE (channel), + 0, 0, + GIMP_DRAWABLE (channel)->width, + GIMP_DRAWABLE (channel)->height); + + gdisplays_flush (); } } diff --git a/app/actions/quick-mask-commands.c b/app/actions/quick-mask-commands.c index 3d078909c9..9f0d18e430 100644 --- a/app/actions/quick-mask-commands.c +++ b/app/actions/quick-mask-commands.c @@ -364,7 +364,13 @@ edit_qmask_query_ok_callback (GtkWidget *widget, if (gimp_rgba_distance (&color, &channel->color) > 0.0001) { channel->color = color; - gimp_channel_update (channel); + + drawable_update (GIMP_DRAWABLE (channel), + 0, 0, + GIMP_DRAWABLE (channel)->width, + GIMP_DRAWABLE (channel)->height); + + gdisplays_flush (); } } diff --git a/app/base/gimphistogram.c b/app/base/gimphistogram.c index ad78e67b29..294abbd4c3 100644 --- a/app/base/gimphistogram.c +++ b/app/base/gimphistogram.c @@ -31,21 +31,20 @@ #include "apptypes.h" -#include "drawable.h" -#include "gimphistogram.h" -#include "pixel_region.h" -#include "gimpdrawable.h" #include "channel.h" +#include "gimpdrawable.h" +#include "gimphistogram.h" #include "gimpimage.h" #include "gimprc.h" #include "pixel_processor.h" +#include "pixel_region.h" struct _GimpHistogram { gint bins; gdouble **values; - gint nchannels; + gint n_channels; #ifdef ENABLE_MP pthread_mutex_t mutex; @@ -62,9 +61,9 @@ gimp_histogram_new (void) GimpHistogram *histogram; histogram = g_new0 (GimpHistogram, 1); - histogram->bins = 0; - histogram->values = NULL; - histogram->nchannels = 0; + histogram->bins = 0; + histogram->values = NULL; + histogram->n_channels = 0; #ifdef ENABLE_MP histogram->nthreads = 0; @@ -82,7 +81,7 @@ gimp_histogram_free (GimpHistogram *histogram) if (histogram->values) { - for (i = 0; i < histogram->nchannels; i++) + for (i = 0; i < histogram->n_channels; i++) g_free (histogram->values[i]); g_free (histogram->values); } @@ -274,19 +273,19 @@ gimp_histogram_alloc (GimpHistogram *histogram, { gint i; - if (bytes + 1 != histogram->nchannels) + if (bytes + 1 != histogram->n_channels) { if (histogram->values) { - for (i = 0; i < histogram->nchannels; i++) + for (i = 0; i < histogram->n_channels; i++) g_free (histogram->values[i]); g_free (histogram->values); } - histogram->nchannels = bytes + 1; - histogram->values = g_new0 (gdouble *, histogram->nchannels); + histogram->n_channels = bytes + 1; + histogram->values = g_new0 (gdouble *, histogram->n_channels); - for (i = 0; i < histogram->nchannels; i++) + for (i = 0; i < histogram->n_channels; i++) histogram->values[i] = g_new (double, 256); } } @@ -310,10 +309,10 @@ gimp_histogram_calculate (GimpHistogram *histogram, for (i = 0; i < num_processors; i++) { - histogram->tmp_values[i] = g_new0 (double *, histogram->nchannels); + histogram->tmp_values[i] = g_new0 (double *, histogram->n_channels); histogram->tmp_slots[i] = 0; - for (j = 0; j < histogram->nchannels; j++) + for (j = 0; j < histogram->n_channels; j++) { histogram->tmp_values[i][j] = g_new0 (gdouble, 256); @@ -323,7 +322,7 @@ gimp_histogram_calculate (GimpHistogram *histogram, } #endif - for (i = 0; i < histogram->nchannels; i++) + for (i = 0; i < histogram->n_channels; i++) for (j = 0; j < 256; j++) histogram->values[i][j] = 0.0; @@ -334,7 +333,7 @@ gimp_histogram_calculate (GimpHistogram *histogram, /* add up all the tmp buffers and free their memmory */ for (i = 0; i < num_processors; i++) { - for (j = 0; j < histogram->nchannels; j++) + for (j = 0; j < histogram->n_channels; j++) { for (k = 0; k < 256; k++) histogram->values[j][k] += histogram->tmp_values[i][j][k]; @@ -401,7 +400,7 @@ gimp_histogram_get_value (GimpHistogram *histogram, GimpHistogramChannel channel, gint bin) { - if (channel < histogram->nchannels && bin >= 0 && bin < 256) + if (channel < histogram->n_channels && bin >= 0 && bin < 256) return histogram->values[channel][bin]; return 0.0; @@ -412,7 +411,7 @@ gimp_histogram_get_channel (GimpHistogram *histogram, GimpHistogramChannel channel, gint bin) { - if (histogram->nchannels > 3) + if (histogram->n_channels > 3) return gimp_histogram_get_value (histogram, channel + 1, bin); else return gimp_histogram_get_value (histogram, channel , bin); @@ -421,7 +420,7 @@ gimp_histogram_get_channel (GimpHistogram *histogram, gint gimp_histogram_nchannels (GimpHistogram *histogram) { - return histogram->nchannels - 1; + return histogram->n_channels - 1; } gdouble diff --git a/app/channel.c b/app/channel.c index f7f58021b3..05afaed44d 100644 --- a/app/channel.c +++ b/app/channel.c @@ -32,7 +32,6 @@ #include "boundary.h" #include "channel.h" #include "drawable.h" -#include "gdisplay.h" #include "gimpimage.h" #include "gimage_mask.h" #include "gimppreviewcache.h" @@ -415,20 +414,6 @@ gimp_channel_resize (GimpChannel *channel, GIMP_DRAWABLE (channel)->height); } -void -gimp_channel_update (GimpChannel *channel) -{ - drawable_update (GIMP_DRAWABLE (channel), - 0, 0, - GIMP_DRAWABLE (channel)->width, - GIMP_DRAWABLE (channel)->height); - gdisplays_flush (); -} - -/**********************/ -/* access functions */ -/**********************/ - gboolean gimp_channel_toggle_visibility (GimpChannel *channel) { @@ -437,6 +422,7 @@ gimp_channel_toggle_visibility (GimpChannel *channel) return GIMP_DRAWABLE (channel)->visible; } + /******************************/ /* selection mask functions */ /******************************/ diff --git a/app/channel.h b/app/channel.h index cbbd7ab18c..bb0ebcec15 100644 --- a/app/channel.h +++ b/app/channel.h @@ -108,7 +108,6 @@ void gimp_channel_resize (GimpChannel *channel, gint new_height, gint offx, gint offy); -void gimp_channel_update (GimpChannel *channel); gboolean gimp_channel_toggle_visibility (GimpChannel *channel); diff --git a/app/channel_ops.c b/app/channel_ops.c index 6b693844cc..06b765b30f 100644 --- a/app/channel_ops.c +++ b/app/channel_ops.c @@ -486,17 +486,20 @@ offset (GimpImage *gimage, } /* push an undo */ - drawable_apply_image (drawable, 0, 0, + drawable_apply_image (drawable, + 0, 0, gimp_drawable_width (drawable), gimp_drawable_height (drawable), - gimp_drawable_data (drawable), FALSE); + gimp_drawable_data (drawable), + FALSE); /* swap the tiles */ drawable->tiles = new_tiles; /* update the drawable */ - drawable_update (drawable, 0, 0, + drawable_update (drawable, + 0, 0, gimp_drawable_width (drawable), gimp_drawable_height (drawable)); } @@ -512,8 +515,8 @@ offset_ok_callback (GtkWidget *widget, OffsetDialog *off_d; GImage *gimage; GimpDrawable *drawable; - gint offset_x; - gint offset_y; + gint offset_x; + gint offset_y; off_d = (OffsetDialog *) data; diff --git a/app/channels_dialog.c b/app/channels_dialog.c index fe0f30daf3..8a0a06dba5 100644 --- a/app/channels_dialog.c +++ b/app/channels_dialog.c @@ -1772,9 +1772,11 @@ channel_widget_drop_color (GtkWidget *widget, { channel->color = *color; - drawable_update (GIMP_DRAWABLE (channel), 0, 0, + drawable_update (GIMP_DRAWABLE (channel), + 0, 0, GIMP_DRAWABLE (channel)->width, GIMP_DRAWABLE (channel)->height); + gdisplays_flush (); } } @@ -2680,9 +2682,12 @@ edit_channel_query_ok_callback (GtkWidget *widget, if (gimp_rgba_distance (&color, &channel->color) > 0.0001) { channel->color = color; - drawable_update (GIMP_DRAWABLE (channel), 0, 0, + + drawable_update (GIMP_DRAWABLE (channel), + 0, 0, GIMP_DRAWABLE (channel)->width, GIMP_DRAWABLE (channel)->height); + gdisplays_flush (); } } diff --git a/app/commands.c b/app/commands.c index 38474c3c47..0cd423fd73 100644 --- a/app/commands.c +++ b/app/commands.c @@ -41,7 +41,6 @@ #include "devices.h" #include "docindex.h" #include "channel_ops.h" -#include "drawable.h" #include "equalize.h" #include "errorconsole.h" #include "fileops.h" @@ -49,6 +48,7 @@ #include "gdisplay_ops.h" #include "gimage_mask.h" #include "gimpcontext.h" +#include "gimpdrawable.h" #include "gimphelp.h" #include "gimpimage.h" #include "gimprc.h" diff --git a/app/convert.c b/app/convert.c index 62e3835fd5..568cec64f8 100644 --- a/app/convert.c +++ b/app/convert.c @@ -99,18 +99,18 @@ #include "convert.h" #include "cursorutil.h" -#include "drawable.h" #include "floating_sel.h" #include "fsdither.h" #include "gdisplay.h" +#include "gimpdrawable.h" #include "gimpimage.h" -#include "layer.h" -#include "undo.h" -#include "palette.h" #include "gimppalette.h" +#include "layer.h" +#include "palette.h" #include "palette_select.h" #include "pixel_region.h" #include "tile_manager.h" +#include "undo.h" #include "tools/brightness_contrast.h" #include "tools/color_balance.h" diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c index 621443225f..208acc7f58 100644 --- a/app/core/gimp-edit.c +++ b/app/core/gimp-edit.c @@ -26,9 +26,7 @@ #include "apptypes.h" -#include "appenv.h" #include "drawable.h" -#include "image_new.h" #include "floating_sel.h" #include "gdisplay.h" #include "gimage.h" @@ -36,6 +34,7 @@ #include "gimpcontext.h" #include "gimplayermask.h" #include "global_edit.h" +#include "image_new.h" #include "layer.h" #include "paint_funcs.h" #include "pixel_region.h" @@ -446,7 +445,9 @@ edit_clear (GimpImage *gimage, ERASE_MODE, NULL, x1, y1); /* update the image */ - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); /* free the temporary tiles */ tile_manager_destroy (buf_tiles); @@ -518,7 +519,9 @@ edit_fill (GimpImage *gimage, NORMAL_MODE, NULL, x1, y1); /* update the image */ - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); /* free the temporary tiles */ tile_manager_destroy (buf_tiles); diff --git a/app/core/gimpchannel-combine.c b/app/core/gimpchannel-combine.c index f7f58021b3..05afaed44d 100644 --- a/app/core/gimpchannel-combine.c +++ b/app/core/gimpchannel-combine.c @@ -32,7 +32,6 @@ #include "boundary.h" #include "channel.h" #include "drawable.h" -#include "gdisplay.h" #include "gimpimage.h" #include "gimage_mask.h" #include "gimppreviewcache.h" @@ -415,20 +414,6 @@ gimp_channel_resize (GimpChannel *channel, GIMP_DRAWABLE (channel)->height); } -void -gimp_channel_update (GimpChannel *channel) -{ - drawable_update (GIMP_DRAWABLE (channel), - 0, 0, - GIMP_DRAWABLE (channel)->width, - GIMP_DRAWABLE (channel)->height); - gdisplays_flush (); -} - -/**********************/ -/* access functions */ -/**********************/ - gboolean gimp_channel_toggle_visibility (GimpChannel *channel) { @@ -437,6 +422,7 @@ gimp_channel_toggle_visibility (GimpChannel *channel) return GIMP_DRAWABLE (channel)->visible; } + /******************************/ /* selection mask functions */ /******************************/ diff --git a/app/core/gimpchannel-combine.h b/app/core/gimpchannel-combine.h index cbbd7ab18c..bb0ebcec15 100644 --- a/app/core/gimpchannel-combine.h +++ b/app/core/gimpchannel-combine.h @@ -108,7 +108,6 @@ void gimp_channel_resize (GimpChannel *channel, gint new_height, gint offx, gint offy); -void gimp_channel_update (GimpChannel *channel); gboolean gimp_channel_toggle_visibility (GimpChannel *channel); diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c index f7f58021b3..05afaed44d 100644 --- a/app/core/gimpchannel.c +++ b/app/core/gimpchannel.c @@ -32,7 +32,6 @@ #include "boundary.h" #include "channel.h" #include "drawable.h" -#include "gdisplay.h" #include "gimpimage.h" #include "gimage_mask.h" #include "gimppreviewcache.h" @@ -415,20 +414,6 @@ gimp_channel_resize (GimpChannel *channel, GIMP_DRAWABLE (channel)->height); } -void -gimp_channel_update (GimpChannel *channel) -{ - drawable_update (GIMP_DRAWABLE (channel), - 0, 0, - GIMP_DRAWABLE (channel)->width, - GIMP_DRAWABLE (channel)->height); - gdisplays_flush (); -} - -/**********************/ -/* access functions */ -/**********************/ - gboolean gimp_channel_toggle_visibility (GimpChannel *channel) { @@ -437,6 +422,7 @@ gimp_channel_toggle_visibility (GimpChannel *channel) return GIMP_DRAWABLE (channel)->visible; } + /******************************/ /* selection mask functions */ /******************************/ diff --git a/app/core/gimpchannel.h b/app/core/gimpchannel.h index cbbd7ab18c..bb0ebcec15 100644 --- a/app/core/gimpchannel.h +++ b/app/core/gimpchannel.h @@ -108,7 +108,6 @@ void gimp_channel_resize (GimpChannel *channel, gint new_height, gint offx, gint offy); -void gimp_channel_update (GimpChannel *channel); gboolean gimp_channel_toggle_visibility (GimpChannel *channel); diff --git a/app/core/gimpdrawable-equalize.c b/app/core/gimpdrawable-equalize.c index 204d5fd0ff..6aa18c4780 100644 --- a/app/core/gimpdrawable-equalize.c +++ b/app/core/gimpdrawable-equalize.c @@ -73,7 +73,6 @@ equalize (GimpImage *gimage, hist = gimp_histogram_new (); gimp_histogram_calculate_drawable (hist, drawable); - /* Build equalization LUT */ lut = eq_histogram_lut_new (hist, bytes); @@ -92,5 +91,8 @@ equalize (GimpImage *gimage, gimp_histogram_free (hist); gimp_drawable_merge_shadow (drawable, TRUE); - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); } diff --git a/app/core/gimpdrawable-invert.c b/app/core/gimpdrawable-invert.c index 37fa634cdb..3aec2819b9 100644 --- a/app/core/gimpdrawable-invert.c +++ b/app/core/gimpdrawable-invert.c @@ -22,11 +22,10 @@ #include "apptypes.h" -#include "appenv.h" #include "drawable.h" -#include "invert.h" #include "gimpimage.h" #include "gimplut.h" +#include "invert.h" #include "lut_funcs.h" #include "pixel_processor.h" #include "pixel_region.h" @@ -40,8 +39,8 @@ void image_invert (GimpImage *gimage) { GimpDrawable *drawable; - Argument *return_vals; - gint nreturn_vals; + Argument *return_vals; + gint nreturn_vals; drawable = gimp_image_active_drawable (gimage); @@ -69,9 +68,9 @@ image_invert (GimpImage *gimage) void invert (GimpDrawable *drawable) { - PixelRegion srcPR, destPR; - gint x1, y1, x2, y2; - GimpLut *lut; + PixelRegion srcPR, destPR; + gint x1, y1, x2, y2; + GimpLut *lut; lut = invert_lut_new (gimp_drawable_bytes (drawable)); @@ -87,5 +86,8 @@ invert (GimpDrawable *drawable) gimp_lut_free (lut); gimp_drawable_merge_shadow (drawable, TRUE); - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); } diff --git a/app/core/gimpdrawable-offset.c b/app/core/gimpdrawable-offset.c index 6b693844cc..06b765b30f 100644 --- a/app/core/gimpdrawable-offset.c +++ b/app/core/gimpdrawable-offset.c @@ -486,17 +486,20 @@ offset (GimpImage *gimage, } /* push an undo */ - drawable_apply_image (drawable, 0, 0, + drawable_apply_image (drawable, + 0, 0, gimp_drawable_width (drawable), gimp_drawable_height (drawable), - gimp_drawable_data (drawable), FALSE); + gimp_drawable_data (drawable), + FALSE); /* swap the tiles */ drawable->tiles = new_tiles; /* update the drawable */ - drawable_update (drawable, 0, 0, + drawable_update (drawable, + 0, 0, gimp_drawable_width (drawable), gimp_drawable_height (drawable)); } @@ -512,8 +515,8 @@ offset_ok_callback (GtkWidget *widget, OffsetDialog *off_d; GImage *gimage; GimpDrawable *drawable; - gint offset_x; - gint offset_y; + gint offset_x; + gint offset_y; off_d = (OffsetDialog *) data; diff --git a/app/core/gimpedit.c b/app/core/gimpedit.c index 621443225f..208acc7f58 100644 --- a/app/core/gimpedit.c +++ b/app/core/gimpedit.c @@ -26,9 +26,7 @@ #include "apptypes.h" -#include "appenv.h" #include "drawable.h" -#include "image_new.h" #include "floating_sel.h" #include "gdisplay.h" #include "gimage.h" @@ -36,6 +34,7 @@ #include "gimpcontext.h" #include "gimplayermask.h" #include "global_edit.h" +#include "image_new.h" #include "layer.h" #include "paint_funcs.h" #include "pixel_region.h" @@ -446,7 +445,9 @@ edit_clear (GimpImage *gimage, ERASE_MODE, NULL, x1, y1); /* update the image */ - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); /* free the temporary tiles */ tile_manager_destroy (buf_tiles); @@ -518,7 +519,9 @@ edit_fill (GimpImage *gimage, NORMAL_MODE, NULL, x1, y1); /* update the image */ - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); /* free the temporary tiles */ tile_manager_destroy (buf_tiles); diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c index 62e3835fd5..568cec64f8 100644 --- a/app/core/gimpimage-convert.c +++ b/app/core/gimpimage-convert.c @@ -99,18 +99,18 @@ #include "convert.h" #include "cursorutil.h" -#include "drawable.h" #include "floating_sel.h" #include "fsdither.h" #include "gdisplay.h" +#include "gimpdrawable.h" #include "gimpimage.h" -#include "layer.h" -#include "undo.h" -#include "palette.h" #include "gimppalette.h" +#include "layer.h" +#include "palette.h" #include "palette_select.h" #include "pixel_region.h" #include "tile_manager.h" +#include "undo.h" #include "tools/brightness_contrast.h" #include "tools/color_balance.h" diff --git a/app/core/gimpimage-duplicate.c b/app/core/gimpimage-duplicate.c index 6b693844cc..06b765b30f 100644 --- a/app/core/gimpimage-duplicate.c +++ b/app/core/gimpimage-duplicate.c @@ -486,17 +486,20 @@ offset (GimpImage *gimage, } /* push an undo */ - drawable_apply_image (drawable, 0, 0, + drawable_apply_image (drawable, + 0, 0, gimp_drawable_width (drawable), gimp_drawable_height (drawable), - gimp_drawable_data (drawable), FALSE); + gimp_drawable_data (drawable), + FALSE); /* swap the tiles */ drawable->tiles = new_tiles; /* update the drawable */ - drawable_update (drawable, 0, 0, + drawable_update (drawable, + 0, 0, gimp_drawable_width (drawable), gimp_drawable_height (drawable)); } @@ -512,8 +515,8 @@ offset_ok_callback (GtkWidget *widget, OffsetDialog *off_d; GImage *gimage; GimpDrawable *drawable; - gint offset_x; - gint offset_y; + gint offset_x; + gint offset_y; off_d = (OffsetDialog *) data; diff --git a/app/core/gimpimage-mask.c b/app/core/gimpimage-mask.c index 171345d562..b0140354ab 100644 --- a/app/core/gimpimage-mask.c +++ b/app/core/gimpimage-mask.c @@ -22,15 +22,14 @@ #include "apptypes.h" -#include "appenv.h" #include "boundary.h" #include "channel.h" #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" +#include "gimage_mask.h" #include "gimpimage.h" #include "gimplayermask.h" -#include "gimage_mask.h" #include "gimprc.h" #include "layer.h" #include "paint_funcs.h" @@ -151,17 +150,19 @@ gimage_mask_invalidate (GImage *gimage) * mask in the composition of the floating selection */ layer = gimp_image_get_active_layer (gimage); + if (layer && gimp_layer_is_floating_sel (layer)) - drawable_update (GIMP_DRAWABLE(layer), 0, 0, - GIMP_DRAWABLE(layer)->width, - GIMP_DRAWABLE(layer)->height); + drawable_update (GIMP_DRAWABLE (layer), + 0, 0, + GIMP_DRAWABLE (layer)->width, + GIMP_DRAWABLE (layer)->height); } gint gimage_mask_value (GImage *gimage, - int x, - int y) + gint x, + gint y) { return gimp_channel_value (gimp_image_get_mask (gimage), x, y); } diff --git a/app/core/gimpimage-qmask.c b/app/core/gimpimage-qmask.c index 3d078909c9..9f0d18e430 100644 --- a/app/core/gimpimage-qmask.c +++ b/app/core/gimpimage-qmask.c @@ -364,7 +364,13 @@ edit_qmask_query_ok_callback (GtkWidget *widget, if (gimp_rgba_distance (&color, &channel->color) > 0.0001) { channel->color = color; - gimp_channel_update (channel); + + drawable_update (GIMP_DRAWABLE (channel), + 0, 0, + GIMP_DRAWABLE (channel)->width, + GIMP_DRAWABLE (channel)->height); + + gdisplays_flush (); } } diff --git a/app/core/gimpimage-quick-mask.c b/app/core/gimpimage-quick-mask.c index 3d078909c9..9f0d18e430 100644 --- a/app/core/gimpimage-quick-mask.c +++ b/app/core/gimpimage-quick-mask.c @@ -364,7 +364,13 @@ edit_qmask_query_ok_callback (GtkWidget *widget, if (gimp_rgba_distance (&color, &channel->color) > 0.0001) { channel->color = color; - gimp_channel_update (channel); + + drawable_update (GIMP_DRAWABLE (channel), + 0, 0, + GIMP_DRAWABLE (channel)->width, + GIMP_DRAWABLE (channel)->height); + + gdisplays_flush (); } } diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c index fb1e2defb5..c5969f2636 100644 --- a/app/core/gimpimagemap.c +++ b/app/core/gimpimagemap.c @@ -22,10 +22,10 @@ #include "apptypes.h" -#include "appenv.h" #include "drawable.h" #include "gdisplay.h" #include "gimage_mask.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "image_map.h" #include "paint_funcs.h" diff --git a/app/core/gimplayer-floating-sel.c b/app/core/gimplayer-floating-sel.c index 0bd25f85f8..c59cc5aee2 100644 --- a/app/core/gimplayer-floating-sel.c +++ b/app/core/gimplayer-floating-sel.c @@ -24,15 +24,14 @@ #include "apptypes.h" -#include "appenv.h" #include "boundary.h" #include "drawable.h" -#include "layer.h" #include "floating_sel.h" #include "gdisplay.h" #include "gimage_mask.h" #include "gimpimage.h" #include "gimplayermask.h" +#include "layer.h" #include "paint_funcs.h" #include "pixel_region.h" #include "tile_manager.h" diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index c512de53e7..526a77fdc8 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -583,7 +583,8 @@ gimp_layer_translate (GimpLayer *layer, undo_push_layer_displace (GIMP_DRAWABLE (layer)->gimage, layer); /* update the affected region */ - drawable_update (GIMP_DRAWABLE (layer), 0, 0, + drawable_update (GIMP_DRAWABLE (layer), + 0, 0, GIMP_DRAWABLE (layer)->width, GIMP_DRAWABLE (layer)->height); @@ -606,8 +607,7 @@ gimp_layer_translate (GimpLayer *layer, GIMP_DRAWABLE (layer->mask)->offset_y += off_y; /* invalidate the mask preview */ - gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask), - FALSE); + gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask), FALSE); } } @@ -947,7 +947,8 @@ gimp_layer_resize (GimpLayer *layer, /* Update the old layer position */ drawable_update (GIMP_DRAWABLE( layer), 0, 0, - GIMP_DRAWABLE (layer)->width, GIMP_DRAWABLE (layer)->height); + GIMP_DRAWABLE (layer)->width, + GIMP_DRAWABLE (layer)->height); /* Configure the pixel regions */ pixel_region_init (&srcPR, GIMP_DRAWABLE (layer)->tiles, @@ -1014,7 +1015,8 @@ gimp_layer_resize (GimpLayer *layer, /* update the new layer area */ drawable_update (GIMP_DRAWABLE (layer), 0, 0, - GIMP_DRAWABLE (layer)->width, GIMP_DRAWABLE (layer)->height); + GIMP_DRAWABLE (layer)->width, + GIMP_DRAWABLE (layer)->height); } void @@ -1105,7 +1107,6 @@ gimp_layer_invalidate_boundary (GimpLayer *layer) GimpImage *gimage; GimpChannel *mask; - /* first get the selection mask channel */ if (! (gimage = gimp_drawable_gimage (GIMP_DRAWABLE (layer)))) return; @@ -1115,6 +1116,7 @@ gimp_layer_invalidate_boundary (GimpLayer *layer) /* clear the affected region surrounding the layer */ gdisplays_selection_visibility (gimage, SelectionLayerOff); + /* get the selection mask channel */ mask = gimp_image_get_mask (gimage); /* Only bother with the bounds if there is a selection */ diff --git a/app/core/gimplayermask.c b/app/core/gimplayermask.c index 219cd6a84e..1c32050185 100644 --- a/app/core/gimplayermask.c +++ b/app/core/gimplayermask.c @@ -28,30 +28,22 @@ #include "apptypes.h" #include "boundary.h" -#include "drawable.h" -#include "floating_sel.h" -#include "gdisplay.h" -#include "gimage_mask.h" -#include "gimpimage.h" #include "gimplayermask.h" -#include "gimppreviewcache.h" -#include "layer.h" -#include "parasitelist.h" #include "paint_funcs.h" #include "pixel_region.h" -#include "undo.h" #include "temp_buf.h" #include "tile_manager.h" #include "tile.h" +#include "undo.h" #include "libgimp/gimpparasite.h" #include "libgimp/gimpintl.h" -static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass); -static void gimp_layer_mask_init (GimpLayerMask *layermask); -static void gimp_layer_mask_destroy (GtkObject *object); +static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass); +static void gimp_layer_mask_init (GimpLayerMask *layermask); +static void gimp_layer_mask_destroy (GtkObject *object); static GimpChannelClass *parent_class = NULL; diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index d4b7944a43..9072e9fc50 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -32,12 +32,12 @@ #include "colormaps.h" #include "cursorutil.h" #include "disp_callbacks.h" -#include "drawable.h" #include "draw_core.h" #include "gdisplay.h" #include "gdisplay_ops.h" #include "gimage.h" #include "gimage_mask.h" +#include "gimpdrawable.h" #include "gimpcontext.h" #include "gimprc.h" #include "gximage.h" diff --git a/app/core/gimpscanconvert.c b/app/core/gimpscanconvert.c index dead5cfe53..3bc06790c4 100644 --- a/app/core/gimpscanconvert.c +++ b/app/core/gimpscanconvert.c @@ -27,7 +27,7 @@ #include "apptypes.h" #include "channel.h" -#include "drawable.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "pixel_region.h" #include "scan_convert.h" @@ -288,9 +288,9 @@ scan_converter_to_channel (ScanConverter *sc, TRC (("\n")); } - pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE(mask)), 0, 0, - gimp_drawable_width (GIMP_DRAWABLE(mask)), - gimp_drawable_height (GIMP_DRAWABLE(mask)), TRUE); + pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE (mask)), 0, 0, + gimp_drawable_width (GIMP_DRAWABLE (mask)), + gimp_drawable_height (GIMP_DRAWABLE (mask)), TRUE); for (i = 0; i < heighta; i++) { diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c index e145df5a39..a6ca60505b 100644 --- a/app/disp_callbacks.c +++ b/app/disp_callbacks.c @@ -32,10 +32,10 @@ #include "devices.h" #include "dialog_handler.h" #include "disp_callbacks.h" +#include "drawable.h" #include "gdisplay.h" #include "gimpimage.h" #include "gimpcontext.h" -#include "drawable.h" #include "gimprc.h" #include "info_window.h" #include "layer.h" @@ -62,25 +62,29 @@ static void gdisplay_check_device_cursor (GDisplay *gdisp); static void -redraw (GDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) +gdisplay_redraw (GDisplay *gdisp, + gint x, + gint y, + gint w, + gint h) { glong x1, y1, x2, y2; /* coordinate of rectangle corners */ x1 = x; y1 = y; - x2 = (x+w); - y2 = (y+h); + x2 = (x + w); + y2 = (y + h); + x1 = CLAMP (x1, 0, gdisp->disp_width); y1 = CLAMP (y1, 0, gdisp->disp_height); x2 = CLAMP (x2, 0, gdisp->disp_width); y2 = CLAMP (y2, 0, gdisp->disp_height); + if ((x2 - x1) && (y2 - y1)) { - gdisplay_expose_area (gdisp, x1, y1, (x2 - x1), (y2 - y1)); + gdisplay_expose_area (gdisp, + x1, y1, + (x2 - x1), (y2 - y1)); gdisplay_flush_displays_only (gdisp); } } @@ -202,8 +206,9 @@ gdisplay_canvas_events (GtkWidget *canvas, eevent = (GdkEventExpose *) event; /*printf(" EXP:%d,%d(%dx%d) ",eevent->area.x, eevent->area.y, eevent->area.width, eevent->area.height);fflush(stdout);*/ - redraw (gdisp, eevent->area.x, eevent->area.y, - eevent->area.width, eevent->area.height); + gdisplay_redraw (gdisp, + eevent->area.x, eevent->area.y, + eevent->area.width, eevent->area.height); break; case GDK_CONFIGURE: @@ -982,7 +987,9 @@ gdisplay_bucket_fill (GtkWidget *widget, tile_manager_destroy (buf_tiles); /* Update the displays */ - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); gdisplays_flush (); if (new_buf) diff --git a/app/display/gimpdisplay-callbacks.c b/app/display/gimpdisplay-callbacks.c index e145df5a39..a6ca60505b 100644 --- a/app/display/gimpdisplay-callbacks.c +++ b/app/display/gimpdisplay-callbacks.c @@ -32,10 +32,10 @@ #include "devices.h" #include "dialog_handler.h" #include "disp_callbacks.h" +#include "drawable.h" #include "gdisplay.h" #include "gimpimage.h" #include "gimpcontext.h" -#include "drawable.h" #include "gimprc.h" #include "info_window.h" #include "layer.h" @@ -62,25 +62,29 @@ static void gdisplay_check_device_cursor (GDisplay *gdisp); static void -redraw (GDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) +gdisplay_redraw (GDisplay *gdisp, + gint x, + gint y, + gint w, + gint h) { glong x1, y1, x2, y2; /* coordinate of rectangle corners */ x1 = x; y1 = y; - x2 = (x+w); - y2 = (y+h); + x2 = (x + w); + y2 = (y + h); + x1 = CLAMP (x1, 0, gdisp->disp_width); y1 = CLAMP (y1, 0, gdisp->disp_height); x2 = CLAMP (x2, 0, gdisp->disp_width); y2 = CLAMP (y2, 0, gdisp->disp_height); + if ((x2 - x1) && (y2 - y1)) { - gdisplay_expose_area (gdisp, x1, y1, (x2 - x1), (y2 - y1)); + gdisplay_expose_area (gdisp, + x1, y1, + (x2 - x1), (y2 - y1)); gdisplay_flush_displays_only (gdisp); } } @@ -202,8 +206,9 @@ gdisplay_canvas_events (GtkWidget *canvas, eevent = (GdkEventExpose *) event; /*printf(" EXP:%d,%d(%dx%d) ",eevent->area.x, eevent->area.y, eevent->area.width, eevent->area.height);fflush(stdout);*/ - redraw (gdisp, eevent->area.x, eevent->area.y, - eevent->area.width, eevent->area.height); + gdisplay_redraw (gdisp, + eevent->area.x, eevent->area.y, + eevent->area.width, eevent->area.height); break; case GDK_CONFIGURE: @@ -982,7 +987,9 @@ gdisplay_bucket_fill (GtkWidget *widget, tile_manager_destroy (buf_tiles); /* Update the displays */ - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); gdisplays_flush (); if (new_buf) diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index d4b7944a43..9072e9fc50 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -32,12 +32,12 @@ #include "colormaps.h" #include "cursorutil.h" #include "disp_callbacks.h" -#include "drawable.h" #include "draw_core.h" #include "gdisplay.h" #include "gdisplay_ops.h" #include "gimage.h" #include "gimage_mask.h" +#include "gimpdrawable.h" #include "gimpcontext.h" #include "gimprc.h" #include "gximage.h" diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c index e145df5a39..a6ca60505b 100644 --- a/app/display/gimpdisplayshell-callbacks.c +++ b/app/display/gimpdisplayshell-callbacks.c @@ -32,10 +32,10 @@ #include "devices.h" #include "dialog_handler.h" #include "disp_callbacks.h" +#include "drawable.h" #include "gdisplay.h" #include "gimpimage.h" #include "gimpcontext.h" -#include "drawable.h" #include "gimprc.h" #include "info_window.h" #include "layer.h" @@ -62,25 +62,29 @@ static void gdisplay_check_device_cursor (GDisplay *gdisp); static void -redraw (GDisplay *gdisp, - gint x, - gint y, - gint w, - gint h) +gdisplay_redraw (GDisplay *gdisp, + gint x, + gint y, + gint w, + gint h) { glong x1, y1, x2, y2; /* coordinate of rectangle corners */ x1 = x; y1 = y; - x2 = (x+w); - y2 = (y+h); + x2 = (x + w); + y2 = (y + h); + x1 = CLAMP (x1, 0, gdisp->disp_width); y1 = CLAMP (y1, 0, gdisp->disp_height); x2 = CLAMP (x2, 0, gdisp->disp_width); y2 = CLAMP (y2, 0, gdisp->disp_height); + if ((x2 - x1) && (y2 - y1)) { - gdisplay_expose_area (gdisp, x1, y1, (x2 - x1), (y2 - y1)); + gdisplay_expose_area (gdisp, + x1, y1, + (x2 - x1), (y2 - y1)); gdisplay_flush_displays_only (gdisp); } } @@ -202,8 +206,9 @@ gdisplay_canvas_events (GtkWidget *canvas, eevent = (GdkEventExpose *) event; /*printf(" EXP:%d,%d(%dx%d) ",eevent->area.x, eevent->area.y, eevent->area.width, eevent->area.height);fflush(stdout);*/ - redraw (gdisp, eevent->area.x, eevent->area.y, - eevent->area.width, eevent->area.height); + gdisplay_redraw (gdisp, + eevent->area.x, eevent->area.y, + eevent->area.width, eevent->area.height); break; case GDK_CONFIGURE: @@ -982,7 +987,9 @@ gdisplay_bucket_fill (GtkWidget *widget, tile_manager_destroy (buf_tiles); /* Update the displays */ - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); gdisplays_flush (); if (new_buf) diff --git a/app/display/gimpdisplayshell-layer-select.c b/app/display/gimpdisplayshell-layer-select.c index b2049bcf2b..38e4d00752 100644 --- a/app/display/gimpdisplayshell-layer-select.c +++ b/app/display/gimpdisplayshell-layer-select.c @@ -23,9 +23,8 @@ #include "apptypes.h" -#include "appenv.h" -#include "drawable.h" #include "gdisplay.h" +#include "gimpdrawable.h" #include "gimpdrawablepreview.h" #include "gimpimage.h" #include "gimprc.h" diff --git a/app/display/gimpdisplayshell-qmask.c b/app/display/gimpdisplayshell-qmask.c index 3d078909c9..9f0d18e430 100644 --- a/app/display/gimpdisplayshell-qmask.c +++ b/app/display/gimpdisplayshell-qmask.c @@ -364,7 +364,13 @@ edit_qmask_query_ok_callback (GtkWidget *widget, if (gimp_rgba_distance (&color, &channel->color) > 0.0001) { channel->color = color; - gimp_channel_update (channel); + + drawable_update (GIMP_DRAWABLE (channel), + 0, 0, + GIMP_DRAWABLE (channel)->width, + GIMP_DRAWABLE (channel)->height); + + gdisplays_flush (); } } diff --git a/app/equalize.c b/app/equalize.c index 204d5fd0ff..6aa18c4780 100644 --- a/app/equalize.c +++ b/app/equalize.c @@ -73,7 +73,6 @@ equalize (GimpImage *gimage, hist = gimp_histogram_new (); gimp_histogram_calculate_drawable (hist, drawable); - /* Build equalization LUT */ lut = eq_histogram_lut_new (hist, bytes); @@ -92,5 +91,8 @@ equalize (GimpImage *gimage, gimp_histogram_free (hist); gimp_drawable_merge_shadow (drawable, TRUE); - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); } diff --git a/app/fileops.c b/app/fileops.c index 7ac3549f40..5641bf9094 100644 --- a/app/fileops.c +++ b/app/fileops.c @@ -70,7 +70,7 @@ #include "cursorutil.h" #include "dialog_handler.h" #include "docindex.h" -#include "drawable.h" +#include "gimpdrawable.h" #include "gdisplay.h" #include "gimage.h" #include "gimpcontext.h" diff --git a/app/floating_sel.c b/app/floating_sel.c index 0bd25f85f8..c59cc5aee2 100644 --- a/app/floating_sel.c +++ b/app/floating_sel.c @@ -24,15 +24,14 @@ #include "apptypes.h" -#include "appenv.h" #include "boundary.h" #include "drawable.h" -#include "layer.h" #include "floating_sel.h" #include "gdisplay.h" #include "gimage_mask.h" #include "gimpimage.h" #include "gimplayermask.h" +#include "layer.h" #include "paint_funcs.h" #include "pixel_region.h" #include "tile_manager.h" diff --git a/app/gdisplay.c b/app/gdisplay.c index d4b7944a43..9072e9fc50 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -32,12 +32,12 @@ #include "colormaps.h" #include "cursorutil.h" #include "disp_callbacks.h" -#include "drawable.h" #include "draw_core.h" #include "gdisplay.h" #include "gdisplay_ops.h" #include "gimage.h" #include "gimage_mask.h" +#include "gimpdrawable.h" #include "gimpcontext.h" #include "gimprc.h" #include "gximage.h" diff --git a/app/gimage.c b/app/gimage.c index ac2382f1c6..50b1857aa1 100644 --- a/app/gimage.c +++ b/app/gimage.c @@ -25,13 +25,13 @@ #include "appenv.h" #include "channel.h" #include "dialog_handler.h" -#include "drawable.h" +#include "gdisplay.h" #include "gimage.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpset.h" #include "layer.h" #include "lc_dialog.h" -#include "gdisplay.h" #include "paint_funcs.h" #include "palette_import.h" #include "undo.h" @@ -44,16 +44,19 @@ * layers_dialog, gdisplay, tools, etc.. */ -static void gimage_dirty_handler (GimpImage* gimage); -static void gimage_destroy_handler (GimpImage* gimage); -static void gimage_cmap_change_handler (GimpImage* gimage, +static void gimage_dirty_handler (GimpImage *gimage); +static void gimage_destroy_handler (GimpImage *gimage); +static void gimage_cmap_change_handler (GimpImage *gimage, gint ncol, gpointer user_data); -static void gimage_rename_handler (GimpImage* gimage); -static void gimage_resize_handler (GimpImage* gimage); -static void gimage_restructure_handler (GimpImage* gimage); -static void gimage_repaint_handler (GimpImage* gimage, - gint, gint, gint, gint); +static void gimage_rename_handler (GimpImage *gimage); +static void gimage_resize_handler (GimpImage *gimage); +static void gimage_restructure_handler (GimpImage *gimage); +static void gimage_repaint_handler (GimpImage *gimage, + gint x, + gint y, + gint w, + gint h); GimpImage * diff --git a/app/gimage_mask.c b/app/gimage_mask.c index 171345d562..b0140354ab 100644 --- a/app/gimage_mask.c +++ b/app/gimage_mask.c @@ -22,15 +22,14 @@ #include "apptypes.h" -#include "appenv.h" #include "boundary.h" #include "channel.h" #include "drawable.h" #include "floating_sel.h" #include "gdisplay.h" +#include "gimage_mask.h" #include "gimpimage.h" #include "gimplayermask.h" -#include "gimage_mask.h" #include "gimprc.h" #include "layer.h" #include "paint_funcs.h" @@ -151,17 +150,19 @@ gimage_mask_invalidate (GImage *gimage) * mask in the composition of the floating selection */ layer = gimp_image_get_active_layer (gimage); + if (layer && gimp_layer_is_floating_sel (layer)) - drawable_update (GIMP_DRAWABLE(layer), 0, 0, - GIMP_DRAWABLE(layer)->width, - GIMP_DRAWABLE(layer)->height); + drawable_update (GIMP_DRAWABLE (layer), + 0, 0, + GIMP_DRAWABLE (layer)->width, + GIMP_DRAWABLE (layer)->height); } gint gimage_mask_value (GImage *gimage, - int x, - int y) + gint x, + gint y) { return gimp_channel_value (gimp_image_get_mask (gimage), x, y); } diff --git a/app/gimpchannel.c b/app/gimpchannel.c index f7f58021b3..05afaed44d 100644 --- a/app/gimpchannel.c +++ b/app/gimpchannel.c @@ -32,7 +32,6 @@ #include "boundary.h" #include "channel.h" #include "drawable.h" -#include "gdisplay.h" #include "gimpimage.h" #include "gimage_mask.h" #include "gimppreviewcache.h" @@ -415,20 +414,6 @@ gimp_channel_resize (GimpChannel *channel, GIMP_DRAWABLE (channel)->height); } -void -gimp_channel_update (GimpChannel *channel) -{ - drawable_update (GIMP_DRAWABLE (channel), - 0, 0, - GIMP_DRAWABLE (channel)->width, - GIMP_DRAWABLE (channel)->height); - gdisplays_flush (); -} - -/**********************/ -/* access functions */ -/**********************/ - gboolean gimp_channel_toggle_visibility (GimpChannel *channel) { @@ -437,6 +422,7 @@ gimp_channel_toggle_visibility (GimpChannel *channel) return GIMP_DRAWABLE (channel)->visible; } + /******************************/ /* selection mask functions */ /******************************/ diff --git a/app/gimpchannel.h b/app/gimpchannel.h index cbbd7ab18c..bb0ebcec15 100644 --- a/app/gimpchannel.h +++ b/app/gimpchannel.h @@ -108,7 +108,6 @@ void gimp_channel_resize (GimpChannel *channel, gint new_height, gint offx, gint offy); -void gimp_channel_update (GimpChannel *channel); gboolean gimp_channel_toggle_visibility (GimpChannel *channel); diff --git a/app/gimpdnd.c b/app/gimpdnd.c index 91e088bb28..e64fb1c87a 100644 --- a/app/gimpdnd.c +++ b/app/gimpdnd.c @@ -27,20 +27,17 @@ #include "apptypes.h" -#include "channel.h" -#include "drawable.h" #include "fileops.h" #include "gimpimage.h" #include "gimpbrush.h" #include "gimpcontextpreview.h" #include "gimpdnd.h" #include "gimpbrushlist.h" +#include "gimpdrawable.h" #include "gimpdrawablepreview.h" -#include "gimplayermask.h" #include "gimprc.h" #include "gradient.h" #include "gradient_header.h" -#include "layer.h" #include "patterns.h" #include "temp_buf.h" diff --git a/app/gimpdrawable-equalize.c b/app/gimpdrawable-equalize.c index 204d5fd0ff..6aa18c4780 100644 --- a/app/gimpdrawable-equalize.c +++ b/app/gimpdrawable-equalize.c @@ -73,7 +73,6 @@ equalize (GimpImage *gimage, hist = gimp_histogram_new (); gimp_histogram_calculate_drawable (hist, drawable); - /* Build equalization LUT */ lut = eq_histogram_lut_new (hist, bytes); @@ -92,5 +91,8 @@ equalize (GimpImage *gimage, gimp_histogram_free (hist); gimp_drawable_merge_shadow (drawable, TRUE); - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); } diff --git a/app/gimpdrawable-invert.c b/app/gimpdrawable-invert.c index 37fa634cdb..3aec2819b9 100644 --- a/app/gimpdrawable-invert.c +++ b/app/gimpdrawable-invert.c @@ -22,11 +22,10 @@ #include "apptypes.h" -#include "appenv.h" #include "drawable.h" -#include "invert.h" #include "gimpimage.h" #include "gimplut.h" +#include "invert.h" #include "lut_funcs.h" #include "pixel_processor.h" #include "pixel_region.h" @@ -40,8 +39,8 @@ void image_invert (GimpImage *gimage) { GimpDrawable *drawable; - Argument *return_vals; - gint nreturn_vals; + Argument *return_vals; + gint nreturn_vals; drawable = gimp_image_active_drawable (gimage); @@ -69,9 +68,9 @@ image_invert (GimpImage *gimage) void invert (GimpDrawable *drawable) { - PixelRegion srcPR, destPR; - gint x1, y1, x2, y2; - GimpLut *lut; + PixelRegion srcPR, destPR; + gint x1, y1, x2, y2; + GimpLut *lut; lut = invert_lut_new (gimp_drawable_bytes (drawable)); @@ -87,5 +86,8 @@ invert (GimpDrawable *drawable) gimp_lut_free (lut); gimp_drawable_merge_shadow (drawable, TRUE); - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); } diff --git a/app/gimpdrawable-offset.c b/app/gimpdrawable-offset.c index 6b693844cc..06b765b30f 100644 --- a/app/gimpdrawable-offset.c +++ b/app/gimpdrawable-offset.c @@ -486,17 +486,20 @@ offset (GimpImage *gimage, } /* push an undo */ - drawable_apply_image (drawable, 0, 0, + drawable_apply_image (drawable, + 0, 0, gimp_drawable_width (drawable), gimp_drawable_height (drawable), - gimp_drawable_data (drawable), FALSE); + gimp_drawable_data (drawable), + FALSE); /* swap the tiles */ drawable->tiles = new_tiles; /* update the drawable */ - drawable_update (drawable, 0, 0, + drawable_update (drawable, + 0, 0, gimp_drawable_width (drawable), gimp_drawable_height (drawable)); } @@ -512,8 +515,8 @@ offset_ok_callback (GtkWidget *widget, OffsetDialog *off_d; GImage *gimage; GimpDrawable *drawable; - gint offset_x; - gint offset_y; + gint offset_x; + gint offset_y; off_d = (OffsetDialog *) data; diff --git a/app/gimpdrawablepreview.c b/app/gimpdrawablepreview.c index f56eaf9c49..2ce8e5748a 100644 --- a/app/gimpdrawablepreview.c +++ b/app/gimpdrawablepreview.c @@ -24,10 +24,10 @@ #include "apptypes.h" -#include "boundary.h" #include "channel.h" -#include "drawable.h" #include "gimpimage.h" +#include "gimpdrawable.h" +#include "gimpdrawablepreview.h" #include "gimppreviewcache.h" #include "layer.h" #include "paint_funcs.h" @@ -70,7 +70,7 @@ gimp_drawable_preview (GimpDrawable *drawable, TempBuf *tb = gimp_drawable_preview_private (drawable, PREVIEW_CACHE_PRIME_WIDTH, PREVIEW_CACHE_PRIME_HEIGHT); - + /* Save the 2nd call */ if (width == PREVIEW_CACHE_PRIME_WIDTH && height == PREVIEW_CACHE_PRIME_HEIGHT) @@ -128,6 +128,7 @@ gimp_drawable_preview_private (GimpDrawable *drawable, /* calculate 'acceptable' subsample */ subsample = 1; + /* handle some truncation errors */ if (width < 1) width = 1; if (height < 1) height = 1; @@ -296,15 +297,18 @@ gimp_drawable_preview_scale (GimpImageBaseType type, { map_to_color (2, cmap, s, rgb); - r[RED_PIX] += rgb[RED_PIX] * tot_frac; + r[RED_PIX] += rgb[RED_PIX] * tot_frac; r[GREEN_PIX] += rgb[GREEN_PIX] * tot_frac; - r[BLUE_PIX] += rgb[BLUE_PIX] * tot_frac; + r[BLUE_PIX] += rgb[BLUE_PIX] * tot_frac; + if (bytes == 4) r[ALPHA_PIX] += s[ALPHA_I_PIX] * tot_frac; } else - for (b = 0; b < bytes; b++) - r[b] += s[b] * tot_frac; + { + for (b = 0; b < bytes; b++) + r[b] += s[b] * tot_frac; + } /* increment the destination */ if (x_cum + x_rat <= (src_col + 1 + EPSILON)) @@ -313,7 +317,6 @@ gimp_drawable_preview_scale (GimpImageBaseType type, x_cum += x_rat; j--; } - /* increment the source */ else { @@ -335,7 +338,7 @@ gimp_drawable_preview_scale (GimpImageBaseType type, { b = bytes; while (b--) - *d++ = (guchar) ((*r++ * tot_frac)+0.5); + *d++ = (guchar) ((*r++ * tot_frac) + 0.5); } dest += destwidth; diff --git a/app/gimphistogram.c b/app/gimphistogram.c index ad78e67b29..294abbd4c3 100644 --- a/app/gimphistogram.c +++ b/app/gimphistogram.c @@ -31,21 +31,20 @@ #include "apptypes.h" -#include "drawable.h" -#include "gimphistogram.h" -#include "pixel_region.h" -#include "gimpdrawable.h" #include "channel.h" +#include "gimpdrawable.h" +#include "gimphistogram.h" #include "gimpimage.h" #include "gimprc.h" #include "pixel_processor.h" +#include "pixel_region.h" struct _GimpHistogram { gint bins; gdouble **values; - gint nchannels; + gint n_channels; #ifdef ENABLE_MP pthread_mutex_t mutex; @@ -62,9 +61,9 @@ gimp_histogram_new (void) GimpHistogram *histogram; histogram = g_new0 (GimpHistogram, 1); - histogram->bins = 0; - histogram->values = NULL; - histogram->nchannels = 0; + histogram->bins = 0; + histogram->values = NULL; + histogram->n_channels = 0; #ifdef ENABLE_MP histogram->nthreads = 0; @@ -82,7 +81,7 @@ gimp_histogram_free (GimpHistogram *histogram) if (histogram->values) { - for (i = 0; i < histogram->nchannels; i++) + for (i = 0; i < histogram->n_channels; i++) g_free (histogram->values[i]); g_free (histogram->values); } @@ -274,19 +273,19 @@ gimp_histogram_alloc (GimpHistogram *histogram, { gint i; - if (bytes + 1 != histogram->nchannels) + if (bytes + 1 != histogram->n_channels) { if (histogram->values) { - for (i = 0; i < histogram->nchannels; i++) + for (i = 0; i < histogram->n_channels; i++) g_free (histogram->values[i]); g_free (histogram->values); } - histogram->nchannels = bytes + 1; - histogram->values = g_new0 (gdouble *, histogram->nchannels); + histogram->n_channels = bytes + 1; + histogram->values = g_new0 (gdouble *, histogram->n_channels); - for (i = 0; i < histogram->nchannels; i++) + for (i = 0; i < histogram->n_channels; i++) histogram->values[i] = g_new (double, 256); } } @@ -310,10 +309,10 @@ gimp_histogram_calculate (GimpHistogram *histogram, for (i = 0; i < num_processors; i++) { - histogram->tmp_values[i] = g_new0 (double *, histogram->nchannels); + histogram->tmp_values[i] = g_new0 (double *, histogram->n_channels); histogram->tmp_slots[i] = 0; - for (j = 0; j < histogram->nchannels; j++) + for (j = 0; j < histogram->n_channels; j++) { histogram->tmp_values[i][j] = g_new0 (gdouble, 256); @@ -323,7 +322,7 @@ gimp_histogram_calculate (GimpHistogram *histogram, } #endif - for (i = 0; i < histogram->nchannels; i++) + for (i = 0; i < histogram->n_channels; i++) for (j = 0; j < 256; j++) histogram->values[i][j] = 0.0; @@ -334,7 +333,7 @@ gimp_histogram_calculate (GimpHistogram *histogram, /* add up all the tmp buffers and free their memmory */ for (i = 0; i < num_processors; i++) { - for (j = 0; j < histogram->nchannels; j++) + for (j = 0; j < histogram->n_channels; j++) { for (k = 0; k < 256; k++) histogram->values[j][k] += histogram->tmp_values[i][j][k]; @@ -401,7 +400,7 @@ gimp_histogram_get_value (GimpHistogram *histogram, GimpHistogramChannel channel, gint bin) { - if (channel < histogram->nchannels && bin >= 0 && bin < 256) + if (channel < histogram->n_channels && bin >= 0 && bin < 256) return histogram->values[channel][bin]; return 0.0; @@ -412,7 +411,7 @@ gimp_histogram_get_channel (GimpHistogram *histogram, GimpHistogramChannel channel, gint bin) { - if (histogram->nchannels > 3) + if (histogram->n_channels > 3) return gimp_histogram_get_value (histogram, channel + 1, bin); else return gimp_histogram_get_value (histogram, channel , bin); @@ -421,7 +420,7 @@ gimp_histogram_get_channel (GimpHistogram *histogram, gint gimp_histogram_nchannels (GimpHistogram *histogram) { - return histogram->nchannels - 1; + return histogram->n_channels - 1; } gdouble diff --git a/app/gimpimage-convert.c b/app/gimpimage-convert.c index 62e3835fd5..568cec64f8 100644 --- a/app/gimpimage-convert.c +++ b/app/gimpimage-convert.c @@ -99,18 +99,18 @@ #include "convert.h" #include "cursorutil.h" -#include "drawable.h" #include "floating_sel.h" #include "fsdither.h" #include "gdisplay.h" +#include "gimpdrawable.h" #include "gimpimage.h" -#include "layer.h" -#include "undo.h" -#include "palette.h" #include "gimppalette.h" +#include "layer.h" +#include "palette.h" #include "palette_select.h" #include "pixel_region.h" #include "tile_manager.h" +#include "undo.h" #include "tools/brightness_contrast.h" #include "tools/color_balance.h" diff --git a/app/gimpimage-duplicate.c b/app/gimpimage-duplicate.c index 6b693844cc..06b765b30f 100644 --- a/app/gimpimage-duplicate.c +++ b/app/gimpimage-duplicate.c @@ -486,17 +486,20 @@ offset (GimpImage *gimage, } /* push an undo */ - drawable_apply_image (drawable, 0, 0, + drawable_apply_image (drawable, + 0, 0, gimp_drawable_width (drawable), gimp_drawable_height (drawable), - gimp_drawable_data (drawable), FALSE); + gimp_drawable_data (drawable), + FALSE); /* swap the tiles */ drawable->tiles = new_tiles; /* update the drawable */ - drawable_update (drawable, 0, 0, + drawable_update (drawable, + 0, 0, gimp_drawable_width (drawable), gimp_drawable_height (drawable)); } @@ -512,8 +515,8 @@ offset_ok_callback (GtkWidget *widget, OffsetDialog *off_d; GImage *gimage; GimpDrawable *drawable; - gint offset_x; - gint offset_y; + gint offset_x; + gint offset_y; off_d = (OffsetDialog *) data; diff --git a/app/gimplayer.c b/app/gimplayer.c index c512de53e7..526a77fdc8 100644 --- a/app/gimplayer.c +++ b/app/gimplayer.c @@ -583,7 +583,8 @@ gimp_layer_translate (GimpLayer *layer, undo_push_layer_displace (GIMP_DRAWABLE (layer)->gimage, layer); /* update the affected region */ - drawable_update (GIMP_DRAWABLE (layer), 0, 0, + drawable_update (GIMP_DRAWABLE (layer), + 0, 0, GIMP_DRAWABLE (layer)->width, GIMP_DRAWABLE (layer)->height); @@ -606,8 +607,7 @@ gimp_layer_translate (GimpLayer *layer, GIMP_DRAWABLE (layer->mask)->offset_y += off_y; /* invalidate the mask preview */ - gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask), - FALSE); + gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask), FALSE); } } @@ -947,7 +947,8 @@ gimp_layer_resize (GimpLayer *layer, /* Update the old layer position */ drawable_update (GIMP_DRAWABLE( layer), 0, 0, - GIMP_DRAWABLE (layer)->width, GIMP_DRAWABLE (layer)->height); + GIMP_DRAWABLE (layer)->width, + GIMP_DRAWABLE (layer)->height); /* Configure the pixel regions */ pixel_region_init (&srcPR, GIMP_DRAWABLE (layer)->tiles, @@ -1014,7 +1015,8 @@ gimp_layer_resize (GimpLayer *layer, /* update the new layer area */ drawable_update (GIMP_DRAWABLE (layer), 0, 0, - GIMP_DRAWABLE (layer)->width, GIMP_DRAWABLE (layer)->height); + GIMP_DRAWABLE (layer)->width, + GIMP_DRAWABLE (layer)->height); } void @@ -1105,7 +1107,6 @@ gimp_layer_invalidate_boundary (GimpLayer *layer) GimpImage *gimage; GimpChannel *mask; - /* first get the selection mask channel */ if (! (gimage = gimp_drawable_gimage (GIMP_DRAWABLE (layer)))) return; @@ -1115,6 +1116,7 @@ gimp_layer_invalidate_boundary (GimpLayer *layer) /* clear the affected region surrounding the layer */ gdisplays_selection_visibility (gimage, SelectionLayerOff); + /* get the selection mask channel */ mask = gimp_image_get_mask (gimage); /* Only bother with the bounds if there is a selection */ diff --git a/app/gimplayermask.c b/app/gimplayermask.c index 219cd6a84e..1c32050185 100644 --- a/app/gimplayermask.c +++ b/app/gimplayermask.c @@ -28,30 +28,22 @@ #include "apptypes.h" #include "boundary.h" -#include "drawable.h" -#include "floating_sel.h" -#include "gdisplay.h" -#include "gimage_mask.h" -#include "gimpimage.h" #include "gimplayermask.h" -#include "gimppreviewcache.h" -#include "layer.h" -#include "parasitelist.h" #include "paint_funcs.h" #include "pixel_region.h" -#include "undo.h" #include "temp_buf.h" #include "tile_manager.h" #include "tile.h" +#include "undo.h" #include "libgimp/gimpparasite.h" #include "libgimp/gimpintl.h" -static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass); -static void gimp_layer_mask_init (GimpLayerMask *layermask); -static void gimp_layer_mask_destroy (GtkObject *object); +static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass); +static void gimp_layer_mask_init (GimpLayerMask *layermask); +static void gimp_layer_mask_destroy (GtkObject *object); static GimpChannelClass *parent_class = NULL; diff --git a/app/global_edit.c b/app/global_edit.c index 621443225f..208acc7f58 100644 --- a/app/global_edit.c +++ b/app/global_edit.c @@ -26,9 +26,7 @@ #include "apptypes.h" -#include "appenv.h" #include "drawable.h" -#include "image_new.h" #include "floating_sel.h" #include "gdisplay.h" #include "gimage.h" @@ -36,6 +34,7 @@ #include "gimpcontext.h" #include "gimplayermask.h" #include "global_edit.h" +#include "image_new.h" #include "layer.h" #include "paint_funcs.h" #include "pixel_region.h" @@ -446,7 +445,9 @@ edit_clear (GimpImage *gimage, ERASE_MODE, NULL, x1, y1); /* update the image */ - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); /* free the temporary tiles */ tile_manager_destroy (buf_tiles); @@ -518,7 +519,9 @@ edit_fill (GimpImage *gimage, NORMAL_MODE, NULL, x1, y1); /* update the image */ - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); /* free the temporary tiles */ tile_manager_destroy (buf_tiles); diff --git a/app/gui/channels-dialog.c b/app/gui/channels-dialog.c index fe0f30daf3..8a0a06dba5 100644 --- a/app/gui/channels-dialog.c +++ b/app/gui/channels-dialog.c @@ -1772,9 +1772,11 @@ channel_widget_drop_color (GtkWidget *widget, { channel->color = *color; - drawable_update (GIMP_DRAWABLE (channel), 0, 0, + drawable_update (GIMP_DRAWABLE (channel), + 0, 0, GIMP_DRAWABLE (channel)->width, GIMP_DRAWABLE (channel)->height); + gdisplays_flush (); } } @@ -2680,9 +2682,12 @@ edit_channel_query_ok_callback (GtkWidget *widget, if (gimp_rgba_distance (&color, &channel->color) > 0.0001) { channel->color = color; - drawable_update (GIMP_DRAWABLE (channel), 0, 0, + + drawable_update (GIMP_DRAWABLE (channel), + 0, 0, GIMP_DRAWABLE (channel)->width, GIMP_DRAWABLE (channel)->height); + gdisplays_flush (); } } diff --git a/app/gui/commands.c b/app/gui/commands.c index 38474c3c47..0cd423fd73 100644 --- a/app/gui/commands.c +++ b/app/gui/commands.c @@ -41,7 +41,6 @@ #include "devices.h" #include "docindex.h" #include "channel_ops.h" -#include "drawable.h" #include "equalize.h" #include "errorconsole.h" #include "fileops.h" @@ -49,6 +48,7 @@ #include "gdisplay_ops.h" #include "gimage_mask.h" #include "gimpcontext.h" +#include "gimpdrawable.h" #include "gimphelp.h" #include "gimpimage.h" #include "gimprc.h" diff --git a/app/gui/help-commands.c b/app/gui/help-commands.c index 38474c3c47..0cd423fd73 100644 --- a/app/gui/help-commands.c +++ b/app/gui/help-commands.c @@ -41,7 +41,6 @@ #include "devices.h" #include "docindex.h" #include "channel_ops.h" -#include "drawable.h" #include "equalize.h" #include "errorconsole.h" #include "fileops.h" @@ -49,6 +48,7 @@ #include "gdisplay_ops.h" #include "gimage_mask.h" #include "gimpcontext.h" +#include "gimpdrawable.h" #include "gimphelp.h" #include "gimpimage.h" #include "gimprc.h" diff --git a/app/gui/layer-select.c b/app/gui/layer-select.c index b2049bcf2b..38e4d00752 100644 --- a/app/gui/layer-select.c +++ b/app/gui/layer-select.c @@ -23,9 +23,8 @@ #include "apptypes.h" -#include "appenv.h" -#include "drawable.h" #include "gdisplay.h" +#include "gimpdrawable.h" #include "gimpdrawablepreview.h" #include "gimpimage.h" #include "gimprc.h" diff --git a/app/gui/paths-dialog.c b/app/gui/paths-dialog.c index fc95eef551..bd3b5642b6 100644 --- a/app/gui/paths-dialog.c +++ b/app/gui/paths-dialog.c @@ -33,7 +33,6 @@ #include "apptypes.h" #include "draw_core.h" -#include "drawable.h" #include "floating_sel.h" #include "gimpcontext.h" #include "gimpimage.h" diff --git a/app/gui/plug-in-commands.c b/app/gui/plug-in-commands.c index a57eb4132f..e5fbdba59f 100644 --- a/app/gui/plug-in-commands.c +++ b/app/gui/plug-in-commands.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/gui/plug-in-menus.c b/app/gui/plug-in-menus.c index a57eb4132f..e5fbdba59f 100644 --- a/app/gui/plug-in-menus.c +++ b/app/gui/plug-in-menus.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/gui/qmask-commands.c b/app/gui/qmask-commands.c index 3d078909c9..9f0d18e430 100644 --- a/app/gui/qmask-commands.c +++ b/app/gui/qmask-commands.c @@ -364,7 +364,13 @@ edit_qmask_query_ok_callback (GtkWidget *widget, if (gimp_rgba_distance (&color, &channel->color) > 0.0001) { channel->color = color; - gimp_channel_update (channel); + + drawable_update (GIMP_DRAWABLE (channel), + 0, 0, + GIMP_DRAWABLE (channel)->width, + GIMP_DRAWABLE (channel)->height); + + gdisplays_flush (); } } diff --git a/app/histogramwidget.c b/app/histogramwidget.c index e0b3232c58..6c81f41767 100644 --- a/app/histogramwidget.c +++ b/app/histogramwidget.c @@ -24,11 +24,9 @@ #include "apptypes.h" -#include "appenv.h" -#include "drawable.h" -#include "gdisplay.h" #include "gimage.h" #include "gimage_mask.h" +#include "gimphistogram.h" #include "histogramwidget.h" #include "tile_manager.h" diff --git a/app/histogramwidget.h b/app/histogramwidget.h index 249260c5f4..3f5149835e 100644 --- a/app/histogramwidget.h +++ b/app/histogramwidget.h @@ -19,21 +19,21 @@ #ifndef __HISTOGRAM_WIDGET_H__ #define __HISTOGRAM_WIDGET_H__ -#include -#include "gimphistogram.h" +#include #define HISTOGRAM_WIDGET_TYPE (histogram_widget_get_type ()) #define HISTOGRAM_WIDGET(obj) GTK_CHECK_CAST (obj, histogram_widget_get_type (), HistogramWidget) -#define HISTOGRAM_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, histogram_widget_get_type (), HistogramWidget) #define IS_HISTOGRAM_WIDGET(obj) GTK_CHECK_TYPE (obj, histogram_widget_get_type ()) +#define HISTOGRAM_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, histogram_widget_get_type (), HistogramWidget) + typedef struct _HistogramWidgetClass HistogramWidgetClass; struct _HistogramWidget { - GtkDrawingArea drawingarea; + GtkDrawingArea parent_instance; GimpHistogram *histogram; GimpHistogramChannel channel; @@ -43,7 +43,7 @@ struct _HistogramWidget struct _HistogramWidgetClass { - GtkDrawingAreaClass parent_class; + GtkDrawingAreaClass parent_class; void (* range_changed) (HistogramWidget *hw, gint start, diff --git a/app/image_map.c b/app/image_map.c index fb1e2defb5..c5969f2636 100644 --- a/app/image_map.c +++ b/app/image_map.c @@ -22,10 +22,10 @@ #include "apptypes.h" -#include "appenv.h" #include "drawable.h" #include "gdisplay.h" #include "gimage_mask.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "image_map.h" #include "paint_funcs.h" diff --git a/app/image_new.c b/app/image_new.c index 983b0bc0e1..52b94446bd 100644 --- a/app/image_new.c +++ b/app/image_new.c @@ -23,13 +23,12 @@ #include "apptypes.h" #include "appenv.h" -#include "apptypes.h" #include "drawable.h" -#include "gimprc.h" #include "file_new_dialog.h" #include "gdisplay.h" -#include "gimpcontext.h" #include "gimage.h" +#include "gimpcontext.h" +#include "gimprc.h" #include "image_new.h" #include "layer.h" #include "paint_funcs.h" diff --git a/app/invert.c b/app/invert.c index 37fa634cdb..3aec2819b9 100644 --- a/app/invert.c +++ b/app/invert.c @@ -22,11 +22,10 @@ #include "apptypes.h" -#include "appenv.h" #include "drawable.h" -#include "invert.h" #include "gimpimage.h" #include "gimplut.h" +#include "invert.h" #include "lut_funcs.h" #include "pixel_processor.h" #include "pixel_region.h" @@ -40,8 +39,8 @@ void image_invert (GimpImage *gimage) { GimpDrawable *drawable; - Argument *return_vals; - gint nreturn_vals; + Argument *return_vals; + gint nreturn_vals; drawable = gimp_image_active_drawable (gimage); @@ -69,9 +68,9 @@ image_invert (GimpImage *gimage) void invert (GimpDrawable *drawable) { - PixelRegion srcPR, destPR; - gint x1, y1, x2, y2; - GimpLut *lut; + PixelRegion srcPR, destPR; + gint x1, y1, x2, y2; + GimpLut *lut; lut = invert_lut_new (gimp_drawable_bytes (drawable)); @@ -87,5 +86,8 @@ invert (GimpDrawable *drawable) gimp_lut_free (lut); gimp_drawable_merge_shadow (drawable, TRUE); - drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); + + drawable_update (drawable, + x1, y1, + (x2 - x1), (y2 - y1)); } diff --git a/app/layer.c b/app/layer.c index c512de53e7..526a77fdc8 100644 --- a/app/layer.c +++ b/app/layer.c @@ -583,7 +583,8 @@ gimp_layer_translate (GimpLayer *layer, undo_push_layer_displace (GIMP_DRAWABLE (layer)->gimage, layer); /* update the affected region */ - drawable_update (GIMP_DRAWABLE (layer), 0, 0, + drawable_update (GIMP_DRAWABLE (layer), + 0, 0, GIMP_DRAWABLE (layer)->width, GIMP_DRAWABLE (layer)->height); @@ -606,8 +607,7 @@ gimp_layer_translate (GimpLayer *layer, GIMP_DRAWABLE (layer->mask)->offset_y += off_y; /* invalidate the mask preview */ - gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask), - FALSE); + gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer->mask), FALSE); } } @@ -947,7 +947,8 @@ gimp_layer_resize (GimpLayer *layer, /* Update the old layer position */ drawable_update (GIMP_DRAWABLE( layer), 0, 0, - GIMP_DRAWABLE (layer)->width, GIMP_DRAWABLE (layer)->height); + GIMP_DRAWABLE (layer)->width, + GIMP_DRAWABLE (layer)->height); /* Configure the pixel regions */ pixel_region_init (&srcPR, GIMP_DRAWABLE (layer)->tiles, @@ -1014,7 +1015,8 @@ gimp_layer_resize (GimpLayer *layer, /* update the new layer area */ drawable_update (GIMP_DRAWABLE (layer), 0, 0, - GIMP_DRAWABLE (layer)->width, GIMP_DRAWABLE (layer)->height); + GIMP_DRAWABLE (layer)->width, + GIMP_DRAWABLE (layer)->height); } void @@ -1105,7 +1107,6 @@ gimp_layer_invalidate_boundary (GimpLayer *layer) GimpImage *gimage; GimpChannel *mask; - /* first get the selection mask channel */ if (! (gimage = gimp_drawable_gimage (GIMP_DRAWABLE (layer)))) return; @@ -1115,6 +1116,7 @@ gimp_layer_invalidate_boundary (GimpLayer *layer) /* clear the affected region surrounding the layer */ gdisplays_selection_visibility (gimage, SelectionLayerOff); + /* get the selection mask channel */ mask = gimp_image_get_mask (gimage); /* Only bother with the bounds if there is a selection */ diff --git a/app/layer_select.c b/app/layer_select.c index b2049bcf2b..38e4d00752 100644 --- a/app/layer_select.c +++ b/app/layer_select.c @@ -23,9 +23,8 @@ #include "apptypes.h" -#include "appenv.h" -#include "drawable.h" #include "gdisplay.h" +#include "gimpdrawable.h" #include "gimpdrawablepreview.h" #include "gimpimage.h" #include "gimprc.h" diff --git a/app/menus/plug-in-menus.c b/app/menus/plug-in-menus.c index a57eb4132f..e5fbdba59f 100644 --- a/app/menus/plug-in-menus.c +++ b/app/menus/plug-in-menus.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/paths_dialog.c b/app/paths_dialog.c index fc95eef551..bd3b5642b6 100644 --- a/app/paths_dialog.c +++ b/app/paths_dialog.c @@ -33,7 +33,6 @@ #include "apptypes.h" #include "draw_core.h" -#include "drawable.h" #include "floating_sel.h" #include "gimpcontext.h" #include "gimpimage.h" diff --git a/app/plug-in/gimpplugin-message.c b/app/plug-in/gimpplugin-message.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/gimpplugin-message.c +++ b/app/plug-in/gimpplugin-message.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/gimppluginshm.c b/app/plug-in/gimppluginshm.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/gimppluginshm.c +++ b/app/plug-in/gimppluginshm.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/plug-in-def.c b/app/plug-in/plug-in-def.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/plug-in-def.c +++ b/app/plug-in/plug-in-def.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/plug-in-message.c b/app/plug-in/plug-in-message.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/plug-in-message.c +++ b/app/plug-in/plug-in-message.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/plug-in-params.c +++ b/app/plug-in/plug-in-params.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/plug-in-shm.c b/app/plug-in/plug-in-shm.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/plug-in-shm.c +++ b/app/plug-in/plug-in-shm.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/plug-in.c b/app/plug-in/plug-in.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/plug-in.c +++ b/app/plug-in/plug-in.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug-in/plug-ins.c b/app/plug-in/plug-ins.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug-in/plug-ins.c +++ b/app/plug-in/plug-ins.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/plug_in.c b/app/plug_in.c index a57eb4132f..e5fbdba59f 100644 --- a/app/plug_in.c +++ b/app/plug_in.c @@ -82,11 +82,11 @@ #include "app_procs.h" #include "appenv.h" #include "brush_select.h" -#include "drawable.h" #include "datafiles.h" #include "errors.h" #include "gdisplay.h" #include "general.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "gimpprogress.h" #include "gimprc.h" diff --git a/app/qmask.c b/app/qmask.c index 3d078909c9..9f0d18e430 100644 --- a/app/qmask.c +++ b/app/qmask.c @@ -364,7 +364,13 @@ edit_qmask_query_ok_callback (GtkWidget *widget, if (gimp_rgba_distance (&color, &channel->color) > 0.0001) { channel->color = color; - gimp_channel_update (channel); + + drawable_update (GIMP_DRAWABLE (channel), + 0, 0, + GIMP_DRAWABLE (channel)->width, + GIMP_DRAWABLE (channel)->height); + + gdisplays_flush (); } } diff --git a/app/scan_convert.c b/app/scan_convert.c index dead5cfe53..3bc06790c4 100644 --- a/app/scan_convert.c +++ b/app/scan_convert.c @@ -27,7 +27,7 @@ #include "apptypes.h" #include "channel.h" -#include "drawable.h" +#include "gimpdrawable.h" #include "gimpimage.h" #include "pixel_region.h" #include "scan_convert.h" @@ -288,9 +288,9 @@ scan_converter_to_channel (ScanConverter *sc, TRC (("\n")); } - pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE(mask)), 0, 0, - gimp_drawable_width (GIMP_DRAWABLE(mask)), - gimp_drawable_height (GIMP_DRAWABLE(mask)), TRUE); + pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE (mask)), 0, 0, + gimp_drawable_width (GIMP_DRAWABLE (mask)), + gimp_drawable_height (GIMP_DRAWABLE (mask)), TRUE); for (i = 0; i < heighta; i++) { diff --git a/app/undo_history.c b/app/undo_history.c index 7ebb2e58c9..ad0968b223 100644 --- a/app/undo_history.c +++ b/app/undo_history.c @@ -50,10 +50,10 @@ #include "apptypes.h" #include "dialog_handler.h" -#include "drawable.h" -#include "gimprc.h" #include "gimage_mask.h" +#include "gimpdrawable.h" #include "gimpimage.h" +#include "gimprc.h" #include "paint_funcs.h" #include "pixel_region.h" #include "temp_buf.h" diff --git a/app/widgets/gimpdnd.c b/app/widgets/gimpdnd.c index 91e088bb28..e64fb1c87a 100644 --- a/app/widgets/gimpdnd.c +++ b/app/widgets/gimpdnd.c @@ -27,20 +27,17 @@ #include "apptypes.h" -#include "channel.h" -#include "drawable.h" #include "fileops.h" #include "gimpimage.h" #include "gimpbrush.h" #include "gimpcontextpreview.h" #include "gimpdnd.h" #include "gimpbrushlist.h" +#include "gimpdrawable.h" #include "gimpdrawablepreview.h" -#include "gimplayermask.h" #include "gimprc.h" #include "gradient.h" #include "gradient_header.h" -#include "layer.h" #include "patterns.h" #include "temp_buf.h" diff --git a/app/widgets/gimpdrawablepreview.c b/app/widgets/gimpdrawablepreview.c index f56eaf9c49..2ce8e5748a 100644 --- a/app/widgets/gimpdrawablepreview.c +++ b/app/widgets/gimpdrawablepreview.c @@ -24,10 +24,10 @@ #include "apptypes.h" -#include "boundary.h" #include "channel.h" -#include "drawable.h" #include "gimpimage.h" +#include "gimpdrawable.h" +#include "gimpdrawablepreview.h" #include "gimppreviewcache.h" #include "layer.h" #include "paint_funcs.h" @@ -70,7 +70,7 @@ gimp_drawable_preview (GimpDrawable *drawable, TempBuf *tb = gimp_drawable_preview_private (drawable, PREVIEW_CACHE_PRIME_WIDTH, PREVIEW_CACHE_PRIME_HEIGHT); - + /* Save the 2nd call */ if (width == PREVIEW_CACHE_PRIME_WIDTH && height == PREVIEW_CACHE_PRIME_HEIGHT) @@ -128,6 +128,7 @@ gimp_drawable_preview_private (GimpDrawable *drawable, /* calculate 'acceptable' subsample */ subsample = 1; + /* handle some truncation errors */ if (width < 1) width = 1; if (height < 1) height = 1; @@ -296,15 +297,18 @@ gimp_drawable_preview_scale (GimpImageBaseType type, { map_to_color (2, cmap, s, rgb); - r[RED_PIX] += rgb[RED_PIX] * tot_frac; + r[RED_PIX] += rgb[RED_PIX] * tot_frac; r[GREEN_PIX] += rgb[GREEN_PIX] * tot_frac; - r[BLUE_PIX] += rgb[BLUE_PIX] * tot_frac; + r[BLUE_PIX] += rgb[BLUE_PIX] * tot_frac; + if (bytes == 4) r[ALPHA_PIX] += s[ALPHA_I_PIX] * tot_frac; } else - for (b = 0; b < bytes; b++) - r[b] += s[b] * tot_frac; + { + for (b = 0; b < bytes; b++) + r[b] += s[b] * tot_frac; + } /* increment the destination */ if (x_cum + x_rat <= (src_col + 1 + EPSILON)) @@ -313,7 +317,6 @@ gimp_drawable_preview_scale (GimpImageBaseType type, x_cum += x_rat; j--; } - /* increment the source */ else { @@ -335,7 +338,7 @@ gimp_drawable_preview_scale (GimpImageBaseType type, { b = bytes; while (b--) - *d++ = (guchar) ((*r++ * tot_frac)+0.5); + *d++ = (guchar) ((*r++ * tot_frac) + 0.5); } dest += destwidth; diff --git a/app/widgets/gimphistogramview.c b/app/widgets/gimphistogramview.c index e0b3232c58..6c81f41767 100644 --- a/app/widgets/gimphistogramview.c +++ b/app/widgets/gimphistogramview.c @@ -24,11 +24,9 @@ #include "apptypes.h" -#include "appenv.h" -#include "drawable.h" -#include "gdisplay.h" #include "gimage.h" #include "gimage_mask.h" +#include "gimphistogram.h" #include "histogramwidget.h" #include "tile_manager.h" diff --git a/app/widgets/gimphistogramview.h b/app/widgets/gimphistogramview.h index 249260c5f4..3f5149835e 100644 --- a/app/widgets/gimphistogramview.h +++ b/app/widgets/gimphistogramview.h @@ -19,21 +19,21 @@ #ifndef __HISTOGRAM_WIDGET_H__ #define __HISTOGRAM_WIDGET_H__ -#include -#include "gimphistogram.h" +#include #define HISTOGRAM_WIDGET_TYPE (histogram_widget_get_type ()) #define HISTOGRAM_WIDGET(obj) GTK_CHECK_CAST (obj, histogram_widget_get_type (), HistogramWidget) -#define HISTOGRAM_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, histogram_widget_get_type (), HistogramWidget) #define IS_HISTOGRAM_WIDGET(obj) GTK_CHECK_TYPE (obj, histogram_widget_get_type ()) +#define HISTOGRAM_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, histogram_widget_get_type (), HistogramWidget) + typedef struct _HistogramWidgetClass HistogramWidgetClass; struct _HistogramWidget { - GtkDrawingArea drawingarea; + GtkDrawingArea parent_instance; GimpHistogram *histogram; GimpHistogramChannel channel; @@ -43,7 +43,7 @@ struct _HistogramWidget struct _HistogramWidgetClass { - GtkDrawingAreaClass parent_class; + GtkDrawingAreaClass parent_class; void (* range_changed) (HistogramWidget *hw, gint start, diff --git a/app/widgets/gimppreviewrendererdrawable.c b/app/widgets/gimppreviewrendererdrawable.c index f56eaf9c49..2ce8e5748a 100644 --- a/app/widgets/gimppreviewrendererdrawable.c +++ b/app/widgets/gimppreviewrendererdrawable.c @@ -24,10 +24,10 @@ #include "apptypes.h" -#include "boundary.h" #include "channel.h" -#include "drawable.h" #include "gimpimage.h" +#include "gimpdrawable.h" +#include "gimpdrawablepreview.h" #include "gimppreviewcache.h" #include "layer.h" #include "paint_funcs.h" @@ -70,7 +70,7 @@ gimp_drawable_preview (GimpDrawable *drawable, TempBuf *tb = gimp_drawable_preview_private (drawable, PREVIEW_CACHE_PRIME_WIDTH, PREVIEW_CACHE_PRIME_HEIGHT); - + /* Save the 2nd call */ if (width == PREVIEW_CACHE_PRIME_WIDTH && height == PREVIEW_CACHE_PRIME_HEIGHT) @@ -128,6 +128,7 @@ gimp_drawable_preview_private (GimpDrawable *drawable, /* calculate 'acceptable' subsample */ subsample = 1; + /* handle some truncation errors */ if (width < 1) width = 1; if (height < 1) height = 1; @@ -296,15 +297,18 @@ gimp_drawable_preview_scale (GimpImageBaseType type, { map_to_color (2, cmap, s, rgb); - r[RED_PIX] += rgb[RED_PIX] * tot_frac; + r[RED_PIX] += rgb[RED_PIX] * tot_frac; r[GREEN_PIX] += rgb[GREEN_PIX] * tot_frac; - r[BLUE_PIX] += rgb[BLUE_PIX] * tot_frac; + r[BLUE_PIX] += rgb[BLUE_PIX] * tot_frac; + if (bytes == 4) r[ALPHA_PIX] += s[ALPHA_I_PIX] * tot_frac; } else - for (b = 0; b < bytes; b++) - r[b] += s[b] * tot_frac; + { + for (b = 0; b < bytes; b++) + r[b] += s[b] * tot_frac; + } /* increment the destination */ if (x_cum + x_rat <= (src_col + 1 + EPSILON)) @@ -313,7 +317,6 @@ gimp_drawable_preview_scale (GimpImageBaseType type, x_cum += x_rat; j--; } - /* increment the source */ else { @@ -335,7 +338,7 @@ gimp_drawable_preview_scale (GimpImageBaseType type, { b = bytes; while (b--) - *d++ = (guchar) ((*r++ * tot_frac)+0.5); + *d++ = (guchar) ((*r++ * tot_frac) + 0.5); } dest += destwidth; diff --git a/app/widgets/gimpviewrendererdrawable.c b/app/widgets/gimpviewrendererdrawable.c index f56eaf9c49..2ce8e5748a 100644 --- a/app/widgets/gimpviewrendererdrawable.c +++ b/app/widgets/gimpviewrendererdrawable.c @@ -24,10 +24,10 @@ #include "apptypes.h" -#include "boundary.h" #include "channel.h" -#include "drawable.h" #include "gimpimage.h" +#include "gimpdrawable.h" +#include "gimpdrawablepreview.h" #include "gimppreviewcache.h" #include "layer.h" #include "paint_funcs.h" @@ -70,7 +70,7 @@ gimp_drawable_preview (GimpDrawable *drawable, TempBuf *tb = gimp_drawable_preview_private (drawable, PREVIEW_CACHE_PRIME_WIDTH, PREVIEW_CACHE_PRIME_HEIGHT); - + /* Save the 2nd call */ if (width == PREVIEW_CACHE_PRIME_WIDTH && height == PREVIEW_CACHE_PRIME_HEIGHT) @@ -128,6 +128,7 @@ gimp_drawable_preview_private (GimpDrawable *drawable, /* calculate 'acceptable' subsample */ subsample = 1; + /* handle some truncation errors */ if (width < 1) width = 1; if (height < 1) height = 1; @@ -296,15 +297,18 @@ gimp_drawable_preview_scale (GimpImageBaseType type, { map_to_color (2, cmap, s, rgb); - r[RED_PIX] += rgb[RED_PIX] * tot_frac; + r[RED_PIX] += rgb[RED_PIX] * tot_frac; r[GREEN_PIX] += rgb[GREEN_PIX] * tot_frac; - r[BLUE_PIX] += rgb[BLUE_PIX] * tot_frac; + r[BLUE_PIX] += rgb[BLUE_PIX] * tot_frac; + if (bytes == 4) r[ALPHA_PIX] += s[ALPHA_I_PIX] * tot_frac; } else - for (b = 0; b < bytes; b++) - r[b] += s[b] * tot_frac; + { + for (b = 0; b < bytes; b++) + r[b] += s[b] * tot_frac; + } /* increment the destination */ if (x_cum + x_rat <= (src_col + 1 + EPSILON)) @@ -313,7 +317,6 @@ gimp_drawable_preview_scale (GimpImageBaseType type, x_cum += x_rat; j--; } - /* increment the source */ else { @@ -335,7 +338,7 @@ gimp_drawable_preview_scale (GimpImageBaseType type, { b = bytes; while (b--) - *d++ = (guchar) ((*r++ * tot_frac)+0.5); + *d++ = (guchar) ((*r++ * tot_frac) + 0.5); } dest += destwidth; diff --git a/app/xcf.c b/app/xcf.c index bea61b985d..9405a40a6b 100644 --- a/app/xcf.c +++ b/app/xcf.c @@ -39,10 +39,10 @@ #include "channel.h" #include "cursorutil.h" -#include "drawable.h" #include "floating_sel.h" #include "gimage.h" #include "gimage_mask.h" +#include "gimpdrawable.h" #include "gimplayermask.h" #include "gimprc.h" #include "layer.h" diff --git a/app/xcf/xcf.c b/app/xcf/xcf.c index bea61b985d..9405a40a6b 100644 --- a/app/xcf/xcf.c +++ b/app/xcf/xcf.c @@ -39,10 +39,10 @@ #include "channel.h" #include "cursorutil.h" -#include "drawable.h" #include "floating_sel.h" #include "gimage.h" #include "gimage_mask.h" +#include "gimpdrawable.h" #include "gimplayermask.h" #include "gimprc.h" #include "layer.h"