Mercurial > audlegacy
changeset 4196:2b5ea5d4a63e
branch merge
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Sat, 19 Jan 2008 06:04:22 +0100 |
parents | 2281da647da9 (diff) 1ee48928656b (current diff) |
children | bc51ab3fecd5 |
files | |
diffstat | 12 files changed, 286 insertions(+), 311 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/skin.c Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/skin.c Sat Jan 19 06:04:22 2008 +0100 @@ -190,10 +190,15 @@ skin_pixmap_free(SkinPixmap * p) { g_return_if_fail(p != NULL); - g_return_if_fail(p->pixmap != NULL); + g_return_if_fail(p->pixbuf != NULL); + + g_object_unref(p->pixbuf); + p->pixbuf = NULL; - g_object_unref(p->pixmap); - p->pixmap = NULL; + if (p->pixmap) { + g_object_unref(p->pixmap); + p->pixmap = NULL; + } } Skin * @@ -413,8 +418,6 @@ { const SkinPixmapIdMapping *pixmap_id_mapping; gchar *filename; - gint width, height; - GdkPixmap *gpm; SkinPixmap *pm = NULL; g_return_val_if_fail(skin != NULL, FALSE); @@ -428,24 +431,29 @@ if (filename == NULL) return FALSE; - if (!(gpm = pixmap_new_from_file(filename))) { - AUDDBG("loading of %s failed\n", filename); - g_free(filename); - return FALSE; - } + AUDDBG("loaded %s\n", filename); - AUDDBG("loaded %s\n", filename); + pm = &skin->pixmaps[id]; + GdkPixbuf *pix = gdk_pixbuf_new_from_file(filename, NULL); + pm->pixbuf = audacious_create_colorized_pixbuf(pix, cfg.colorize_r, cfg.colorize_g, cfg.colorize_b); + g_object_unref(pix); + if (id == SKIN_EQMAIN) { + GdkPixmap *gpm; + if (!(gpm = pixmap_new_from_file(filename))) { + AUDDBG("loading of %s failed\n", filename); + g_free(filename); + return FALSE; + } + pm->pixmap = gpm; + } else + pm->pixmap = NULL; + pm->width = gdk_pixbuf_get_width(pm->pixbuf); + pm->height = gdk_pixbuf_get_height(pm->pixbuf); + pm->current_width = pm->width; + pm->current_height = pm->height; g_free(filename); - gdk_drawable_get_size(GDK_DRAWABLE(gpm), &width, &height); - pm = &skin->pixmaps[id]; - pm->pixmap = gpm; - pm->width = width; - pm->height = height; - pm->current_width = width; - pm->current_height = height; - return TRUE; } @@ -1400,29 +1408,25 @@ static void skin_numbers_generate_dash(Skin * skin) { - GdkGC *gc; - GdkPixmap *pixmap; + GdkPixbuf *pixbuf; SkinPixmap *numbers; g_return_if_fail(skin != NULL); numbers = &skin->pixmaps[SKIN_NUMBERS]; - if (!numbers->pixmap || numbers->current_width < 99) + if (!numbers->pixbuf || numbers->current_width < 99) return; - pixmap = gdk_pixmap_new(NULL, 108, - numbers->current_height, - gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(pixmap); + pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, + 108, numbers->current_height); - skin_draw_pixmap(NULL, skin, pixmap, gc, SKIN_NUMBERS, 0, 0, 0, 0, 99, numbers->current_height); - skin_draw_pixmap(NULL, skin, pixmap, gc, SKIN_NUMBERS, 90, 0, 99, 0, 9, numbers->current_height); - skin_draw_pixmap(NULL, skin, pixmap, gc, SKIN_NUMBERS, 20, 6, 101, 6, 5, 1); + skin_draw_pixbuf(NULL, skin, pixbuf, SKIN_NUMBERS, 0, 0, 0, 0, 99, numbers->current_height); + skin_draw_pixbuf(NULL, skin, pixbuf, SKIN_NUMBERS, 90, 0, 99, 0, 9, numbers->current_height); + skin_draw_pixbuf(NULL, skin, pixbuf, SKIN_NUMBERS, 20, 6, 101, 6, 5, 1); - g_object_unref(numbers->pixmap); - g_object_unref(gc); + g_object_unref(numbers->pixbuf); - numbers->pixmap = pixmap; + numbers->pixbuf = pixbuf; numbers->current_width = 108; numbers->width = 108; } @@ -1797,6 +1801,7 @@ return skin_current_num; } +/* obsolete, will be removed after equalizer graph transition to GdkPixbuf */ void skin_draw_pixmap(GtkWidget *widget, Skin * skin, GdkDrawable * drawable, GdkGC * gc, SkinPixmapId pixmap_id, @@ -1806,10 +1811,38 @@ SkinPixmap *pixmap; g_return_if_fail(skin != NULL); + g_return_if_fail(pixmap_id == SKIN_EQMAIN); + + pixmap = skin_get_pixmap(skin, pixmap_id); + g_return_if_fail(pixmap != NULL); + g_return_if_fail(pixmap->pixmap != NULL); + + /* perhaps we should use transparency or resize widget? */ + if (xsrc+width > pixmap->width || ysrc+height > pixmap->height) { + if (widget) + if (!(pixmap_id == SKIN_EQMAIN && ysrc == 314)) /* equalizer preamp on equalizer graph */ + gtk_widget_hide(widget); + } + + width = MIN(width, pixmap->width - xsrc); + height = MIN(height, pixmap->height - ysrc); + gdk_draw_pixbuf(drawable, gc, pixmap->pixbuf, xsrc, ysrc, + xdest, ydest, width, height, GDK_RGB_DITHER_NONE, 0, 0); +} + +void +skin_draw_pixbuf(GtkWidget *widget, Skin * skin, GdkPixbuf * pix, + SkinPixmapId pixmap_id, + gint xsrc, gint ysrc, gint xdest, gint ydest, + gint width, gint height) +{ + SkinPixmap *pixmap; + + g_return_if_fail(skin != NULL); pixmap = skin_get_pixmap(skin, pixmap_id); g_return_if_fail(pixmap != NULL); - g_return_if_fail(pixmap->pixmap != NULL); + g_return_if_fail(pixmap->pixbuf != NULL); /* perhaps we should use transparency or resize widget? */ if (xsrc+width > pixmap->width || ysrc+height > pixmap->height) { @@ -1842,8 +1875,8 @@ return; } /* let's copy what's under widget */ - gdk_draw_drawable(drawable, gc, skin_get_pixmap(bmp_active_skin, SKIN_MAIN)->pixmap, - x, y, xdest, ydest, width, height); + gdk_pixbuf_copy_area(skin_get_pixmap(bmp_active_skin, SKIN_MAIN)->pixbuf, + x, y, width, height, pix, xdest, ydest); /* XMMS skins seems to have SKIN_MONOSTEREO with size 58x20 instead of 58x24 */ if (pixmap_id == SKIN_MONOSTEREO) @@ -1862,8 +1895,8 @@ width = MIN(width, pixmap->width - xsrc); height = MIN(height, pixmap->height - ysrc); - gdk_draw_drawable(drawable, gc, pixmap->pixmap, xsrc, ysrc, - xdest, ydest, width, height); + gdk_pixbuf_copy_area(pixmap->pixbuf, xsrc, ysrc, width, height, + pix, xdest, ydest); } void @@ -1897,9 +1930,7 @@ static void -skin_draw_playlistwin_frame_top(Skin * skin, - GdkDrawable * drawable, - GdkGC * gc, +skin_draw_playlistwin_frame_top(Skin * skin, GdkPixbuf * pix, gint width, gint height, gboolean focus) { /* The title bar skin consists of 2 sets of 4 images, 1 set @@ -1923,14 +1954,14 @@ y = 21; /* left corner */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 0, y, 0, 0, 25, 20); + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 0, y, 0, 0, 25, 20); /* titlebar title */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 26, y, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 26, y, (width - 100) / 2, 0, 100, 20); /* titlebar right corner */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 153, y, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 153, y, width - 25, 0, 25, 20); /* tile draw the remaining frame */ @@ -1940,28 +1971,26 @@ for (i = 0; i < c / 2; i++) { /* left of title */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 127, y, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 127, y, 25 + i * 25, 0, 25, 20); /* right of title */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 127, y, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 127, y, (width + 100) / 2 + i * 25, 0, 25, 20); } if (c & 1) { /* Odd tile count, so one remaining to draw. Here we split * it into two and draw half on either side of the title */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 127, y, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 127, y, ((c / 2) * 25) + 25, 0, 12, 20); - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 127, y, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 127, y, (width / 2) + ((c / 2) * 25) + 50, 0, 13, 20); } } static void -skin_draw_playlistwin_frame_bottom(Skin * skin, - GdkDrawable * drawable, - GdkGC * gc, +skin_draw_playlistwin_frame_bottom(Skin * skin, GdkPixbuf * pix, gint width, gint height, gboolean focus) { /* The bottom frame skin consists of 1 set of 4 images. The 4 @@ -1978,7 +2007,7 @@ gint i, c; /* bottom left corner (menu buttons) */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 0, 72, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 0, 72, 0, height - 38, 125, 38); c = (width - 275) / 25; @@ -1986,24 +2015,22 @@ /* draw visualization window, if width allows */ if (c >= 3) { c -= 3; - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 205, 0, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 205, 0, width - (150 + 75), height - 38, 75, 38); } /* Bottom right corner (playbuttons etc) */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 126, 72, width - 150, height - 38, 150, 38); /* Tile draw the remaining undrawn portions */ for (i = 0; i < c; i++) - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 179, 0, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 179, 0, 125 + i * 25, height - 38, 25, 38); } static void -skin_draw_playlistwin_frame_sides(Skin * skin, - GdkDrawable * drawable, - GdkGC * gc, +skin_draw_playlistwin_frame_sides(Skin * skin, GdkPixbuf * pix, gint width, gint height, gboolean focus) { /* The side frames consist of 2 tile images. 1 for the left, 1 for @@ -2017,32 +2044,28 @@ /* frame sides */ for (i = 0; i < (height - (20 + 38)) / 29; i++) { /* left */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 0, 42, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 0, 42, 0, 20 + i * 29, 12, 29); /* right */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 32, 42, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 32, 42, width - 19, 20 + i * 29, 19, 29); } } void -skin_draw_playlistwin_frame(Skin * skin, - GdkDrawable * drawable, GdkGC * gc, +skin_draw_playlistwin_frame(Skin * skin, GdkPixbuf * pix, gint width, gint height, gboolean focus) { - skin_draw_playlistwin_frame_top(skin, drawable, gc, width, height, focus); - skin_draw_playlistwin_frame_bottom(skin, drawable, gc, width, height, - focus); - skin_draw_playlistwin_frame_sides(skin, drawable, gc, width, height, - focus); + skin_draw_playlistwin_frame_top(skin, pix, width, height, focus); + skin_draw_playlistwin_frame_bottom(skin, pix, width, height, focus); + skin_draw_playlistwin_frame_sides(skin, pix, width, height, focus); } void -skin_draw_playlistwin_shaded(Skin * skin, - GdkDrawable * drawable, GdkGC * gc, +skin_draw_playlistwin_shaded(Skin * skin, GdkPixbuf * pix, gint width, gboolean focus) { /* The shade mode titlebar skin consists of 4 images: @@ -2055,22 +2078,21 @@ gint i; /* left corner */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 72, 42, 0, 0, 25, 14); + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 72, 42, 0, 0, 25, 14); /* bar tile */ for (i = 0; i < (width - 75) / 25; i++) - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 72, 57, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 72, 57, (i * 25) + 25, 0, 25, 14); /* right corner */ - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_PLEDIT, 99, focus ? 42 : 57, + skin_draw_pixbuf(NULL, skin, pix, SKIN_PLEDIT, 99, focus ? 42 : 57, width - 50, 0, 50, 14); } void -skin_draw_mainwin_titlebar(Skin * skin, - GdkDrawable * drawable, GdkGC * gc, +skin_draw_mainwin_titlebar(Skin * skin, GdkPixbuf * pix, gboolean shaded, gboolean focus) { /* The titlebar skin consists of 2 sets of 2 images, one for for @@ -2099,7 +2121,7 @@ y_offset = 15; } - skin_draw_pixmap(NULL, skin, drawable, gc, SKIN_TITLEBAR, 27, y_offset, + skin_draw_pixbuf(NULL, skin, pix, SKIN_TITLEBAR, 27, y_offset, 0, 0, bmp_active_skin->properties.mainwin_width, MAINWIN_TITLEBAR_HEIGHT); }
--- a/src/audacious/skin.h Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/skin.h Sat Jan 19 06:04:22 2008 +0100 @@ -173,7 +173,8 @@ #define SKIN_PIXMAP(x) ((SkinPixmap *)(x)) typedef struct _SkinPixmap { - GdkPixmap *pixmap; + GdkPixmap *pixmap; /* TODO: remove it in favour for pixbuf */ + GdkPixbuf *pixbuf; /* GdkPixmap *def_pixmap; */ /* The real size of the pixmap */ @@ -223,18 +224,20 @@ SkinPixmapId pixmap_id, gint xsrc, gint ysrc, gint xdest, gint ydest, gint width, gint height); +void skin_draw_pixbuf(GtkWidget *widget, Skin * skin, GdkPixbuf * pix, + SkinPixmapId pixmap_id, + gint xsrc, gint ysrc, gint xdest, gint ydest, + gint width, gint height); + void skin_get_eq_spline_colors(Skin * skin, guint32 colors[19]); void skin_install_skin(const gchar * path); -void skin_draw_playlistwin_shaded(Skin * skin, - GdkDrawable * drawable, GdkGC * gc, +void skin_draw_playlistwin_shaded(Skin * skin, GdkPixbuf * pix, gint width, gboolean focus); -void skin_draw_playlistwin_frame(Skin * skin, - GdkDrawable * drawable, GdkGC * gc, +void skin_draw_playlistwin_frame(Skin * skin, GdkPixbuf * pix, gint width, gint height, gboolean focus); -void skin_draw_mainwin_titlebar(Skin * skin, - GdkDrawable * drawable, GdkGC * gc, +void skin_draw_mainwin_titlebar(Skin * skin, GdkPixbuf * pix, gboolean shaded, gboolean focus);
--- a/src/audacious/ui_skinned_button.c Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/ui_skinned_button.c Sat Jan 19 06:04:22 2008 +0100 @@ -300,14 +300,12 @@ if (button->event_window != NULL) return FALSE; - GdkPixmap *obj; - GdkGC *gc; - obj = gdk_pixmap_new(NULL, priv->w, priv->h, gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(obj); + GdkPixbuf *obj; + obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, priv->w, priv->h); switch (button->type) { case TYPE_PUSH: - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, + skin_draw_pixbuf(widget, bmp_active_skin, obj, button->pressed ? priv->skin_index2 : priv->skin_index1, button->pressed ? priv->px : priv->nx, button->pressed ? priv->py : priv->ny, @@ -315,13 +313,13 @@ break; case TYPE_TOGGLE: if (button->inside) - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, + skin_draw_pixbuf(widget, bmp_active_skin, obj, button->pressed ? priv->skin_index2 : priv->skin_index1, button->pressed ? priv->ppx : priv->pnx, button->pressed ? priv->ppy : priv->pny, 0, 0, priv->w, priv->h); else - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, + skin_draw_pixbuf(widget, bmp_active_skin, obj, button->pressed ? priv->skin_index2 : priv->skin_index1, button->pressed ? priv->px : priv->nx, button->pressed ? priv->py : priv->ny, @@ -331,21 +329,16 @@ break; } - GdkPixmap *image = NULL; - + GdkPixbuf *image = NULL; if (priv->double_size) { - image = create_dblsize_pixmap(obj); + image = gdk_pixbuf_scale_simple(obj, priv->w*2, priv->h*2, GDK_INTERP_NEAREST); } 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); + image = gdk_pixbuf_copy(obj); } - g_object_unref(obj); + gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, priv->w*(1+priv->double_size), priv->h*(1+priv->double_size), GDK_RGB_DITHER_NONE, 0, 0); - gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, - priv->w*(1+priv->double_size), priv->h*(1+priv->double_size)); - - g_object_unref(gc); + g_object_unref(obj); g_object_unref(image); return FALSE;
--- a/src/audacious/ui_skinned_equalizer_slider.c Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/ui_skinned_equalizer_slider.c Sat Jan 19 06:04:22 2008 +0100 @@ -206,38 +206,33 @@ UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(es); g_return_val_if_fail (priv->width > 0 && priv->height > 0, FALSE); - GdkPixmap *obj = NULL; - GdkGC *gc; - - obj = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(obj); + GdkPixbuf *obj = NULL; + obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, priv->width, priv->height); gint frame; frame = 27 - ((priv->position * 27) / 50); if (frame < 14) - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, priv->skin_index, (frame * 15) + 13, 164, 0, 0, priv->width, priv->height); + skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, (frame * 15) + 13, 164, 0, 0, priv->width, priv->height); else - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, priv->skin_index, ((frame - 14) * 15) + 13, 229, 0, 0, priv->width, priv->height); + skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, ((frame - 14) * 15) + 13, 229, 0, 0, priv->width, priv->height); if (priv->pressed) - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, priv->skin_index, 0, 176, 1, priv->position, 11, 11); + skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, 0, 176, 1, priv->position, 11, 11); else - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, priv->skin_index, 0, 164, 1, priv->position, 11, 11); - - GdkPixmap *image = NULL; + skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, 0, 164, 1, priv->position, 11, 11); + GdkPixbuf *image = NULL; if (priv->double_size) { - image = create_dblsize_pixmap(obj); + image = gdk_pixbuf_scale_simple(obj, priv->width*2, priv->height*2, GDK_INTERP_NEAREST); } 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); + image = gdk_pixbuf_copy(obj); } - g_object_unref(obj); + gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, + priv->width*(1+priv->double_size), priv->height*(1+priv->double_size), + GDK_RGB_DITHER_NONE, 0, 0); - gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, - priv->width*(1+priv->double_size), priv->height*(1+priv->double_size)); - g_object_unref(gc); + g_object_unref(obj); g_object_unref(image); return FALSE;
--- a/src/audacious/ui_skinned_horizontal_slider.c Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/ui_skinned_horizontal_slider.c Sat Jan 19 06:04:22 2008 +0100 @@ -239,46 +239,42 @@ UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(hs); g_return_val_if_fail (priv->width > 0 && priv->height > 0, FALSE); - GdkPixmap *obj = NULL; - GdkGC *gc; + GdkPixbuf *obj = NULL; if (priv->position > priv->max) priv->position = priv->max; else if (priv->position < priv->min) priv->position = priv->min; - obj = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(obj); + obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, priv->width, priv->height); - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, + skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, priv->frame_offset, priv->frame * priv->frame_height, 0, 0, priv->width, priv->height); if (hs->pressed) - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, + skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, hs->knob_px, hs->knob_py, priv->position, ((priv->height - priv->knob_height) / 2), priv->knob_width, priv->knob_height); else - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, + skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, hs->knob_nx, hs->knob_ny, priv->position, ((priv->height - priv->knob_height) / 2), priv->knob_width, priv->knob_height); - GdkPixmap *image = NULL; - + GdkPixbuf *image = NULL; if (priv->double_size) { - image = create_dblsize_pixmap(obj); + image = gdk_pixbuf_scale_simple(obj, priv->width*2, priv->height*2, GDK_INTERP_NEAREST); } 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); + image = gdk_pixbuf_copy(obj); } - g_object_unref(obj); + gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, + priv->width*(1+priv->double_size), priv->height*(1+priv->double_size), + GDK_RGB_DITHER_NONE, 0, 0); - gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, - priv->width*(1+priv->double_size), priv->height*(1+priv->double_size)); - g_object_unref(gc); + g_object_unref(obj); g_object_unref(image); return FALSE;
--- a/src/audacious/ui_skinned_menurow.c Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/ui_skinned_menurow.c Sat Jan 19 06:04:22 2008 +0100 @@ -211,48 +211,43 @@ UiSkinnedMenurow *menurow = UI_SKINNED_MENUROW (widget); g_return_val_if_fail (menurow->width > 0 && menurow->height > 0, FALSE); - GdkPixmap *obj = NULL; - GdkGC *gc; - - obj = gdk_pixmap_new(NULL, menurow->width, menurow->height, gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(obj); + GdkPixbuf *obj = NULL; + obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, menurow->width, menurow->height); if (menurow->selected == MENUROW_NONE) { if (cfg.always_show_cb || menurow->pushed) - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, menurow->skin_index, + skin_draw_pixbuf(widget, bmp_active_skin, obj, menurow->skin_index, menurow->nx, menurow->ny, 0, 0, 8, 43); else - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, menurow->skin_index, + skin_draw_pixbuf(widget, bmp_active_skin, obj, menurow->skin_index, menurow->nx + 8, menurow->ny, 0, 0, 8, 43); } else { - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, menurow->skin_index, + skin_draw_pixbuf(widget, bmp_active_skin, obj, menurow->skin_index, menurow->sx + ((menurow->selected - 1) * 8), menurow->sy, 0, 0, 8, 43); } if (cfg.always_show_cb || menurow->pushed) { if (menurow->always_selected) - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, menurow->skin_index, + skin_draw_pixbuf(widget, bmp_active_skin, obj, menurow->skin_index, menurow->sx + 8, menurow->sy + 10, 0, 10, 8, 8); if (menurow->doublesize_selected) - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, menurow->skin_index, + skin_draw_pixbuf(widget, bmp_active_skin, obj, menurow->skin_index, menurow->sx + 24, menurow->sy + 26, 0, 26, 8, 8); } - GdkPixmap *image = NULL; - + GdkPixbuf *image = NULL; if (menurow->double_size) { - image = create_dblsize_pixmap(obj); + image = gdk_pixbuf_scale_simple(obj, menurow->width*2, menurow->height*2, GDK_INTERP_NEAREST); } 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); + image = gdk_pixbuf_copy(obj); } - g_object_unref(obj); + gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, + menurow->width*(1+menurow->double_size), menurow->height*(1+menurow->double_size), + GDK_RGB_DITHER_NONE, 0, 0); - gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, - menurow->width*(1+menurow->double_size), menurow->height*(1+menurow->double_size)); - g_object_unref(gc); + g_object_unref(obj); g_object_unref(image); return FALSE;
--- a/src/audacious/ui_skinned_monostereo.c Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/ui_skinned_monostereo.c Sat Jan 19 06:04:22 2008 +0100 @@ -179,42 +179,37 @@ UiSkinnedMonoStereo *monostereo = UI_SKINNED_MONOSTEREO (widget); g_return_val_if_fail (monostereo->width > 0 && monostereo->height > 0, FALSE); - GdkPixmap *obj = NULL; - GdkGC *gc; - - obj = gdk_pixmap_new(NULL, monostereo->width, monostereo->height, gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(obj); + GdkPixbuf *obj = NULL; + obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, monostereo->width, monostereo->height); switch (monostereo->num_channels) { case 1: - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, monostereo->skin_index, 29, 0, 0, 0, 27, 12); - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, monostereo->skin_index, 0, 12, 27, 0, 29, 12); + skin_draw_pixbuf(widget, bmp_active_skin, obj, monostereo->skin_index, 29, 0, 0, 0, 27, 12); + skin_draw_pixbuf(widget, bmp_active_skin, obj, monostereo->skin_index, 0, 12, 27, 0, 29, 12); break; case 2: - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, monostereo->skin_index, 29, 12, 0, 0, 27, 12); - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, monostereo->skin_index, 0, 0, 27, 0, 29, 12); + skin_draw_pixbuf(widget, bmp_active_skin, obj, monostereo->skin_index, 29, 12, 0, 0, 27, 12); + skin_draw_pixbuf(widget, bmp_active_skin, obj, monostereo->skin_index, 0, 0, 27, 0, 29, 12); break; default: case 0: - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, monostereo->skin_index, 29, 12, 0, 0, 27, 12); - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, monostereo->skin_index, 0, 12, 27, 0, 29, 12); + skin_draw_pixbuf(widget, bmp_active_skin, obj, monostereo->skin_index, 29, 12, 0, 0, 27, 12); + skin_draw_pixbuf(widget, bmp_active_skin, obj, monostereo->skin_index, 0, 12, 27, 0, 29, 12); break; } - GdkPixmap *image = NULL; - + GdkPixbuf *image = NULL; if (monostereo->double_size) { - image = create_dblsize_pixmap(obj); + image = gdk_pixbuf_scale_simple(obj, monostereo->width*2, monostereo->height*2, GDK_INTERP_NEAREST); } 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); + image = gdk_pixbuf_copy(obj); } - g_object_unref(obj); + gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, + monostereo->width*(1+monostereo->double_size), monostereo->height*(1+monostereo->double_size), + GDK_RGB_DITHER_NONE, 0, 0); - gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, - monostereo->width*(1+monostereo->double_size), monostereo->height*(1+monostereo->double_size)); - g_object_unref(gc); + g_object_unref(obj); g_object_unref(image); return FALSE;
--- a/src/audacious/ui_skinned_number.c Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/ui_skinned_number.c Sat Jan 19 06:04:22 2008 +0100 @@ -185,33 +185,28 @@ UiSkinnedNumber *number = UI_SKINNED_NUMBER (widget); g_return_val_if_fail (number->width > 0 && number->height > 0, FALSE); - GdkPixmap *obj = NULL; - GdkGC *gc; - obj = gdk_pixmap_new(NULL, number->width, number->height, gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(obj); + GdkPixbuf *obj; + obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, number->width, number->height); if (number->num > 11 || number->num < 0) number->num = 10; - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, + skin_draw_pixbuf(widget, bmp_active_skin, obj, number->skin_index, number->num * 9, 0, 0, 0, number->width, number->height); - GdkPixmap *image; - image = gdk_pixmap_new(NULL, number->width*(1+number->double_size), - number->height*(1+number->double_size), - gdk_rgb_get_visual()->depth); + GdkPixbuf *image = NULL; + if (number->double_size) { + image = gdk_pixbuf_scale_simple(obj, number->width*2, number->height*2, GDK_INTERP_NEAREST); + } else { + image = gdk_pixbuf_copy(obj); + } - if (number->double_size) { - image = create_dblsize_pixmap(obj); - } else - gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, number->width, number->height); + gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, + number->width*(1+number->double_size), number->height*(1+number->double_size), + GDK_RGB_DITHER_NONE, 0, 0); g_object_unref(obj); - - gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, - number->width*(1+number->double_size), number->height*(1+number->double_size)); - g_object_unref(gc); g_object_unref(image); return FALSE;
--- a/src/audacious/ui_skinned_playlist_slider.c Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/ui_skinned_playlist_slider.c Sat Jan 19 06:04:22 2008 +0100 @@ -217,11 +217,8 @@ UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(ps); g_return_val_if_fail (priv->width > 0 && priv->height > 0, FALSE); - GdkPixmap *obj = NULL; - GdkGC *gc; - - obj = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(obj); + GdkPixbuf *obj = NULL; + obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, priv->width, priv->height); gint num_visible; num_visible = playlistwin_list_get_visible_count(); @@ -244,17 +241,16 @@ /* FIXME: uses bmp_active_skin->pixmaps directly and may need calibration */ /* drawing background */ gint c; - for (c = 0; c <= priv->height / 29; c++) { - gdk_draw_drawable(obj, gc, bmp_active_skin->pixmaps[SKIN_PLEDIT].pixmap, - 36, 42, 0, c*29, priv->width, 29); + for (c = 0; c < priv->height / 29; c++) { + gdk_pixbuf_copy_area(bmp_active_skin->pixmaps[SKIN_PLEDIT].pixbuf, + 36, 42, priv->width, 29, obj, 0, c*29); } /* drawing knob */ - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, priv->skin_index, ps->pressed ? 61 : 52, 53, 0, y, priv->width, 18); + skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, ps->pressed ? 61 : 52, 53, 0, y, priv->width, 18); - gdk_draw_drawable(widget->window, gc, obj, 0, 0, 0, 0, priv->width, priv->height); + gdk_draw_pixbuf(widget->window, NULL, obj, 0, 0, 0, 0, priv->width, priv->height, GDK_RGB_DITHER_NONE, 0, 0); g_object_unref(obj); - g_object_unref(gc); return FALSE; }
--- a/src/audacious/ui_skinned_playstatus.c Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/ui_skinned_playstatus.c Sat Jan 19 06:04:22 2008 +0100 @@ -181,46 +181,41 @@ UiSkinnedPlaystatus *playstatus = UI_SKINNED_PLAYSTATUS (widget); g_return_val_if_fail (playstatus->width > 0 && playstatus->height > 0, FALSE); - GdkPixmap *obj = NULL; - GdkGC *gc; - - obj = gdk_pixmap_new(NULL, playstatus->width, playstatus->height, gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(obj); + GdkPixbuf *obj = NULL; + obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, playstatus->width, playstatus->height); if (playstatus->status == STATUS_STOP && playstatus->buffering == TRUE) playstatus->buffering = FALSE; if (playstatus->status == STATUS_PLAY && playstatus->buffering == TRUE) - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 39, 0, 0, 0, 3, playstatus->height); + skin_draw_pixbuf(widget, bmp_active_skin, obj, SKIN_PLAYPAUSE, 39, 0, 0, 0, 3, playstatus->height); else if (playstatus->status == STATUS_PLAY) - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 36, 0, 0, 0, 3, playstatus->height); + skin_draw_pixbuf(widget, bmp_active_skin, obj, SKIN_PLAYPAUSE, 36, 0, 0, 0, 3, playstatus->height); else - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 27, 0, 0, 0, 2, playstatus->height); + skin_draw_pixbuf(widget, bmp_active_skin, obj, SKIN_PLAYPAUSE, 27, 0, 0, 0, 2, playstatus->height); switch (playstatus->status) { case STATUS_STOP: - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 18, 0, 2, 0, 9, playstatus->height); + skin_draw_pixbuf(widget, bmp_active_skin, obj, SKIN_PLAYPAUSE, 18, 0, 2, 0, 9, playstatus->height); break; case STATUS_PAUSE: - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 9, 0, 2, 0, 9, playstatus->height); + skin_draw_pixbuf(widget, bmp_active_skin, obj, SKIN_PLAYPAUSE, 9, 0, 2, 0, 9, playstatus->height); break; case STATUS_PLAY: - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_PLAYPAUSE, 1, 0, 3, 0, 8, playstatus->height); + skin_draw_pixbuf(widget, bmp_active_skin, obj, SKIN_PLAYPAUSE, 1, 0, 3, 0, 8, playstatus->height); break; } - GdkPixmap *image = NULL; - + GdkPixbuf *image = NULL; if (playstatus->double_size) { - image = create_dblsize_pixmap(obj); + image = gdk_pixbuf_scale_simple(obj, playstatus->width*2, playstatus->height*2, GDK_INTERP_NEAREST); } 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); + image = gdk_pixbuf_copy(obj); } - g_object_unref(obj); + gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, + playstatus->width*(1+playstatus->double_size), playstatus->height*(1+playstatus->double_size), + GDK_RGB_DITHER_NONE, 0, 0); - gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, - playstatus->width*(1+playstatus->double_size), playstatus->height*(1+playstatus->double_size)); - g_object_unref(gc); + g_object_unref(obj); g_object_unref(image); return FALSE;
--- a/src/audacious/ui_skinned_textbox.c Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/ui_skinned_textbox.c Sat Jan 19 06:04:22 2008 +0100 @@ -54,12 +54,12 @@ gint font_ascent, font_descent; PangoFontDescription *font; gchar *fontname; - gchar *pixmap_text; + gchar *pixbuf_text; gint skin_id; gint drag_x, drag_off, offset; gboolean is_scrollable, is_dragging; - gint pixmap_width; - GdkPixmap *pixmap; + gint pixbuf_width; + GdkPixbuf *pixbuf; gboolean scroll_allowed, scroll_enabled; gint scroll_dummy; gint move_x, move_y; @@ -261,8 +261,8 @@ if (textbox->width != widget->allocation.width/(priv->double_size ? 2 : 1)) { textbox->width = widget->allocation.width/(priv->double_size ? 2 : 1); - if (priv->pixmap_text) g_free(priv->pixmap_text); - priv->pixmap_text = NULL; + if (priv->pixbuf_text) g_free(priv->pixbuf_text); + priv->pixbuf_text = NULL; priv->offset = 0; gtk_widget_set_size_request(widget, textbox->width, textbox->height); gtk_widget_queue_draw(GTK_WIDGET(textbox)); @@ -278,65 +278,59 @@ UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); g_return_val_if_fail (textbox->width > 0 && textbox->height > 0, FALSE); - GdkPixmap *obj = NULL; - GdkGC *gc; + GdkPixbuf *obj = NULL; gint cw; - if (textbox->text && (!priv->pixmap_text || strcmp(textbox->text, priv->pixmap_text))) + if (textbox->text && (!priv->pixbuf_text || strcmp(textbox->text, priv->pixbuf_text))) textbox_generate_pixmap(textbox); - if (priv->pixmap) { + if (priv->pixbuf) { if (skin_get_id() != priv->skin_id) { priv->skin_id = skin_get_id(); textbox_generate_pixmap(textbox); } - obj = gdk_pixmap_new(NULL, textbox->width, textbox->height, gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(obj); + obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, textbox->width, textbox->height); if (cfg.twoway_scroll) { // twoway scroll - cw = priv->pixmap_width - priv->offset; + cw = priv->pixbuf_width - priv->offset; if (cw > textbox->width) cw = textbox->width; - gdk_draw_drawable(obj, gc, priv->pixmap, priv->offset, 0, 0, 0, cw, textbox->height); + gdk_pixbuf_copy_area(priv->pixbuf, priv->offset, 0, cw, textbox->height, obj, 0, 0); if (cw < textbox->width) - gdk_draw_drawable(obj, gc, priv->pixmap, 0, 0, - textbox->x + cw, textbox->y, - textbox->width - cw, textbox->height); + gdk_pixbuf_copy_area(priv->pixbuf, 0, 0, textbox->width - cw, textbox->height, + obj, textbox->width - cw, textbox->height); } else { // oneway scroll int cw1, cw2; - if (priv->offset >= priv->pixmap_width) + if (priv->offset >= priv->pixbuf_width) priv->offset = 0; - if (priv->pixmap_width - priv->offset > textbox->width) { // case1 + if (priv->pixbuf_width - priv->offset > textbox->width) { // case1 cw1 = textbox->width; - gdk_draw_drawable(obj, gc, priv->pixmap, priv->offset, 0, - 0, 0, cw1, textbox->height); + gdk_pixbuf_copy_area(priv->pixbuf, priv->offset, 0, cw1, textbox->height, + obj, 0, 0); } else { // case 2 - cw1 = priv->pixmap_width - priv->offset; - gdk_draw_drawable(obj, gc, priv->pixmap, priv->offset, 0, - 0, 0, cw1, textbox->height); + cw1 = priv->pixbuf_width - priv->offset; + gdk_pixbuf_copy_area(priv->pixbuf, priv->offset, 0, cw1, textbox->height, obj, 0, 0); cw2 = textbox->width - cw1; - gdk_draw_drawable(obj, gc, priv->pixmap, 0, 0, cw1, 0, cw2, textbox->height); + gdk_pixbuf_copy_area(priv->pixbuf, 0, 0, cw2, textbox->height, obj, cw1, 0); } - } - GdkPixmap *image = NULL; - + GdkPixbuf *image = NULL; if (priv->double_size) { - image = create_dblsize_pixmap(obj); + image = gdk_pixbuf_scale_simple(obj, textbox->width*2, textbox->height*2, GDK_INTERP_NEAREST); } 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); + image = gdk_pixbuf_copy(obj); } - g_object_unref(obj); + gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, + textbox->width*(1+priv->double_size), textbox->height*(1+priv->double_size), + GDK_RGB_DITHER_NONE, 0, 0); - gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, - textbox->width*(1+priv->double_size), textbox->height*(1+priv->double_size)); - g_object_unref(gc); + g_object_unref(obj); g_object_unref(image); + } return FALSE; @@ -356,7 +350,7 @@ return FALSE; else if (event->button == 1) { if (priv->scroll_allowed) { - if ((priv->pixmap_width > textbox->width) && priv->is_scrollable) { + if ((priv->pixbuf_width > textbox->width) && priv->is_scrollable) { priv->is_dragging = TRUE; priv->drag_off = priv->offset; priv->drag_x = event->x; @@ -399,14 +393,14 @@ if (priv->is_dragging) { if (priv->scroll_allowed && - priv->pixmap_width > textbox->width) { + priv->pixbuf_width > textbox->width) { priv->offset = priv->drag_off - (event->x - priv->drag_x); while (priv->offset < 0) priv->offset = 0; - while (priv->offset > (priv->pixmap_width - textbox->width)) - priv->offset = (priv->pixmap_width - textbox->width); + while (priv->offset > (priv->pixbuf_width - textbox->width)) + priv->offset = (priv->pixbuf_width - textbox->width); gtk_widget_queue_draw(widget); } @@ -475,9 +469,9 @@ textbox->height = priv->nominal_height; /* Make sure the pixmap is regenerated */ - if (priv->pixmap_text) { - g_free(priv->pixmap_text); - priv->pixmap_text = NULL; + if (priv->pixbuf_text) { + g_free(priv->pixbuf_text); + priv->pixbuf_text = NULL; } if (!use_xfont || strlen(fontname) == 0) @@ -519,12 +513,14 @@ } static void textbox_generate_xfont_pixmap(UiSkinnedTextbox *textbox, const gchar *pixmaptext) { + /* FIXME: should operate directly on priv->pixbuf, it shouldn't use pixmap */ gint length, i; GdkGC *gc, *maskgc; GdkColor *c, pattern; GdkBitmap *mask; PangoLayout *layout; gint width; + GdkPixmap *pixmap; g_return_if_fail(textbox != NULL); g_return_if_fail(pixmaptext != NULL); @@ -536,23 +532,23 @@ text_get_extents(priv->fontname, pixmaptext, &width, NULL, NULL, NULL); - priv->pixmap_width = MAX(width, textbox->width); - priv->pixmap = gdk_pixmap_new(mainwin->window, priv->pixmap_width, + priv->pixbuf_width = MAX(width, textbox->width); + pixmap = gdk_pixmap_new(mainwin->window, priv->pixbuf_width, textbox->height, gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(priv->pixmap); + gc = gdk_gc_new(pixmap); c = skin_get_color(bmp_active_skin, SKIN_TEXTBG); for (i = 0; i < textbox->height; i++) { gdk_gc_set_foreground(gc, &c[6 * i / textbox->height]); - gdk_draw_line(priv->pixmap, gc, 0, i, priv->pixmap_width, i); + gdk_draw_line(pixmap, gc, 0, i, priv->pixbuf_width, i); } - mask = gdk_pixmap_new(mainwin->window, priv->pixmap_width, textbox->height, 1); + mask = gdk_pixmap_new(mainwin->window, priv->pixbuf_width, textbox->height, 1); maskgc = gdk_gc_new(mask); pattern.pixel = 0; gdk_gc_set_foreground(maskgc, &pattern); - gdk_draw_rectangle(mask, maskgc, TRUE, 0, 0, priv->pixmap_width, textbox->height); + gdk_draw_rectangle(mask, maskgc, TRUE, 0, 0, priv->pixbuf_width, textbox->height); pattern.pixel = 1; gdk_gc_set_foreground(maskgc, &pattern); @@ -561,7 +557,7 @@ layout = gtk_widget_create_pango_layout(mainwin, pixmaptext); pango_layout_set_font_description(layout, priv->font); - gdk_draw_layout(priv->pixmap, gc, 0, (priv->font_descent / 2), layout); + gdk_draw_layout(pixmap, gc, 0, (priv->font_descent / 2), layout); g_object_unref(layout); g_object_unref(maskgc); @@ -570,8 +566,9 @@ c = skin_get_color(bmp_active_skin, SKIN_TEXTFG); for (i = 0; i < textbox->height; i++) { gdk_gc_set_foreground(gc, &c[6 * i / textbox->height]); - gdk_draw_line(priv->pixmap, gc, 0, i, priv->pixmap_width, i); + gdk_draw_line(pixmap, gc, 0, i, priv->pixbuf_width, i); } + priv->pixbuf = gdk_pixbuf_get_from_drawable(NULL, pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, priv->pixbuf_width, textbox->height); g_object_unref(mask); g_object_unref(gc); } @@ -590,10 +587,10 @@ else priv->offset += 1; - if (priv->offset >= (priv->pixmap_width - textbox->width)) { + if (priv->offset >= (priv->pixbuf_width - textbox->width)) { priv->scroll_back = TRUE; priv->scroll_dummy = 0; - priv->offset = priv->pixmap_width - textbox->width; + priv->offset = priv->pixbuf_width - textbox->width; } if (priv->offset <= 0) { priv->scroll_back = FALSE; @@ -615,14 +612,13 @@ gint length, i, x, y, wl; gchar *pixmaptext; gchar *tmp, *stxt; - GdkGC *gc; g_return_if_fail(textbox != NULL); UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); - if (priv->pixmap) { - g_object_unref(priv->pixmap); - priv->pixmap = NULL; + if (priv->pixbuf) { + g_object_unref(priv->pixbuf); + priv->pixbuf = NULL; } /* @@ -630,13 +626,13 @@ * changed. This is a hack to avoid visual noice on vbr files * where we guess the length. */ - if (!(priv->pixmap_text && strrchr(textbox->text, '(') && - !strncmp(priv->pixmap_text, textbox->text, + if (!(priv->pixbuf_text && strrchr(textbox->text, '(') && + !strncmp(priv->pixbuf_text, textbox->text, strrchr(textbox->text, '(') - textbox->text))) priv->offset = 0; - g_free(priv->pixmap_text); - priv->pixmap_text = g_strdup(textbox->text); + g_free(priv->pixbuf_text); + priv->pixbuf_text = g_strdup(textbox->text); /* * wl is the number of (partial) letters visible. Only makes @@ -654,20 +650,20 @@ if (priv->is_scrollable) { if(!cfg.twoway_scroll) { - pixmaptext = g_strdup_printf("%s *** ", priv->pixmap_text); + pixmaptext = g_strdup_printf("%s *** ", priv->pixbuf_text); length += 5; } else - pixmaptext = g_strdup(priv->pixmap_text); + pixmaptext = g_strdup(priv->pixbuf_text); } else if (!priv->font && length <= wl) { gint pad = wl - length; gchar *padchars = g_strnfill(pad, ' '); - pixmaptext = g_strconcat(priv->pixmap_text, padchars, NULL); + pixmaptext = g_strconcat(priv->pixbuf_text, padchars, NULL); g_free(padchars); length += pad; } else - pixmaptext = g_strdup(priv->pixmap_text); + pixmaptext = g_strdup(priv->pixbuf_text); if (priv->is_scrollable) { if (priv->scroll_enabled && !priv->scroll_timeout) { @@ -689,11 +685,9 @@ return; } - priv->pixmap_width = length * bmp_active_skin->properties.textbox_bitmap_font_width; - priv->pixmap = gdk_pixmap_new(NULL, - priv->pixmap_width, bmp_active_skin->properties.textbox_bitmap_font_height, - gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(priv->pixmap); + priv->pixbuf_width = length * bmp_active_skin->properties.textbox_bitmap_font_width; + priv->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, + priv->pixbuf_width, bmp_active_skin->properties.textbox_bitmap_font_height); for (tmp = stxt = g_utf8_strup(pixmaptext, -1), i = 0; tmp != NULL && i < length; i++, tmp = g_utf8_next_char(tmp)) { @@ -710,15 +704,14 @@ else textbox_handle_special_char(tmp, &x, &y); - skin_draw_pixmap(GTK_WIDGET(textbox), bmp_active_skin, - priv->pixmap, gc, priv->skin_index, + skin_draw_pixbuf(GTK_WIDGET(textbox), bmp_active_skin, + priv->pixbuf, priv->skin_index, x, y, i * bmp_active_skin->properties.textbox_bitmap_font_width, 0, bmp_active_skin->properties.textbox_bitmap_font_width, bmp_active_skin->properties.textbox_bitmap_font_height); } g_free(stxt); g_free(pixmaptext); - g_object_unref(gc); } void ui_skinned_textbox_set_scroll(GtkWidget *widget, gboolean scroll) {
--- a/src/audacious/ui_skinned_window.c Thu Jan 17 17:17:47 2008 -0600 +++ b/src/audacious/ui_skinned_window.c Sat Jan 19 06:04:22 2008 +0100 @@ -151,8 +151,7 @@ static gboolean ui_skinned_window_expose(GtkWidget *widget, GdkEventExpose *event) { SkinnedWindow *window = SKINNED_WINDOW(widget); - GdkPixmap *obj = NULL; - GdkGC *gc; + GdkPixbuf *obj = NULL; gint width = 0, height = 0; switch (window->type) { @@ -171,52 +170,50 @@ default: return FALSE; } - obj = gdk_pixmap_new(NULL, width, height, gdk_rgb_get_visual()->depth); - gc = gdk_gc_new(obj); + obj = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); gboolean focus = gtk_window_has_toplevel_focus(GTK_WINDOW(widget)); switch (window->type) { case WINDOW_MAIN: - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_MAIN, 0, 0, 0, 0, width, height); - skin_draw_mainwin_titlebar(bmp_active_skin, obj, gc, cfg.player_shaded, focus || !cfg.dim_titlebar); + skin_draw_pixbuf(widget, bmp_active_skin, obj,SKIN_MAIN, 0, 0, 0, 0, width, height); + skin_draw_mainwin_titlebar(bmp_active_skin, obj, cfg.player_shaded, focus || !cfg.dim_titlebar); break; case WINDOW_EQ: - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_EQMAIN, 0, 0, 0, 0, width, height); + skin_draw_pixbuf(widget, bmp_active_skin, obj, SKIN_EQMAIN, 0, 0, 0, 0, width, height); if (focus || !cfg.dim_titlebar) { if (!cfg.equalizer_shaded) - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_EQMAIN, 0, 134, 0, 0, width, 14); + skin_draw_pixbuf(widget, bmp_active_skin, obj, SKIN_EQMAIN, 0, 134, 0, 0, width, 14); else - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_EQ_EX, 0, 0, 0, 0, width, 14); + skin_draw_pixbuf(widget, bmp_active_skin, obj, SKIN_EQ_EX, 0, 0, 0, 0, width, 14); } else { if (!cfg.equalizer_shaded) - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_EQMAIN, 0, 149, 0, 0, width, 14); + skin_draw_pixbuf(widget, bmp_active_skin, obj, SKIN_EQMAIN, 0, 149, 0, 0, width, 14); else - skin_draw_pixmap(widget, bmp_active_skin, obj, gc, SKIN_EQ_EX, 0, 15, 0, 0, width, 14); + skin_draw_pixbuf(widget, bmp_active_skin, obj, SKIN_EQ_EX, 0, 15, 0, 0, width, 14); } break; case WINDOW_PLAYLIST: focus |= !cfg.dim_titlebar; if (cfg.playlist_shaded) { - skin_draw_playlistwin_shaded(bmp_active_skin, obj, gc, playlistwin_get_width(), focus); + skin_draw_playlistwin_shaded(bmp_active_skin, obj, playlistwin_get_width(), focus); } else { - skin_draw_playlistwin_frame(bmp_active_skin, obj, gc, playlistwin_get_width(), cfg.playlist_height, focus); + skin_draw_playlistwin_frame(bmp_active_skin, obj, playlistwin_get_width(), cfg.playlist_height, focus); } break; } - GdkPixmap *image = NULL; - if (window->type != WINDOW_PLAYLIST && cfg.doublesize) { - image = create_dblsize_pixmap(obj); + GdkPixbuf *image = gdk_pixbuf_scale_simple(obj, width*2, height*2, GDK_INTERP_NEAREST); + gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, width*2, height*2, + GDK_RGB_DITHER_NONE, 0, 0); + g_object_unref(image); } else { - image = gdk_pixmap_new(NULL, width, height, gdk_rgb_get_visual()->depth); - gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, width, height); + gdk_draw_pixbuf(widget->window, NULL, obj, 0, 0, 0, 0, width, height, + GDK_RGB_DITHER_NONE, 0, 0); } + g_object_unref(obj); - gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0, width*(1+cfg.doublesize), height*(1+cfg.doublesize)); - g_object_unref(gc); - g_object_unref(image); return FALSE; }