Mercurial > geeqie
comparison src/image-overlay.c @ 1294:7ac9664242b2
histogram caching
histogram interface prepared for histogram pane
author | nadvornik |
---|---|
date | Sun, 15 Feb 2009 13:11:21 +0000 |
parents | 10073464e6aa |
children | 9b59d40030d2 |
comparison
equal
deleted
inserted
replaced
1293:48e064b37ba6 | 1294:7ac9664242b2 |
---|---|
440 PangoLayout *layout; | 440 PangoLayout *layout; |
441 const gchar *name; | 441 const gchar *name; |
442 gchar *text; | 442 gchar *text; |
443 GdkPixbuf *imgpixbuf = NULL; | 443 GdkPixbuf *imgpixbuf = NULL; |
444 gboolean with_hist; | 444 gboolean with_hist; |
445 HistMap *histmap; | |
445 ImageWindow *imd = osd->imd; | 446 ImageWindow *imd = osd->imd; |
446 FileData *fd = image_get_fd(imd); | 447 FileData *fd = image_get_fd(imd); |
447 | 448 |
448 if (!fd) return NULL; | 449 if (!fd) return NULL; |
449 | 450 |
551 } else { | 552 } else { |
552 /* When does this occur ?? */ | 553 /* When does this occur ?? */ |
553 text = g_markup_escape_text(_("Untitled"), -1); | 554 text = g_markup_escape_text(_("Untitled"), -1); |
554 } | 555 } |
555 | 556 |
556 with_hist = (imgpixbuf && (osd->show & OSD_SHOW_HISTOGRAM) && osd->histogram && (!imd->il || image_loader_get_is_done(imd->il))); | 557 with_hist = ((osd->show & OSD_SHOW_HISTOGRAM) && osd->histogram); |
558 if (with_hist) | |
559 { | |
560 histmap = histmap_get(imd->image_fd); | |
561 if (!histmap) with_hist = FALSE; | |
562 } | |
563 | |
557 | 564 |
558 { | 565 { |
559 gint active_marks = 0; | 566 gint active_marks = 0; |
560 gint mark; | 567 gint mark; |
561 gchar *text2; | 568 gchar *text2; |
609 if (width > 0) width += 10; | 616 if (width > 0) width += 10; |
610 if (height > 0) height += 10; | 617 if (height > 0) height += 10; |
611 | 618 |
612 if (with_hist) | 619 if (with_hist) |
613 { | 620 { |
614 histogram_read(osd->histogram, imgpixbuf); | |
615 if (width < HISTOGRAM_WIDTH + 10) width = HISTOGRAM_WIDTH + 10; | 621 if (width < HISTOGRAM_WIDTH + 10) width = HISTOGRAM_WIDTH + 10; |
616 height += HISTOGRAM_HEIGHT + 5; | 622 height += HISTOGRAM_HEIGHT + 5; |
617 } | 623 } |
618 | 624 |
619 if (width > 0 && height > 0) | 625 if (width > 0 && height > 0) |
647 | 653 |
648 pixbuf_set_rect(pixbuf, x + xoffset + 0.5, y, add + d + 0.5, HISTOGRAM_HEIGHT, c, c, c, alpha, d, 1, 1, 1); | 654 pixbuf_set_rect(pixbuf, x + xoffset + 0.5, y, add + d + 0.5, HISTOGRAM_HEIGHT, c, c, c, alpha, d, 1, 1, 1); |
649 xoffset += add+d; | 655 xoffset += add+d; |
650 } | 656 } |
651 | 657 |
652 histogram_draw(osd->histogram, pixbuf, x, y, w, HISTOGRAM_HEIGHT); | 658 histogram_draw(osd->histogram, histmap, pixbuf, x, y, w, HISTOGRAM_HEIGHT); |
653 } | 659 } |
654 pixbuf_draw_layout(pixbuf, layout, imd->pr, 5, 5, 0, 0, 0, 255); | 660 pixbuf_draw_layout(pixbuf, layout, imd->pr, 5, 5, 0, 0, 0, 255); |
655 } | 661 } |
656 | 662 |
657 g_object_unref(G_OBJECT(layout)); | 663 g_object_unref(G_OBJECT(layout)); |