comparison src/image.c @ 386:0226daf8c30b

in debug mode print time information on selected events
author nadvornik
date Wed, 16 Apr 2008 20:15:42 +0000
parents df868b947aa0
children c4080362d619
comparison
equal deleted inserted replaced
385:2c06e06f4236 386:0226daf8c30b
114 114
115 static void image_complete_util(ImageWindow *imd, gint preload) 115 static void image_complete_util(ImageWindow *imd, gint preload)
116 { 116 {
117 if (imd->il && image_get_pixbuf(imd) != image_loader_get_pixbuf(imd->il)) return; 117 if (imd->il && image_get_pixbuf(imd) != image_loader_get_pixbuf(imd->il)) return;
118 118
119 if (debug) printf("image load completed \"%s\" (%s)\n", 119 if (debug) printf("%s image load completed \"%s\" (%s)\n", get_exec_time(),
120 (preload) ? (imd->read_ahead_fd ? imd->read_ahead_fd->path : "null") : 120 (preload) ? (imd->read_ahead_fd ? imd->read_ahead_fd->path : "null") :
121 (imd->image_fd ? imd->image_fd->path : "null"), 121 (imd->image_fd ? imd->image_fd->path : "null"),
122 (preload) ? "preload" : "current"); 122 (preload) ? "preload" : "current");
123 123
124 if (!preload) imd->completed = TRUE; 124 if (!preload) imd->completed = TRUE;
287 0.50, 0.50); 287 0.50, 0.50);
288 } 288 }
289 289
290 if (exif_rotate) image_state_set(imd, IMAGE_STATE_ROTATE_AUTO); 290 if (exif_rotate) image_state_set(imd, IMAGE_STATE_ROTATE_AUTO);
291 layout_image_overlay_update(layout_find_by_image(imd)); 291 layout_image_overlay_update(layout_find_by_image(imd));
292 if (debug) printf("%s image postprocess done: %s\n", get_exec_time(), imd->image_fd->name);
292 } 293 }
293 294
294 static void image_post_process_alter(ImageWindow *imd, gint clamp) 295 static void image_post_process_alter(ImageWindow *imd, gint clamp)
295 { 296 {
296 if (imd->delay_alter_type != ALTER_NONE) 297 if (imd->delay_alter_type != ALTER_NONE)
310 return; 311 return;
311 } 312 }
312 313
313 imd->cm = NULL; 314 imd->cm = NULL;
314 image_state_set(imd, IMAGE_STATE_COLOR_ADJ); 315 image_state_set(imd, IMAGE_STATE_COLOR_ADJ);
316 if (debug) printf("%s image postprocess cm done: %s\n", get_exec_time(), imd->image_fd->name);
315 317
316 image_post_process_alter(imd, FALSE); 318 image_post_process_alter(imd, FALSE);
317 319
318 image_read_ahead_start(imd); 320 image_read_ahead_start(imd);
319 } 321 }
424 static void image_post_process(ImageWindow *imd, gint clamp) 426 static void image_post_process(ImageWindow *imd, gint clamp)
425 { 427 {
426 ExifData *exif = NULL; 428 ExifData *exif = NULL;
427 429
428 if (!image_get_pixbuf(imd)) return; 430 if (!image_get_pixbuf(imd)) return;
431
432 if (debug) printf("%s image postprocess: %s\n", get_exec_time(), imd->image_fd->name);
429 433
430 if (options->image.exif_rotate_enable || 434 if (options->image.exif_rotate_enable ||
431 (imd->color_profile_enable && imd->color_profile_use_image) ) 435 (imd->color_profile_enable && imd->color_profile_use_image) )
432 { 436 {
433 exif = exif_read_fd(imd->image_fd, (imd->color_profile_enable && imd->color_profile_use_image)); 437 exif = exif_read_fd(imd->image_fd, (imd->color_profile_enable && imd->color_profile_use_image));
514 *------------------------------------------------------------------- 518 *-------------------------------------------------------------------
515 */ 519 */
516 520
517 static void image_read_ahead_cancel(ImageWindow *imd) 521 static void image_read_ahead_cancel(ImageWindow *imd)
518 { 522 {
519 if (debug) printf("read ahead cancelled for :%s\n", imd->read_ahead_fd ? imd->read_ahead_fd->path : "null"); 523 if (debug) printf("%s read ahead cancelled for :%s\n", get_exec_time(), imd->read_ahead_fd ? imd->read_ahead_fd->path : "null");
520 524
521 image_loader_free(imd->read_ahead_il); 525 image_loader_free(imd->read_ahead_il);
522 imd->read_ahead_il = NULL; 526 imd->read_ahead_il = NULL;
523 527
524 if (imd->read_ahead_pixbuf) g_object_unref(imd->read_ahead_pixbuf); 528 if (imd->read_ahead_pixbuf) g_object_unref(imd->read_ahead_pixbuf);
530 534
531 static void image_read_ahead_done_cb(ImageLoader *il, gpointer data) 535 static void image_read_ahead_done_cb(ImageLoader *il, gpointer data)
532 { 536 {
533 ImageWindow *imd = data; 537 ImageWindow *imd = data;
534 538
535 if (debug) printf("read ahead done for :%s\n", imd->read_ahead_fd->path); 539 if (debug) printf("%s read ahead done for :%s\n", get_exec_time(), imd->read_ahead_fd->path);
536 540
537 imd->read_ahead_pixbuf = image_loader_get_pixbuf(imd->read_ahead_il); 541 imd->read_ahead_pixbuf = image_loader_get_pixbuf(imd->read_ahead_il);
538 if (imd->read_ahead_pixbuf) 542 if (imd->read_ahead_pixbuf)
539 { 543 {
540 g_object_ref(imd->read_ahead_pixbuf); 544 g_object_ref(imd->read_ahead_pixbuf);
561 if (!imd->read_ahead_fd || imd->read_ahead_il || imd->read_ahead_pixbuf) return; 565 if (!imd->read_ahead_fd || imd->read_ahead_il || imd->read_ahead_pixbuf) return;
562 566
563 /* still loading ?, do later */ 567 /* still loading ?, do later */
564 if (imd->il || imd->cm) return; 568 if (imd->il || imd->cm) return;
565 569
566 if (debug) printf("read ahead started for :%s\n", imd->read_ahead_fd->path); 570 if (debug) printf("%s read ahead started for :%s\n", get_exec_time(), imd->read_ahead_fd->path);
567 571
568 imd->read_ahead_il = image_loader_new(imd->read_ahead_fd); 572 imd->read_ahead_il = image_loader_new(imd->read_ahead_fd);
569 573
570 image_loader_set_error_func(imd->read_ahead_il, image_read_ahead_error_cb, imd); 574 image_loader_set_error_func(imd->read_ahead_il, image_read_ahead_error_cb, imd);
571 if (!image_loader_start(imd->read_ahead_il, image_read_ahead_done_cb, imd)) 575 if (!image_loader_start(imd->read_ahead_il, image_read_ahead_done_cb, imd))
612 imd->prev_fd = NULL; 616 imd->prev_fd = NULL;
613 imd->prev_pixbuf = NULL; 617 imd->prev_pixbuf = NULL;
614 imd->prev_color_row = -1; 618 imd->prev_color_row = -1;
615 } 619 }
616 620
617 if (debug) printf("post buffer set: %s\n", fd ? fd->path : "null"); 621 if (debug) printf("%s post buffer set: %s\n", get_exec_time(), fd ? fd->path : "null");
618 } 622 }
619 623
620 static gint image_post_buffer_get(ImageWindow *imd) 624 static gint image_post_buffer_get(ImageWindow *imd)
621 { 625 {
622 gint success; 626 gint success;
682 686
683 static void image_load_done_cb(ImageLoader *il, gpointer data) 687 static void image_load_done_cb(ImageLoader *il, gpointer data)
684 { 688 {
685 ImageWindow *imd = data; 689 ImageWindow *imd = data;
686 690
687 if (debug) printf ("image done\n"); 691 if (debug) printf ("%s image done\n", get_exec_time());
688 692
689 g_object_set(G_OBJECT(imd->pr), "loading", FALSE, NULL); 693 g_object_set(G_OBJECT(imd->pr), "loading", FALSE, NULL);
690 image_state_unset(imd, IMAGE_STATE_LOADING); 694 image_state_unset(imd, IMAGE_STATE_LOADING);
691 695
692 if (imd->delay_flip && 696 if (imd->delay_flip &&
704 image_read_ahead_start(imd); 708 image_read_ahead_start(imd);
705 } 709 }
706 710
707 static void image_load_error_cb(ImageLoader *il, gpointer data) 711 static void image_load_error_cb(ImageLoader *il, gpointer data)
708 { 712 {
709 if (debug) printf ("image error\n"); 713 if (debug) printf ("%s image error\n", get_exec_time());
710 714
711 /* even on error handle it like it was done, 715 /* even on error handle it like it was done,
712 * since we have a pixbuf with _something_ */ 716 * since we have a pixbuf with _something_ */
713 717
714 image_load_done_cb(il, data); 718 image_load_done_cb(il, data);
785 return FALSE; 789 return FALSE;
786 } 790 }
787 791
788 static gint image_load_begin(ImageWindow *imd, FileData *fd) 792 static gint image_load_begin(ImageWindow *imd, FileData *fd)
789 { 793 {
790 if (debug) printf ("image begin \n"); 794 if (debug) printf ("%s image begin \n", get_exec_time());
791 795
792 if (imd->il) return FALSE; 796 if (imd->il) return FALSE;
793 797
794 imd->completed = FALSE; 798 imd->completed = FALSE;
795 g_object_set(G_OBJECT(imd->pr), "complete", FALSE, NULL); 799 g_object_set(G_OBJECT(imd->pr), "complete", FALSE, NULL);
850 854
851 static void image_reset(ImageWindow *imd) 855 static void image_reset(ImageWindow *imd)
852 { 856 {
853 /* stops anything currently being done */ 857 /* stops anything currently being done */
854 858
855 if (debug) printf("image reset\n"); 859 if (debug) printf("%s image reset\n", get_exec_time());
856 860
857 g_object_set(G_OBJECT(imd->pr), "loading", FALSE, NULL); 861 g_object_set(G_OBJECT(imd->pr), "loading", FALSE, NULL);
858 862
859 image_loader_free(imd->il); 863 image_loader_free(imd->il);
860 imd->il = NULL; 864 imd->il = NULL;