Mercurial > pidgin
changeset 31001:1884f1f2013b
propagate from branch 'im.pidgin.pidgin' (head 47179f04bde4a1cd3857fd05eb4e40f25ee9e26f)
to branch 'im.pidgin.cpw.qulogic.cairo' (head c10b48bebcd04adcd6dad3d199fe09675a28219d)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 21 Aug 2010 05:42:17 +0000 |
parents | 9789e8e7d834 (current diff) bcee814fc3a6 (diff) |
children | 9a705087d64e |
files | libpurple/protocols/oscar/family_advert.c libpurple/protocols/oscar/family_invite.c libpurple/protocols/oscar/family_odir.c libpurple/protocols/oscar/family_translate.c |
diffstat | 3 files changed, 57 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkimhtml.c Thu Aug 19 19:55:31 2010 +0000 +++ b/pidgin/gtkimhtml.c Sat Aug 21 05:42:17 2010 +0000 @@ -756,7 +756,7 @@ GtkTextIter start, end, cur; int buf_x, buf_y; GdkRectangle visible_rect; - GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(event->window)); + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(event->window)); GdkColor gcolor; gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &visible_rect); @@ -774,16 +774,16 @@ if (GTK_IMHTML(widget)->edit.background) { gdk_color_parse(GTK_IMHTML(widget)->edit.background, &gcolor); - gdk_gc_set_rgb_fg_color(gc, &gcolor); + gdk_cairo_set_source_color(cr, &gcolor); } else { - gdk_gc_set_rgb_fg_color(gc, &(widget->style->base[GTK_WIDGET_STATE(widget)])); + gdk_cairo_set_source_color(cr, &(widget->style->base[GTK_WIDGET_STATE(widget)])); } - gdk_draw_rectangle(event->window, - gc, - TRUE, - visible_rect.x, visible_rect.y, visible_rect.width, visible_rect.height); - g_object_unref(G_OBJECT(gc)); + cairo_rectangle(cr, + visible_rect.x, visible_rect.y, + visible_rect.width, visible_rect.height); + cairo_fill(cr); + cairo_destroy(cr); if (GTK_WIDGET_CLASS (parent_class)->expose_event) return (* GTK_WIDGET_CLASS (parent_class)->expose_event) @@ -854,12 +854,12 @@ if (!gdk_color_parse(tmp, &gcolor)) gdk_color_parse("white", &gcolor); } - gdk_gc_set_rgb_fg_color(gc, &gcolor); - - gdk_draw_rectangle(event->window, - gc, - TRUE, - rect.x, rect.y, rect.width, rect.height); + gdk_cairo_set_source_color(cr, &gcolor); + + cairo_rectangle(cr, + rect.x, rect.y, + rect.width, rect.height); + cairo_fill(cr); gtk_text_iter_backward_char(&cur); /* go back one, in case the end is the begining is the end * note that above, we always moved cur ahead by at least * one character */ @@ -874,7 +874,7 @@ !gtk_text_iter_begins_tag(&cur, NULL)); } - g_object_unref(G_OBJECT(gc)); + cairo_destroy(cr); if (GTK_WIDGET_CLASS (parent_class)->expose_event) return (* GTK_WIDGET_CLASS (parent_class)->expose_event)
--- a/pidgin/gtkwhiteboard.c Thu Aug 19 19:55:31 2010 +0000 +++ b/pidgin/gtkwhiteboard.c Sat Aug 21 05:42:17 2010 +0000 @@ -353,8 +353,8 @@ static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; - GdkPixmap *pixmap = gtkwb->pixmap; + cairo_t *cr; if(pixmap) g_object_unref(pixmap); @@ -363,15 +363,15 @@ widget->allocation.width, widget->allocation.height, -1); - gtkwb->pixmap = pixmap; - gdk_draw_rectangle(pixmap, - widget->style->white_gc, - TRUE, - 0, 0, - widget->allocation.width, - widget->allocation.height); + cr = gdk_cairo_create(GDK_DRAWABLE(pixmap)); + gdk_cairo_set_source_color(cr, &widget->style->white); + cairo_rectangle(cr, + 0, 0, + widget->allocation.width, widget->allocation.height); + cairo_fill(cr); + cairo_destroy(cr); return TRUE; } @@ -380,13 +380,15 @@ { PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data); GdkPixmap *pixmap = gtkwb->pixmap; + cairo_t *cr; - gdk_draw_drawable(widget->window, - widget->style->fg_gc[GTK_WIDGET_STATE(widget)], - pixmap, - event->area.x, event->area.y, - event->area.x, event->area.y, - event->area.width, event->area.height); + cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); + gdk_cairo_set_source_pixmap(cr, pixmap, 0, 0); + cairo_rectangle(cr, + event->area.x, event->area.y, + event->area.width, event->area.height); + cairo_fill(cr); + cairo_destroy(cr); return FALSE; } @@ -586,50 +588,26 @@ GtkWidget *widget = gtkwb->drawing_area; GdkPixmap *pixmap = gtkwb->pixmap; - GdkRectangle update_rect; - - GdkGC *gfx_con = gdk_gc_new(pixmap); + cairo_t *gfx_con = gdk_cairo_create(GDK_DRAWABLE(pixmap)); GdkColor col; - update_rect.x = x - size / 2; - update_rect.y = y - size / 2; - update_rect.width = size; - update_rect.height = size; - /* Interpret and convert color */ pidgin_whiteboard_rgb24_to_rgb48(color, &col); - gdk_gc_set_rgb_fg_color(gfx_con, &col); - /* gdk_gc_set_rgb_bg_color(gfx_con, &col); */ + gdk_cairo_set_source_color(gfx_con, &col); - /* NOTE 5 is a size constant for now... this is because of how poorly the - * gdk_draw_arc draws small circles - */ - if(size < 5) - { - /* Draw a rectangle/square */ - gdk_draw_rectangle(pixmap, - gfx_con, - TRUE, - update_rect.x, update_rect.y, - update_rect.width, update_rect.height); - } - else - { - /* Draw a circle */ - gdk_draw_arc(pixmap, - gfx_con, - TRUE, - update_rect.x, update_rect.y, - update_rect.width, update_rect.height, - 0, FULL_CIRCLE_DEGREES); - } + /* Draw a circle */ + cairo_arc(gfx_con, + x, y, + size / 2.0, + 0.0, 2.0 * M_PI); + cairo_fill(gfx_con); gtk_widget_queue_draw_area(widget, - update_rect.x, update_rect.y, - update_rect.width, update_rect.height); + x - size / 2, y - size / 2, + size, size); - g_object_unref(G_OBJECT(gfx_con)); + cairo_destroy(gfx_con); } /* Uses Bresenham's algorithm (as provided by Wikipedia) */ @@ -720,13 +698,15 @@ PidginWhiteboard *gtkwb = wb->ui_data; GdkPixmap *pixmap = gtkwb->pixmap; GtkWidget *drawing_area = gtkwb->drawing_area; + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(pixmap)); - gdk_draw_rectangle(pixmap, - drawing_area->style->white_gc, - TRUE, - 0, 0, - drawing_area->allocation.width, - drawing_area->allocation.height); + gdk_cairo_set_source_color(cr, &drawing_area->style->white); + cairo_rectangle(cr, + 0, 0, + drawing_area->allocation.width, + drawing_area->allocation.height); + cairo_fill(cr); + cairo_destroy(cr); gtk_widget_queue_draw_area(drawing_area, 0, 0,
--- a/pidgin/plugins/markerline.c Thu Aug 19 19:55:31 2010 +0000 +++ b/pidgin/plugins/markerline.c Sat Aug 21 05:42:17 2010 +0000 @@ -79,12 +79,14 @@ if (y >= event->area.y) { GdkColor red = {0, 0xffff, 0, 0}; - GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(event->window)); + cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(event->window)); - gdk_gc_set_rgb_fg_color(gc, &red); - gdk_draw_line(event->window, gc, - 0, y, visible_rect.width, y); - g_object_unref(G_OBJECT(gc)); + gdk_cairo_set_source_color(cr, &red); + cairo_move_to(cr, 0.0, y + 0.5); + cairo_rel_line_to(cr, visible_rect.width, 0.0); + cairo_set_line_width(cr, 1.0); + cairo_stroke(cr); + cairo_destroy(cr); } return FALSE; }