Mercurial > audlegacy
changeset 3077:4b076ad636e6
use GdkPixmaps for doublesizing
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Sat, 14 Jul 2007 12:45:03 +0200 |
parents | 7f1f6688c32c |
children | 407395e030c7 |
files | src/audacious/ui_equalizer.c src/audacious/ui_main.c src/audacious/ui_skinned_button.c src/audacious/ui_skinned_horizontal_slider.c src/audacious/ui_skinned_menurow.c src/audacious/ui_skinned_monostereo.c src/audacious/ui_skinned_playstatus.c src/audacious/ui_skinned_textbox.c src/audacious/util.c src/audacious/util.h |
diffstat | 10 files changed, 60 insertions(+), 89 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/ui_equalizer.c Sat Jul 14 00:01:14 2007 +0200 +++ b/src/audacious/ui_equalizer.c Sat Jul 14 12:45:03 2007 +0200 @@ -307,12 +307,10 @@ if (force || redraw) { if (cfg.doublesize && cfg.eq_doublesize_linked) { if (force) { - img = gdk_drawable_get_image(equalizerwin_bg, 0, 0, 275, 116); - img2x = create_dblsize_image(img); - gdk_draw_image(equalizerwin_bg_x2, SKINNED_WINDOW(equalizerwin)->gc, - img2x, 0, 0, 0, 0, 550, 232); - g_object_unref(img2x); - g_object_unref(img); + GdkPixmap *img2; + img2 = create_dblsize_pixmap(equalizerwin_bg); + gdk_draw_drawable(equalizerwin_bg_x2, SKINNED_WINDOW(equalizerwin)->gc, img2, 0, 0, 0, 0, 550, 232); + g_object_unref(img2); } else { for (wl = equalizerwin_wlist; wl; wl = g_list_next(wl)) {
--- a/src/audacious/ui_main.c Sat Jul 14 00:01:14 2007 +0200 +++ b/src/audacious/ui_main.c Sat Jul 14 12:45:03 2007 +0200 @@ -549,8 +549,6 @@ void draw_main_window(gboolean force) { - GdkImage *img, *img2x; - if (!cfg.player_visible) return; @@ -568,17 +566,13 @@ if (force) { if (cfg.doublesize) { - img = gdk_drawable_get_image(mainwin_bg, 0, 0, bmp_active_skin->properties.mainwin_width, - cfg.player_shaded ? - MAINWIN_SHADED_HEIGHT : - bmp_active_skin->properties.mainwin_height); - img2x = create_dblsize_image(img); - gdk_draw_image(mainwin_bg_x2, SKINNED_WINDOW(mainwin)->gc, img2x, 0, 0, + GdkPixmap *img2x = NULL; + img2x = create_dblsize_pixmap(mainwin_bg); + gdk_draw_drawable(mainwin_bg_x2, SKINNED_WINDOW(mainwin)->gc, img2x, 0, 0, 0, 0, bmp_active_skin->properties.mainwin_width * 2, cfg.player_shaded ? MAINWIN_SHADED_HEIGHT * 2 : bmp_active_skin->properties.mainwin_height * 2); g_object_unref(img2x); - g_object_unref(img); } GList *iter; for (iter = GTK_FIXED (SKINNED_WINDOW(mainwin)->fixed)->children; iter; iter = g_list_next (iter)) {
--- a/src/audacious/ui_skinned_button.c Sat Jul 14 00:01:14 2007 +0200 +++ b/src/audacious/ui_skinned_button.c Sat Jul 14 12:45:03 2007 +0200 @@ -344,20 +344,14 @@ break; } - GdkPixmap *image; - image = gdk_pixmap_new(NULL, priv->w*(1+priv->double_size), - priv->h*(1+priv->double_size), - gdk_rgb_get_visual()->depth); + GdkPixmap *image = NULL; if (priv->double_size) { - GdkImage *img, *img2x; - img = gdk_drawable_get_image(obj, 0, 0, priv->w, priv->h); - img2x = create_dblsize_image(img); - gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, priv->w*2, priv->h*2); - g_object_unref(img2x); - g_object_unref(img); - } else + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, priv->w, priv->h, gdk_rgb_get_visual()->depth); gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, priv->w, priv->h); + } g_object_unref(obj);
--- a/src/audacious/ui_skinned_horizontal_slider.c Sat Jul 14 00:01:14 2007 +0200 +++ b/src/audacious/ui_skinned_horizontal_slider.c Sat Jul 14 12:45:03 2007 +0200 @@ -263,21 +263,14 @@ ((priv->height - priv->knob_height) / 2), priv->knob_width, priv->knob_height); - GdkPixmap *image; - image = gdk_pixmap_new(NULL, priv->width*(1+priv->double_size), - priv->height*(1+priv->double_size), - gdk_rgb_get_visual()->depth); + GdkPixmap *image = NULL; if (priv->double_size) { - GdkImage *img, *img2x; - img = gdk_drawable_get_image(obj, 0, 0, priv->width, priv->height); - img2x = create_dblsize_image(img); - gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, priv->width*2, priv->height*2); - g_object_unref(img2x); - g_object_unref(img); - } else + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth); gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, priv->width, priv->height); - + } g_object_unref(obj);
--- a/src/audacious/ui_skinned_menurow.c Sat Jul 14 00:01:14 2007 +0200 +++ b/src/audacious/ui_skinned_menurow.c Sat Jul 14 12:45:03 2007 +0200 @@ -243,21 +243,14 @@ menurow->sx + 24, menurow->sy + 26, 0, 26, 8, 8); } - GdkPixmap *image; - image = gdk_pixmap_new(NULL, menurow->width*(1+menurow->double_size), - menurow->height*(1+menurow->double_size), - gdk_rgb_get_visual()->depth); + GdkPixmap *image = NULL; if (menurow->double_size) { - GdkImage *img, *img2x; - img = gdk_drawable_get_image(obj, 0, 0, menurow->width, menurow->height); - img2x = create_dblsize_image(img); - gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, menurow->width*2, menurow->height*2); - g_object_unref(img2x); - g_object_unref(img); - } else - gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, menurow->width, menurow->height); - + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, menurow->width, menurow->height, gdk_rgb_get_visual()->depth); + gdk_draw_drawable(image, gc, obj, 0, 0, 0, 0, menurow->width, menurow->height); + } g_object_unref(obj);
--- a/src/audacious/ui_skinned_monostereo.c Sat Jul 14 00:01:14 2007 +0200 +++ b/src/audacious/ui_skinned_monostereo.c Sat Jul 14 12:45:03 2007 +0200 @@ -203,21 +203,14 @@ break; } - GdkPixmap *image; - image = gdk_pixmap_new(NULL, monostereo->width*(1+monostereo->double_size), - monostereo->height*(1+monostereo->double_size), - gdk_rgb_get_visual()->depth); + GdkPixmap *image = NULL; if (monostereo->double_size) { - GdkImage *img, *img2x; - img = gdk_drawable_get_image(obj, 0, 0, monostereo->width, monostereo->height); - img2x = create_dblsize_image(img); - gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, monostereo->width*2, monostereo->height*2); - g_object_unref(img2x); - g_object_unref(img); - } else + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, monostereo->width, monostereo->height, gdk_rgb_get_visual()->depth); gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, monostereo->width, monostereo->height); - + } g_object_unref(obj);
--- a/src/audacious/ui_skinned_playstatus.c Sat Jul 14 00:01:14 2007 +0200 +++ b/src/audacious/ui_skinned_playstatus.c Sat Jul 14 12:45:03 2007 +0200 @@ -208,21 +208,14 @@ break; } - GdkPixmap *image; - image = gdk_pixmap_new(NULL, playstatus->width*(1+playstatus->double_size), - playstatus->height*(1+playstatus->double_size), - gdk_rgb_get_visual()->depth); + GdkPixmap *image = NULL; if (playstatus->double_size) { - GdkImage *img, *img2x; - img = gdk_drawable_get_image(obj, 0, 0, playstatus->width, playstatus->height); - img2x = create_dblsize_image(img); - gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, playstatus->width*2, playstatus->height*2); - g_object_unref(img2x); - g_object_unref(img); - } else + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, playstatus->width, playstatus->height, gdk_rgb_get_visual()->depth); gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, playstatus->width, playstatus->height); - + } g_object_unref(obj);
--- a/src/audacious/ui_skinned_textbox.c Sat Jul 14 00:01:14 2007 +0200 +++ b/src/audacious/ui_skinned_textbox.c Sat Jul 14 12:45:03 2007 +0200 @@ -334,21 +334,14 @@ } - GdkPixmap *image; - image = gdk_pixmap_new(NULL, textbox->width*(1+priv->double_size), - textbox->height*(1+priv->double_size), - gdk_rgb_get_visual()->depth); + GdkPixmap *image = NULL; - if (priv->double_size) { - GdkImage *img, *img2x; - img = gdk_drawable_get_image(obj, 0, 0, textbox->width, textbox->height); - img2x = create_dblsize_image(img); - gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, textbox->width*2, textbox->height*2); - g_object_unref(img2x); - g_object_unref(img); - } else - gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, textbox->width, textbox->height); - + if (priv->double_size) { + image = create_dblsize_pixmap(obj); + } else { + image = gdk_pixmap_new(NULL, textbox->width, textbox->height, gdk_rgb_get_visual()->depth); + gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, textbox->width, textbox->height); + } g_object_unref(obj);
--- a/src/audacious/util.c Sat Jul 14 00:01:14 2007 +0200 +++ b/src/audacious/util.c Sat Jul 14 12:45:03 2007 +0200 @@ -859,6 +859,25 @@ return out; } +GdkPixmap *create_dblsize_pixmap(GdkPixmap *pix) { + int w, h; + gdk_drawable_get_size(pix, &w, &h); + GdkGC* gc = gdk_gc_new(pix); + GdkPixbuf *img, *img2x; + GdkColormap *colormap = gdk_colormap_get_system(); + img = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, w, h); + gdk_pixbuf_get_from_drawable(img, pix, colormap, 0, 0, 0, 0, w, h); + img2x = gdk_pixbuf_scale_simple(img, w*2, h*2, GDK_INTERP_NEAREST); + + GdkPixmap *image; + image = gdk_pixmap_new(NULL, w*2, h*2, gdk_rgb_get_visual()->depth); + gdk_draw_pixbuf(image, gc, img2x, 0, 0, 0, 0, w*2, h*2, GDK_RGB_DITHER_NONE, 0, 0); + g_object_unref(img); + g_object_unref(img2x); + g_object_unref(gc); + return image; +} + GdkImage *create_dblsize_image(GdkImage * img) { #ifdef GDK_WINDOWING_X11
--- a/src/audacious/util.h Sat Jul 14 00:01:14 2007 +0200 +++ b/src/audacious/util.h Sat Jul 14 12:45:03 2007 +0200 @@ -107,6 +107,7 @@ gboolean xmms_check_realtime_priority(void); void xmms_usleep(gint usec); +GdkPixmap *create_dblsize_pixmap(GdkPixmap *pix); GdkImage *create_dblsize_image(GdkImage * img); GdkPixbuf *audacious_create_colorized_pixbuf(GdkPixbuf *src, gint red, gint green, gint blue);