summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ed0f6a6)
raw | patch | inline | side by side (parent: ed0f6a6)
author | joncruz <joncruz@users.sourceforge.net> | |
Wed, 18 Feb 2009 08:56:07 +0000 (08:56 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Wed, 18 Feb 2009 08:56:07 +0000 (08:56 +0000) |
src/dialogs/eek-preview.cpp | patch | blob | history | |
src/dialogs/eek-preview.h | patch | blob | history |
index e0d0fb4e2d98c145f44c51bd4c2d838bd0e9cb76..1c1adf54331641f66445df4954dea02b34ef061c 100644 (file)
preview->_previewPixbuf = pixbuf;
gtk_widget_queue_draw(GTK_WIDGET(preview));
+
+ if (preview->_scaled) {
+ g_object_unref(preview->_scaled);
+ preview->_scaled = 0;
+ }
+ preview->_scaledW = gdk_pixbuf_get_width(preview->_previewPixbuf);
+ preview->_scaledH = gdk_pixbuf_get_height(preview->_previewPixbuf);
}
gint w = 0;
gint h = 0;
gdk_drawable_get_size(drawable, &w, &h);
- gdk_draw_pixbuf( drawable, 0, preview->_previewPixbuf, 0, 0, 0, 0, w, h, GDK_RGB_DITHER_NONE, 0, 0 );
+ if ((w != preview->_scaledW) || (h != preview->_scaledH)) {
+ if (preview->_scaled) {
+ g_object_unref(preview->_scaled);
+ }
+ preview->_scaled = gdk_pixbuf_scale_simple(preview->_previewPixbuf, w, h, GDK_INTERP_BILINEAR);
+ preview->_scaledW = w;
+ preview->_scaledH = h;
+ }
+
+ GdkPixbuf* pix = (preview->_scaled) ? preview->_scaled : preview->_previewPixbuf;
+ gdk_draw_pixbuf( drawable, 0, pix, 0, 0, 0, 0, w, h, GDK_RGB_DITHER_NONE, 0, 0 );
}
preview->_r = 0x80;
preview->_g = 0x80;
preview->_b = 0xcc;
+ preview->_scaledW = 0;
+ preview->_scaledH = 0;
preview->_hot = FALSE;
preview->_within = FALSE;
preview->_ratio = 100;
preview->_previewPixbuf = 0;
+ preview->_scaled = 0;
/*
GdkColor color = {0};
index e4d935ae92395266a16e06c4d051eee6fb1af78b..6eb5c8930cd8e4fe8906eec408ffe8815c1876b6 100644 (file)
int _r;
int _g;
int _b;
+ int _scaledW;
+ int _scaledH;
gboolean _hot;
gboolean _within;
guint _ratio;
guint _linked;
GdkPixbuf* _previewPixbuf;
+ GdkPixbuf* _scaled;
};
struct _EekPreviewClass