diff --git a/app/channel.c b/app/channel.c index d6aa2a2492..2109b31b74 100644 --- a/app/channel.c +++ b/app/channel.c @@ -371,6 +371,8 @@ channel_preview (Channel *channel, int width, int height) { /* calculate 'acceptable' subsample */ subsample = 1; + if (width < 1) width = 1; + if (height < 1) height = 1; while ((width * (subsample + 1) * 2 < channel->width) && (height * (subsample + 1) * 2 < channel->height)) subsample = subsample + 1; diff --git a/app/core/gimpchannel-combine.c b/app/core/gimpchannel-combine.c index d6aa2a2492..2109b31b74 100644 --- a/app/core/gimpchannel-combine.c +++ b/app/core/gimpchannel-combine.c @@ -371,6 +371,8 @@ channel_preview (Channel *channel, int width, int height) { /* calculate 'acceptable' subsample */ subsample = 1; + if (width < 1) width = 1; + if (height < 1) height = 1; while ((width * (subsample + 1) * 2 < channel->width) && (height * (subsample + 1) * 2 < channel->height)) subsample = subsample + 1; diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c index d6aa2a2492..2109b31b74 100644 --- a/app/core/gimpchannel.c +++ b/app/core/gimpchannel.c @@ -371,6 +371,8 @@ channel_preview (Channel *channel, int width, int height) { /* calculate 'acceptable' subsample */ subsample = 1; + if (width < 1) width = 1; + if (height < 1) height = 1; while ((width * (subsample + 1) * 2 < channel->width) && (height * (subsample + 1) * 2 < channel->height)) subsample = subsample + 1; diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index ec538cd6c7..784f94d84c 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -971,8 +971,11 @@ layer_preview (layer, w, h) /* calculate 'acceptable' subsample */ subsample = 1; + /* handle some truncation errors */ + if (w < 1) w = 1; + if (h < 1) h = 1; while ((w * (subsample + 1) * 2 < layer->width) && - (h * (subsample + 1) * 2 < layer->height)) + (h * (subsample + 1) * 2 < layer->height)) subsample = subsample + 1; pixel_region_init (&srcPR, layer->tiles, 0, 0, layer->width, layer->height, FALSE); @@ -1021,6 +1024,8 @@ layer_mask_preview (layer, w, h) { /* calculate 'acceptable' subsample */ subsample = 1; + if (w < 1) w = 1; + if (h < 1) h = 1; while ((w * (subsample + 1) * 2 < layer->width) && (h * (subsample + 1) * 2 < layer->height)) subsample = subsample + 1; diff --git a/app/gimpchannel.c b/app/gimpchannel.c index d6aa2a2492..2109b31b74 100644 --- a/app/gimpchannel.c +++ b/app/gimpchannel.c @@ -371,6 +371,8 @@ channel_preview (Channel *channel, int width, int height) { /* calculate 'acceptable' subsample */ subsample = 1; + if (width < 1) width = 1; + if (height < 1) height = 1; while ((width * (subsample + 1) * 2 < channel->width) && (height * (subsample + 1) * 2 < channel->height)) subsample = subsample + 1; diff --git a/app/gimplayer.c b/app/gimplayer.c index ec538cd6c7..784f94d84c 100644 --- a/app/gimplayer.c +++ b/app/gimplayer.c @@ -971,8 +971,11 @@ layer_preview (layer, w, h) /* calculate 'acceptable' subsample */ subsample = 1; + /* handle some truncation errors */ + if (w < 1) w = 1; + if (h < 1) h = 1; while ((w * (subsample + 1) * 2 < layer->width) && - (h * (subsample + 1) * 2 < layer->height)) + (h * (subsample + 1) * 2 < layer->height)) subsample = subsample + 1; pixel_region_init (&srcPR, layer->tiles, 0, 0, layer->width, layer->height, FALSE); @@ -1021,6 +1024,8 @@ layer_mask_preview (layer, w, h) { /* calculate 'acceptable' subsample */ subsample = 1; + if (w < 1) w = 1; + if (h < 1) h = 1; while ((w * (subsample + 1) * 2 < layer->width) && (h * (subsample + 1) * 2 < layer->height)) subsample = subsample + 1; diff --git a/app/gui/palette-editor.c b/app/gui/palette-editor.c index e8be742094..3a3b834267 100644 --- a/app/gui/palette-editor.c +++ b/app/gui/palette-editor.c @@ -36,11 +36,11 @@ #include "interface.h" #include "palette.h" -#define ENTRY_WIDTH 18 -#define ENTRY_HEIGHT 14 +#define ENTRY_WIDTH 14 +#define ENTRY_HEIGHT 10 #define SPACING 1 -#define COLUMNS 12 -#define ROWS 8 +#define COLUMNS 16 +#define ROWS 16 #define PREVIEW_WIDTH ((ENTRY_WIDTH * COLUMNS) + (SPACING * (COLUMNS + 1))) #define PREVIEW_HEIGHT ((ENTRY_HEIGHT * ROWS) + (SPACING * (ROWS + 1))) @@ -184,6 +184,7 @@ palette_create () /* The shell and main vbox */ palette->shell = gtk_dialog_new (); + gtk_window_set_policy (GTK_WINDOW (palette->shell), FALSE, FALSE, FALSE); gtk_window_set_title (GTK_WINDOW (palette->shell), "Color Palette"); vbox = gtk_vbox_new (FALSE, 1); gtk_container_border_width (GTK_CONTAINER (vbox), 1); diff --git a/app/layer.c b/app/layer.c index ec538cd6c7..784f94d84c 100644 --- a/app/layer.c +++ b/app/layer.c @@ -971,8 +971,11 @@ layer_preview (layer, w, h) /* calculate 'acceptable' subsample */ subsample = 1; + /* handle some truncation errors */ + if (w < 1) w = 1; + if (h < 1) h = 1; while ((w * (subsample + 1) * 2 < layer->width) && - (h * (subsample + 1) * 2 < layer->height)) + (h * (subsample + 1) * 2 < layer->height)) subsample = subsample + 1; pixel_region_init (&srcPR, layer->tiles, 0, 0, layer->width, layer->height, FALSE); @@ -1021,6 +1024,8 @@ layer_mask_preview (layer, w, h) { /* calculate 'acceptable' subsample */ subsample = 1; + if (w < 1) w = 1; + if (h < 1) h = 1; while ((w * (subsample + 1) * 2 < layer->width) && (h * (subsample + 1) * 2 < layer->height)) subsample = subsample + 1; diff --git a/app/palette.c b/app/palette.c index e8be742094..3a3b834267 100644 --- a/app/palette.c +++ b/app/palette.c @@ -36,11 +36,11 @@ #include "interface.h" #include "palette.h" -#define ENTRY_WIDTH 18 -#define ENTRY_HEIGHT 14 +#define ENTRY_WIDTH 14 +#define ENTRY_HEIGHT 10 #define SPACING 1 -#define COLUMNS 12 -#define ROWS 8 +#define COLUMNS 16 +#define ROWS 16 #define PREVIEW_WIDTH ((ENTRY_WIDTH * COLUMNS) + (SPACING * (COLUMNS + 1))) #define PREVIEW_HEIGHT ((ENTRY_HEIGHT * ROWS) + (SPACING * (ROWS + 1))) @@ -184,6 +184,7 @@ palette_create () /* The shell and main vbox */ palette->shell = gtk_dialog_new (); + gtk_window_set_policy (GTK_WINDOW (palette->shell), FALSE, FALSE, FALSE); gtk_window_set_title (GTK_WINDOW (palette->shell), "Color Palette"); vbox = gtk_vbox_new (FALSE, 1); gtk_container_border_width (GTK_CONTAINER (vbox), 1); diff --git a/app/widgets/gimppaletteeditor.c b/app/widgets/gimppaletteeditor.c index e8be742094..3a3b834267 100644 --- a/app/widgets/gimppaletteeditor.c +++ b/app/widgets/gimppaletteeditor.c @@ -36,11 +36,11 @@ #include "interface.h" #include "palette.h" -#define ENTRY_WIDTH 18 -#define ENTRY_HEIGHT 14 +#define ENTRY_WIDTH 14 +#define ENTRY_HEIGHT 10 #define SPACING 1 -#define COLUMNS 12 -#define ROWS 8 +#define COLUMNS 16 +#define ROWS 16 #define PREVIEW_WIDTH ((ENTRY_WIDTH * COLUMNS) + (SPACING * (COLUMNS + 1))) #define PREVIEW_HEIGHT ((ENTRY_HEIGHT * ROWS) + (SPACING * (ROWS + 1))) @@ -184,6 +184,7 @@ palette_create () /* The shell and main vbox */ palette->shell = gtk_dialog_new (); + gtk_window_set_policy (GTK_WINDOW (palette->shell), FALSE, FALSE, FALSE); gtk_window_set_title (GTK_WINDOW (palette->shell), "Color Palette"); vbox = gtk_vbox_new (FALSE, 1); gtk_container_border_width (GTK_CONTAINER (vbox), 1);