From a3ef83686036ebd306c5de6f9283903894f2852f Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Tue, 5 Oct 1999 02:16:59 +0000 Subject: [PATCH] libgimp/color_display.h add bpl param for convert func * libgimp/color_display.h * app/gdisplay.c: add bpl param for convert func * gdisplay_color.c: guard against head and tail cases in reorders * app/gdisplay_color_ui.c: expose_full on all actions, so there is immediate feedback. Check for no selection and do nothing on actions * app/path_tool.c: #warning is not portable; change to /* XXX: */ * modules/cdisplay_gamma.c: make it so it actually works properly -Yosh --- ChangeLog | 14 +++++++ app/core/gimpprojection.c | 5 ++- app/display/gimpdisplay.c | 5 ++- app/display/gimpdisplayshell-filter-dialog.c | 42 ++++++++++++++++---- app/display/gimpdisplayshell-filter.c | 14 +++++-- app/gdisplay.c | 5 ++- app/gdisplay_color.c | 14 +++++-- app/gdisplay_color_ui.c | 42 ++++++++++++++++---- app/path_tool.c | 26 ++++++------ app/tools/path_tool.c | 26 ++++++------ app/widgets/gimpcolordisplayeditor.c | 42 ++++++++++++++++---- libgimp/color_display.h | 3 +- libgimp/gimpcolordisplay.h | 3 +- modules/cdisplay_gamma.c | 39 ++++++++++++++---- 14 files changed, 207 insertions(+), 73 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79625abc2a..0655bc8d78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Mon Oct 4 19:13:39 PDT 1999 Manish Singh + + * libgimp/color_display.h + * app/gdisplay.c: add bpl param for convert func + + * gdisplay_color.c: guard against head and tail cases in reorders + + * app/gdisplay_color_ui.c: expose_full on all actions, so there is + immediate feedback. Check for no selection and do nothing on actions + + * app/path_tool.c: #warning is not portable; change to /* XXX: */ + + * modules/cdisplay_gamma.c: make it so it actually works properly + Mon Oct 4 21:09:20 1999 Tim Janik * plug-ins/common/csource.c: minor cleanups. fixed up alpha channel diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index aef8788f4f..502e86d9b1 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -1261,10 +1261,11 @@ gdisplay_display_area (GDisplay *gdisp, int i, j; GList *list; guchar *buf; - int bpp; + int bpp, bpl; buf = gximage_get_data (); bpp = gximage_get_bpp (); + bpl = gximage_get_bpl (); sx = SCALEX (gdisp, gdisp->gimage->width); sy = SCALEY (gdisp, gdisp->gimage->height); @@ -1347,7 +1348,7 @@ gdisplay_display_area (GDisplay *gdisp, while (list) { ColorDisplayNode *node = (ColorDisplayNode *) list->data; - node->cd_convert (node->cd_ID, buf, dx, dy, bpp); + node->cd_convert (node->cd_ID, buf, dx, dy, bpp, bpl); list = list->next; } diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index aef8788f4f..502e86d9b1 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -1261,10 +1261,11 @@ gdisplay_display_area (GDisplay *gdisp, int i, j; GList *list; guchar *buf; - int bpp; + int bpp, bpl; buf = gximage_get_data (); bpp = gximage_get_bpp (); + bpl = gximage_get_bpl (); sx = SCALEX (gdisp, gdisp->gimage->width); sy = SCALEY (gdisp, gdisp->gimage->height); @@ -1347,7 +1348,7 @@ gdisplay_display_area (GDisplay *gdisp, while (list) { ColorDisplayNode *node = (ColorDisplayNode *) list->data; - node->cd_convert (node->cd_ID, buf, dx, dy, bpp); + node->cd_convert (node->cd_ID, buf, dx, dy, bpp, bpl); list = list->next; } diff --git a/app/display/gimpdisplayshell-filter-dialog.c b/app/display/gimpdisplayshell-filter-dialog.c index 5248ed1ac6..08a09fe6bb 100644 --- a/app/display/gimpdisplayshell-filter-dialog.c +++ b/app/display/gimpdisplayshell-filter-dialog.c @@ -43,7 +43,7 @@ struct _ColorDisplayDialog GDisplay *gdisp; }; -static ColorDisplayDialog cdd = { NULL, NULL, NULL, 0, 0, FALSE, NULL, NULL }; +static ColorDisplayDialog cdd = { NULL, NULL, NULL, -1, -1, FALSE, NULL, NULL }; typedef void (*ButtonCallback) (GtkWidget *, gpointer); @@ -202,7 +202,8 @@ color_display_ok_callback (GtkWidget *widget, g_list_free (cdd.old_nodes); } - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -227,7 +228,8 @@ color_display_cancel_callback (GtkWidget *widget, } } - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -238,8 +240,14 @@ color_display_add_callback (GtkWidget *widget, ColorDisplayNode *node; gint row; + if (cdd.src_row < 0) + return; + gtk_clist_get_text (GTK_CLIST (cdd.src), cdd.src_row, 0, &name); + if (!name) + return; + cdd.modified = TRUE; node = gdisplay_color_attach (cdd.gdisp, name); @@ -247,7 +255,8 @@ color_display_add_callback (GtkWidget *widget, row = gtk_clist_append (GTK_CLIST (cdd.dest), &name); gtk_clist_set_row_data (GTK_CLIST (cdd.dest), row, node); - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -255,6 +264,9 @@ color_display_remove_callback (GtkWidget *widget, gpointer data) { ColorDisplayNode *node; + + if (cdd.dest_row < 0) + return; node = (ColorDisplayNode *) gtk_clist_get_row_data (GTK_CLIST (cdd.dest), cdd.dest_row); @@ -268,7 +280,8 @@ color_display_remove_callback (GtkWidget *widget, else gdisplay_color_detach_destroy (cdd.gdisp, node); - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -277,6 +290,9 @@ color_display_up_callback (GtkWidget *widget, { ColorDisplayNode *node; + if (cdd.dest_row < 0) + return; + node = (ColorDisplayNode *) gtk_clist_get_row_data (GTK_CLIST (cdd.dest), cdd.dest_row); @@ -285,7 +301,8 @@ color_display_up_callback (GtkWidget *widget, gdisplay_color_reorder_up (cdd.gdisp, node); cdd.modified = TRUE; - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -294,15 +311,18 @@ color_display_down_callback (GtkWidget *widget, { ColorDisplayNode *node; + if (cdd.dest_row < 0) + return; + node = (ColorDisplayNode *) gtk_clist_get_row_data (GTK_CLIST (cdd.dest), cdd.dest_row); - gtk_clist_row_move (GTK_CLIST (cdd.dest), cdd.dest_row, cdd.dest_row + 1); gdisplay_color_reorder_down (cdd.gdisp, node); cdd.modified = TRUE; - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -331,6 +351,12 @@ gdisplay_color_ui (GDisplay *gdisp) cdd.gdisp = gdisp; + cdd.src_row = -1; + cdd.dest_row = -1; + + /* gtk_clist_set_selectable (GTK_CLIST (cdd.src), 0, TRUE); + gtk_clist_set_selectable (GTK_CLIST (cdd.dest), 0, TRUE); */ + gtk_widget_show (cdd.shell); } diff --git a/app/display/gimpdisplayshell-filter.c b/app/display/gimpdisplayshell-filter.c index 6a9f160c6c..35135ffdb5 100644 --- a/app/display/gimpdisplayshell-filter.c +++ b/app/display/gimpdisplayshell-filter.c @@ -242,8 +242,11 @@ gdisplay_color_reorder_up (GDisplay *gdisp, node_list = g_list_find (gdisp->cd_list, node); - node_list->data = node_list->prev->data; - node_list->prev->data = node; + if (node_list->prev) + { + node_list->data = node_list->prev->data; + node_list->prev->data = node; + } } void @@ -254,8 +257,11 @@ gdisplay_color_reorder_down (GDisplay *gdisp, node_list = g_list_find (gdisp->cd_list, node); - node_list->data = node_list->next->data; - node_list->next->data = node; + if (node_list->next) + { + node_list->data = node_list->next->data; + node_list->next->data = node; + } } static gint diff --git a/app/gdisplay.c b/app/gdisplay.c index aef8788f4f..502e86d9b1 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -1261,10 +1261,11 @@ gdisplay_display_area (GDisplay *gdisp, int i, j; GList *list; guchar *buf; - int bpp; + int bpp, bpl; buf = gximage_get_data (); bpp = gximage_get_bpp (); + bpl = gximage_get_bpl (); sx = SCALEX (gdisp, gdisp->gimage->width); sy = SCALEY (gdisp, gdisp->gimage->height); @@ -1347,7 +1348,7 @@ gdisplay_display_area (GDisplay *gdisp, while (list) { ColorDisplayNode *node = (ColorDisplayNode *) list->data; - node->cd_convert (node->cd_ID, buf, dx, dy, bpp); + node->cd_convert (node->cd_ID, buf, dx, dy, bpp, bpl); list = list->next; } diff --git a/app/gdisplay_color.c b/app/gdisplay_color.c index 6a9f160c6c..35135ffdb5 100644 --- a/app/gdisplay_color.c +++ b/app/gdisplay_color.c @@ -242,8 +242,11 @@ gdisplay_color_reorder_up (GDisplay *gdisp, node_list = g_list_find (gdisp->cd_list, node); - node_list->data = node_list->prev->data; - node_list->prev->data = node; + if (node_list->prev) + { + node_list->data = node_list->prev->data; + node_list->prev->data = node; + } } void @@ -254,8 +257,11 @@ gdisplay_color_reorder_down (GDisplay *gdisp, node_list = g_list_find (gdisp->cd_list, node); - node_list->data = node_list->next->data; - node_list->next->data = node; + if (node_list->next) + { + node_list->data = node_list->next->data; + node_list->next->data = node; + } } static gint diff --git a/app/gdisplay_color_ui.c b/app/gdisplay_color_ui.c index 5248ed1ac6..08a09fe6bb 100644 --- a/app/gdisplay_color_ui.c +++ b/app/gdisplay_color_ui.c @@ -43,7 +43,7 @@ struct _ColorDisplayDialog GDisplay *gdisp; }; -static ColorDisplayDialog cdd = { NULL, NULL, NULL, 0, 0, FALSE, NULL, NULL }; +static ColorDisplayDialog cdd = { NULL, NULL, NULL, -1, -1, FALSE, NULL, NULL }; typedef void (*ButtonCallback) (GtkWidget *, gpointer); @@ -202,7 +202,8 @@ color_display_ok_callback (GtkWidget *widget, g_list_free (cdd.old_nodes); } - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -227,7 +228,8 @@ color_display_cancel_callback (GtkWidget *widget, } } - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -238,8 +240,14 @@ color_display_add_callback (GtkWidget *widget, ColorDisplayNode *node; gint row; + if (cdd.src_row < 0) + return; + gtk_clist_get_text (GTK_CLIST (cdd.src), cdd.src_row, 0, &name); + if (!name) + return; + cdd.modified = TRUE; node = gdisplay_color_attach (cdd.gdisp, name); @@ -247,7 +255,8 @@ color_display_add_callback (GtkWidget *widget, row = gtk_clist_append (GTK_CLIST (cdd.dest), &name); gtk_clist_set_row_data (GTK_CLIST (cdd.dest), row, node); - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -255,6 +264,9 @@ color_display_remove_callback (GtkWidget *widget, gpointer data) { ColorDisplayNode *node; + + if (cdd.dest_row < 0) + return; node = (ColorDisplayNode *) gtk_clist_get_row_data (GTK_CLIST (cdd.dest), cdd.dest_row); @@ -268,7 +280,8 @@ color_display_remove_callback (GtkWidget *widget, else gdisplay_color_detach_destroy (cdd.gdisp, node); - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -277,6 +290,9 @@ color_display_up_callback (GtkWidget *widget, { ColorDisplayNode *node; + if (cdd.dest_row < 0) + return; + node = (ColorDisplayNode *) gtk_clist_get_row_data (GTK_CLIST (cdd.dest), cdd.dest_row); @@ -285,7 +301,8 @@ color_display_up_callback (GtkWidget *widget, gdisplay_color_reorder_up (cdd.gdisp, node); cdd.modified = TRUE; - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -294,15 +311,18 @@ color_display_down_callback (GtkWidget *widget, { ColorDisplayNode *node; + if (cdd.dest_row < 0) + return; + node = (ColorDisplayNode *) gtk_clist_get_row_data (GTK_CLIST (cdd.dest), cdd.dest_row); - gtk_clist_row_move (GTK_CLIST (cdd.dest), cdd.dest_row, cdd.dest_row + 1); gdisplay_color_reorder_down (cdd.gdisp, node); cdd.modified = TRUE; - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -331,6 +351,12 @@ gdisplay_color_ui (GDisplay *gdisp) cdd.gdisp = gdisp; + cdd.src_row = -1; + cdd.dest_row = -1; + + /* gtk_clist_set_selectable (GTK_CLIST (cdd.src), 0, TRUE); + gtk_clist_set_selectable (GTK_CLIST (cdd.dest), 0, TRUE); */ + gtk_widget_show (cdd.shell); } diff --git a/app/path_tool.c b/app/path_tool.c index ae97b3868f..1c8f3f5c48 100644 --- a/app/path_tool.c +++ b/app/path_tool.c @@ -188,7 +188,7 @@ path_traverse_segment (Path *path, PathCurve *curve, PathSegment *segment, Segme fprintf(stderr, "path_traverse_segment\n"); #endif PATH_TOOL_DEBUG - #warning here we need path_curve_get_point(s) + /* XXX: here we need path_curve_get_point(s) */ /* Something like: * for i = 1 to subsamples { @@ -267,7 +267,7 @@ PathSegment * path_append_segment (Path * cur_path, PathCurve * cur_curve, Segm cur_curve->cur_segment = new_segment; - #warning we need initialisation of the segment here. + /* XXX: we need initialisation of the segment here. */ } #ifdef PATH_TOOL_DEBUG @@ -313,7 +313,7 @@ PathSegment * path_prepend_segment (Path * cur_path, PathCurve * cur_curve, Seg cur_curve->segments = new_segment; cur_curve->cur_segment = new_segment; - #warning we need initialisation of the segment here. + /* XXX: we need initialisation of the segment here. */ } #ifdef PATH_TOOL_DEBUG else @@ -339,7 +339,7 @@ PathSegment * path_split_segment (PathSegment *segment, gdouble position) new_segment = g_new (PathSegment, 1); new_segment->type = segment->type; - #warning Giving PathTool as NULL Pointer! + /* XXX: Giving PathTool as NULL Pointer! */ path_curve_get_point (NULL, segment, position, &(new_segment->x), &(new_segment->y)); new_segment->flags = 0; new_segment->parent = segment->parent; @@ -347,7 +347,7 @@ PathSegment * path_split_segment (PathSegment *segment, gdouble position) new_segment->prev = segment; new_segment->data = NULL; - #warning we need initialisation of the segment here. + /* XXX: we need initialisation of the segment here. */ new_segment->next->prev = new_segment; segment->next = new_segment; @@ -390,7 +390,7 @@ path_join_curves (PathSegment *segment1, PathSegment *segment2) { segment2->prev = segment1; segment1->next = segment2; } -#warning Probably some segment-updates needed +/* XXX: Probably some segment-updates needed */ return; } @@ -442,7 +442,7 @@ path_join_curves (PathSegment *segment1, PathSegment *segment2) { tmp->parent = curve1; tmp = tmp->next; } -#warning Probably some segment-updates needed +/* XXX: Probably some segment-updates needed */ return; } @@ -473,7 +473,7 @@ path_join_curves (PathSegment *segment1, PathSegment *segment2) { tmp = tmp->prev; } return; -#warning Probably some segment-updates needed +/* XXX: Probably some segment-updates needed */ } #ifdef PATH_TOOL_DEBUG @@ -495,7 +495,7 @@ path_flip_curve (PathCurve *curve) PathSegment *tmp, *tmp2; -#warning Please add path_curve_flip_segment here +/* XXX: Please add path_curve_flip_segment here */ if (!curve && !curve->segments) { #ifdef PATH_TOOL_DEBUG @@ -526,7 +526,7 @@ path_flip_curve (PathCurve *curve) tmp->data = end_data; } tmp = tmp->next; -#warning Probably some segment-updates needed +/* XXX: Probably some segment-updates needed */ } } @@ -582,7 +582,7 @@ path_free_segment (PathSegment *segment) segment->parent, segment, 0, SEGMENT_ACTIVE); if (segment->data) g_free(segment->data); -#warning Free Segment needs an own hook in the different curve-types! +/* XXX: Free Segment needs an own hook in the different curve-types! */ g_free (segment); } } @@ -632,7 +632,7 @@ path_delete_segment (PathSegment *segment) /* * here we have to update the surrounding segments */ -#warning Please add path_curve_update_segment here +/* XXX: Please add path_curve_update_segment here */ } } @@ -1398,7 +1398,7 @@ path_offset_active_helper (Path *path, PathCurve *curve, PathSegment *segment, g segment->x += data->dx; segment->y += data->dy; } -#warning Do a segment_update here! +/* XXX: Do a segment_update here! */ } void diff --git a/app/tools/path_tool.c b/app/tools/path_tool.c index ae97b3868f..1c8f3f5c48 100644 --- a/app/tools/path_tool.c +++ b/app/tools/path_tool.c @@ -188,7 +188,7 @@ path_traverse_segment (Path *path, PathCurve *curve, PathSegment *segment, Segme fprintf(stderr, "path_traverse_segment\n"); #endif PATH_TOOL_DEBUG - #warning here we need path_curve_get_point(s) + /* XXX: here we need path_curve_get_point(s) */ /* Something like: * for i = 1 to subsamples { @@ -267,7 +267,7 @@ PathSegment * path_append_segment (Path * cur_path, PathCurve * cur_curve, Segm cur_curve->cur_segment = new_segment; - #warning we need initialisation of the segment here. + /* XXX: we need initialisation of the segment here. */ } #ifdef PATH_TOOL_DEBUG @@ -313,7 +313,7 @@ PathSegment * path_prepend_segment (Path * cur_path, PathCurve * cur_curve, Seg cur_curve->segments = new_segment; cur_curve->cur_segment = new_segment; - #warning we need initialisation of the segment here. + /* XXX: we need initialisation of the segment here. */ } #ifdef PATH_TOOL_DEBUG else @@ -339,7 +339,7 @@ PathSegment * path_split_segment (PathSegment *segment, gdouble position) new_segment = g_new (PathSegment, 1); new_segment->type = segment->type; - #warning Giving PathTool as NULL Pointer! + /* XXX: Giving PathTool as NULL Pointer! */ path_curve_get_point (NULL, segment, position, &(new_segment->x), &(new_segment->y)); new_segment->flags = 0; new_segment->parent = segment->parent; @@ -347,7 +347,7 @@ PathSegment * path_split_segment (PathSegment *segment, gdouble position) new_segment->prev = segment; new_segment->data = NULL; - #warning we need initialisation of the segment here. + /* XXX: we need initialisation of the segment here. */ new_segment->next->prev = new_segment; segment->next = new_segment; @@ -390,7 +390,7 @@ path_join_curves (PathSegment *segment1, PathSegment *segment2) { segment2->prev = segment1; segment1->next = segment2; } -#warning Probably some segment-updates needed +/* XXX: Probably some segment-updates needed */ return; } @@ -442,7 +442,7 @@ path_join_curves (PathSegment *segment1, PathSegment *segment2) { tmp->parent = curve1; tmp = tmp->next; } -#warning Probably some segment-updates needed +/* XXX: Probably some segment-updates needed */ return; } @@ -473,7 +473,7 @@ path_join_curves (PathSegment *segment1, PathSegment *segment2) { tmp = tmp->prev; } return; -#warning Probably some segment-updates needed +/* XXX: Probably some segment-updates needed */ } #ifdef PATH_TOOL_DEBUG @@ -495,7 +495,7 @@ path_flip_curve (PathCurve *curve) PathSegment *tmp, *tmp2; -#warning Please add path_curve_flip_segment here +/* XXX: Please add path_curve_flip_segment here */ if (!curve && !curve->segments) { #ifdef PATH_TOOL_DEBUG @@ -526,7 +526,7 @@ path_flip_curve (PathCurve *curve) tmp->data = end_data; } tmp = tmp->next; -#warning Probably some segment-updates needed +/* XXX: Probably some segment-updates needed */ } } @@ -582,7 +582,7 @@ path_free_segment (PathSegment *segment) segment->parent, segment, 0, SEGMENT_ACTIVE); if (segment->data) g_free(segment->data); -#warning Free Segment needs an own hook in the different curve-types! +/* XXX: Free Segment needs an own hook in the different curve-types! */ g_free (segment); } } @@ -632,7 +632,7 @@ path_delete_segment (PathSegment *segment) /* * here we have to update the surrounding segments */ -#warning Please add path_curve_update_segment here +/* XXX: Please add path_curve_update_segment here */ } } @@ -1398,7 +1398,7 @@ path_offset_active_helper (Path *path, PathCurve *curve, PathSegment *segment, g segment->x += data->dx; segment->y += data->dy; } -#warning Do a segment_update here! +/* XXX: Do a segment_update here! */ } void diff --git a/app/widgets/gimpcolordisplayeditor.c b/app/widgets/gimpcolordisplayeditor.c index 5248ed1ac6..08a09fe6bb 100644 --- a/app/widgets/gimpcolordisplayeditor.c +++ b/app/widgets/gimpcolordisplayeditor.c @@ -43,7 +43,7 @@ struct _ColorDisplayDialog GDisplay *gdisp; }; -static ColorDisplayDialog cdd = { NULL, NULL, NULL, 0, 0, FALSE, NULL, NULL }; +static ColorDisplayDialog cdd = { NULL, NULL, NULL, -1, -1, FALSE, NULL, NULL }; typedef void (*ButtonCallback) (GtkWidget *, gpointer); @@ -202,7 +202,8 @@ color_display_ok_callback (GtkWidget *widget, g_list_free (cdd.old_nodes); } - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -227,7 +228,8 @@ color_display_cancel_callback (GtkWidget *widget, } } - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -238,8 +240,14 @@ color_display_add_callback (GtkWidget *widget, ColorDisplayNode *node; gint row; + if (cdd.src_row < 0) + return; + gtk_clist_get_text (GTK_CLIST (cdd.src), cdd.src_row, 0, &name); + if (!name) + return; + cdd.modified = TRUE; node = gdisplay_color_attach (cdd.gdisp, name); @@ -247,7 +255,8 @@ color_display_add_callback (GtkWidget *widget, row = gtk_clist_append (GTK_CLIST (cdd.dest), &name); gtk_clist_set_row_data (GTK_CLIST (cdd.dest), row, node); - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -255,6 +264,9 @@ color_display_remove_callback (GtkWidget *widget, gpointer data) { ColorDisplayNode *node; + + if (cdd.dest_row < 0) + return; node = (ColorDisplayNode *) gtk_clist_get_row_data (GTK_CLIST (cdd.dest), cdd.dest_row); @@ -268,7 +280,8 @@ color_display_remove_callback (GtkWidget *widget, else gdisplay_color_detach_destroy (cdd.gdisp, node); - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -277,6 +290,9 @@ color_display_up_callback (GtkWidget *widget, { ColorDisplayNode *node; + if (cdd.dest_row < 0) + return; + node = (ColorDisplayNode *) gtk_clist_get_row_data (GTK_CLIST (cdd.dest), cdd.dest_row); @@ -285,7 +301,8 @@ color_display_up_callback (GtkWidget *widget, gdisplay_color_reorder_up (cdd.gdisp, node); cdd.modified = TRUE; - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -294,15 +311,18 @@ color_display_down_callback (GtkWidget *widget, { ColorDisplayNode *node; + if (cdd.dest_row < 0) + return; + node = (ColorDisplayNode *) gtk_clist_get_row_data (GTK_CLIST (cdd.dest), cdd.dest_row); - gtk_clist_row_move (GTK_CLIST (cdd.dest), cdd.dest_row, cdd.dest_row + 1); gdisplay_color_reorder_down (cdd.gdisp, node); cdd.modified = TRUE; - gdisplays_flush (); + gdisplay_expose_full (cdd.gdisp); + gdisplay_flush (cdd.gdisp); } static void @@ -331,6 +351,12 @@ gdisplay_color_ui (GDisplay *gdisp) cdd.gdisp = gdisp; + cdd.src_row = -1; + cdd.dest_row = -1; + + /* gtk_clist_set_selectable (GTK_CLIST (cdd.src), 0, TRUE); + gtk_clist_set_selectable (GTK_CLIST (cdd.dest), 0, TRUE); */ + gtk_widget_show (cdd.shell); } diff --git a/libgimp/color_display.h b/libgimp/color_display.h index 4e955786b6..f323f2297d 100644 --- a/libgimp/color_display.h +++ b/libgimp/color_display.h @@ -29,7 +29,8 @@ typedef void (*GimpColorDisplayConvert) (gpointer cd_ID, guchar *buf, int width, int height, - int bpp); + int bpp, + int bpl); typedef void (*GimpColorDisplayDestroy) (gpointer cd_ID); typedef void (*GimpColorDisplayFinalize) (void); typedef void (*GimpColorDisplayLoadState) (gpointer cd_ID, diff --git a/libgimp/gimpcolordisplay.h b/libgimp/gimpcolordisplay.h index 4e955786b6..f323f2297d 100644 --- a/libgimp/gimpcolordisplay.h +++ b/libgimp/gimpcolordisplay.h @@ -29,7 +29,8 @@ typedef void (*GimpColorDisplayConvert) (gpointer cd_ID, guchar *buf, int width, int height, - int bpp); + int bpp, + int bpl); typedef void (*GimpColorDisplayDestroy) (gpointer cd_ID); typedef void (*GimpColorDisplayFinalize) (void); typedef void (*GimpColorDisplayLoadState) (gpointer cd_ID, diff --git a/modules/cdisplay_gamma.c b/modules/cdisplay_gamma.c index dc532ba469..2ffacc6e93 100644 --- a/modules/cdisplay_gamma.c +++ b/modules/cdisplay_gamma.c @@ -44,9 +44,10 @@ static void gamma_create_lookup_table (GammaContext *context); static void gamma_destroy (gpointer cd_ID); static void gamma_convert (gpointer cd_ID, guchar *buf, - int width, - int height, - int bpp); + int w, + int h, + int bpp, + int bpl); static void gamma_load (gpointer cd_ID, Parasite *state); static Parasite * gamma_save (gpointer cd_ID); @@ -116,6 +117,7 @@ gamma_new (int type) context->lookup[i] = i; gamma_create_lookup_table (context); + return context; } @@ -155,13 +157,36 @@ gamma_convert (gpointer cd_ID, guchar *buf, int width, int height, - int bpp) + int bpp, + int bpl) { - int i; guchar *lookup = ((GammaContext *) cd_ID)->lookup; + int i, j = height; - for (i = 0; i < width * height * bpp; i++) - *buf++ = lookup[*buf]; + /* You will not be using the entire buffer most of the time. + * Hence, the simplistic code for this is as follows: + * + * for (j = 0; j < height; j++) + * { + * for (i = 0; i < width * bpp; i++) + * buf[i] = lookup[buf[i]]; + * buf += bpl; + * } + */ + + width *= bpp; + bpl -= width; + + while (j--) + { + i = width; + while (i--) + { + *buf = lookup[*buf]; + buf++; + } + buf += bpl; + } } static void