Mercurial > geeqie.yaz
comparison src/image-overlay.c @ 1439:2441a90c4bcf
compute histogram in idle time
author | nadvornik |
---|---|
date | Sun, 15 Mar 2009 11:34:09 +0000 |
parents | b4ad1d201279 |
children | 3265830658cd |
comparison
equal
deleted
inserted
replaced
1438:9141908e0609 | 1439:2441a90c4bcf |
---|---|
35 | 35 |
36 typedef struct _OverlayStateData OverlayStateData; | 36 typedef struct _OverlayStateData OverlayStateData; |
37 struct _OverlayStateData { | 37 struct _OverlayStateData { |
38 ImageWindow *imd; | 38 ImageWindow *imd; |
39 ImageState changed_states; | 39 ImageState changed_states; |
40 NotifyType notify; | |
40 | 41 |
41 Histogram *histogram; | 42 Histogram *histogram; |
42 | 43 |
43 OsdShowFlags show; | 44 OsdShowFlags show; |
44 | 45 |
555 | 556 |
556 with_hist = ((osd->show & OSD_SHOW_HISTOGRAM) && osd->histogram); | 557 with_hist = ((osd->show & OSD_SHOW_HISTOGRAM) && osd->histogram); |
557 if (with_hist) | 558 if (with_hist) |
558 { | 559 { |
559 histmap = histmap_get(imd->image_fd); | 560 histmap = histmap_get(imd->image_fd); |
560 if (!histmap) with_hist = FALSE; | 561 if (!histmap) |
562 { | |
563 histmap_start_idle(imd->image_fd); | |
564 with_hist = FALSE; | |
565 } | |
561 } | 566 } |
562 | 567 |
563 | 568 |
564 { | 569 { |
565 gint active_marks = 0; | 570 gint active_marks = 0; |
827 if (osd->show & OSD_SHOW_INFO) | 832 if (osd->show & OSD_SHOW_INFO) |
828 { | 833 { |
829 /* redraw when the image was changed, | 834 /* redraw when the image was changed, |
830 with histogram we have to redraw also when loading is finished */ | 835 with histogram we have to redraw also when loading is finished */ |
831 if (osd->changed_states & IMAGE_STATE_IMAGE || | 836 if (osd->changed_states & IMAGE_STATE_IMAGE || |
832 (osd->changed_states & IMAGE_STATE_LOADING && osd->show & OSD_SHOW_HISTOGRAM)) | 837 (osd->changed_states & IMAGE_STATE_LOADING && osd->show & OSD_SHOW_HISTOGRAM) || |
838 osd->notify & NOTIFY_HISTMAP) | |
833 { | 839 { |
834 GdkPixbuf *pixbuf; | 840 GdkPixbuf *pixbuf; |
835 | 841 |
836 pixbuf = image_osd_info_render(osd); | 842 pixbuf = image_osd_info_render(osd); |
837 if (pixbuf) | 843 if (pixbuf) |
882 image_osd_icons_hide(osd); | 888 image_osd_icons_hide(osd); |
883 } | 889 } |
884 | 890 |
885 if (osd->imd->il && image_loader_get_is_done(osd->imd->il)) | 891 if (osd->imd->il && image_loader_get_is_done(osd->imd->il)) |
886 osd->changed_states = IMAGE_STATE_NONE; | 892 osd->changed_states = IMAGE_STATE_NONE; |
893 osd->notify = 0; | |
887 osd->idle_id = -1; | 894 osd->idle_id = -1; |
888 return FALSE; | 895 return FALSE; |
889 } | 896 } |
890 | 897 |
891 static void image_osd_update_schedule(OverlayStateData *osd, gboolean force) | 898 static void image_osd_update_schedule(OverlayStateData *osd, gboolean force) |
956 | 963 |
957 osd->changed_states |= state; | 964 osd->changed_states |= state; |
958 image_osd_update_schedule(osd, FALSE); | 965 image_osd_update_schedule(osd, FALSE); |
959 } | 966 } |
960 | 967 |
968 static void image_osd_notify_cb(FileData *fd, NotifyType type, gpointer data) | |
969 { | |
970 OverlayStateData *osd = data; | |
971 | |
972 if ((type & (NOTIFY_HISTMAP)) && osd->imd && fd == osd->imd->image_fd) | |
973 { | |
974 osd->notify |= type; | |
975 image_osd_update_schedule(osd, FALSE); | |
976 } | |
977 } | |
978 | |
979 | |
961 static void image_osd_free(OverlayStateData *osd) | 980 static void image_osd_free(OverlayStateData *osd) |
962 { | 981 { |
963 if (!osd) return; | 982 if (!osd) return; |
964 | 983 |
965 if (osd->idle_id != -1) g_source_remove(osd->idle_id); | 984 if (osd->idle_id != -1) g_source_remove(osd->idle_id); |
966 if (osd->timer_id != -1) g_source_remove(osd->timer_id); | 985 if (osd->timer_id != -1) g_source_remove(osd->timer_id); |
986 | |
987 file_data_unregister_notify_func(image_osd_notify_cb, osd); | |
967 | 988 |
968 if (osd->imd) | 989 if (osd->imd) |
969 { | 990 { |
970 image_set_osd_data(osd->imd, NULL); | 991 image_set_osd_data(osd->imd, NULL); |
971 g_signal_handler_disconnect(osd->imd->pr, osd->destroy_id); | 992 g_signal_handler_disconnect(osd->imd->pr, osd->destroy_id); |
1015 osd->destroy_id = g_signal_connect(G_OBJECT(imd->pr), "destroy", | 1036 osd->destroy_id = g_signal_connect(G_OBJECT(imd->pr), "destroy", |
1016 G_CALLBACK(image_osd_destroy_cb), osd); | 1037 G_CALLBACK(image_osd_destroy_cb), osd); |
1017 image_set_osd_data(imd, osd); | 1038 image_set_osd_data(imd, osd); |
1018 | 1039 |
1019 image_set_state_func(osd->imd, image_osd_state_cb, osd); | 1040 image_set_state_func(osd->imd, image_osd_state_cb, osd); |
1041 file_data_register_notify_func(image_osd_notify_cb, osd, NOTIFY_PRIORITY_LOW); | |
1020 } | 1042 } |
1021 | 1043 |
1022 if (show & OSD_SHOW_STATUS) | 1044 if (show & OSD_SHOW_STATUS) |
1023 image_osd_icon(imd, IMAGE_OSD_ICON, -1); | 1045 image_osd_icon(imd, IMAGE_OSD_ICON, -1); |
1024 | 1046 |