[rhythmbox] widgets: replace gdk_draw_pixbuf with cairo calls
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] widgets: replace gdk_draw_pixbuf with cairo calls
- Date: Wed, 28 Jul 2010 08:07:52 +0000 (UTC)
commit 1bddf3b0dfdd62d3b981636fb8ca6bd46125c3f3
Author: Jonathan Matthew <jonathan d14n org>
Date: Wed Jul 28 18:07:19 2010 +1000
widgets: replace gdk_draw_pixbuf with cairo calls
widgets/rb-cell-renderer-pixbuf.c | 20 +++++++-------------
widgets/rb-rating-helper.c | 14 ++++++--------
2 files changed, 13 insertions(+), 21 deletions(-)
---
diff --git a/widgets/rb-cell-renderer-pixbuf.c b/widgets/rb-cell-renderer-pixbuf.c
index 178b4b9..361ad50 100644
--- a/widgets/rb-cell-renderer-pixbuf.c
+++ b/widgets/rb-cell-renderer-pixbuf.c
@@ -297,19 +297,13 @@ rb_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
pix_rect.width -= xpad * 2;
pix_rect.height -= ypad * 2;
- if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect))
- gdk_draw_pixbuf (window,
- NULL,
- cellpixbuf->pixbuf,
- /* pixbuf 0, 0 is at pix_rect.x, pix_rect.y */
- draw_rect.x - pix_rect.x,
- draw_rect.y - pix_rect.y,
- draw_rect.x,
- draw_rect.y,
- draw_rect.width,
- draw_rect.height,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
+ if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect)) {
+ cairo_t *cr = gdk_cairo_create (window);
+ gdk_cairo_set_source_pixbuf (cr, cellpixbuf->pixbuf, pix_rect.x, pix_rect.y);
+ gdk_cairo_rectangle (cr, &draw_rect);
+ cairo_paint (cr);
+ cairo_destroy (cr);
+ }
}
static gboolean
diff --git a/widgets/rb-rating-helper.c b/widgets/rb-rating-helper.c
index 4018bee..1a58604 100644
--- a/widgets/rb-rating-helper.c
+++ b/widgets/rb-rating-helper.c
@@ -170,6 +170,7 @@ rb_rating_render_stars (GtkWidget *widget,
{
int i, icon_width;
gboolean rtl;
+ cairo_t *cr;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (window != NULL, FALSE);
@@ -178,6 +179,7 @@ rb_rating_render_stars (GtkWidget *widget,
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, NULL);
+ cr = gdk_cairo_create (window);
for (i = 0; i < RB_RATING_MAX_SCORE; i++) {
GdkPixbuf *buf;
GtkStateType state;
@@ -225,15 +227,11 @@ rb_rating_render_stars (GtkWidget *widget,
star_offset = i * icon_width;
}
- gdk_draw_pixbuf (window,
- NULL,
- buf,
- x, y,
- x_offset + star_offset, y_offset,
- icon_width, icon_width,
- GDK_RGB_DITHER_NORMAL, 0, 0);
- g_object_unref (G_OBJECT (buf));
+ gdk_cairo_set_source_pixbuf (cr, buf, x_offset + star_offset, y_offset);
+ cairo_paint (cr);
+ g_object_unref (buf);
}
+ cairo_destroy (cr);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]