Mercurial > pidgin
changeset 30998:93410d06cb51
propagate from branch 'im.pidgin.pidgin' (head e7abe20448d307649f623c608ecd470060b5f40d)
to branch 'im.pidgin.cpw.qulogic.cairo' (head 8fc85ec45252e4e75ffb22c92f34ea8242151b5c)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 08 Aug 2010 20:36:10 +0000 |
parents | 33d2caadee60 (diff) 0f66b49522c4 (current diff) |
children | e898334364f7 |
files | |
diffstat | 3 files changed, 60 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkimhtml.c Sun Aug 08 20:31:14 2010 +0000 +++ b/pidgin/gtkimhtml.c Sun Aug 08 20:36:10 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 Sun Aug 08 20:31:14 2010 +0000 +++ b/pidgin/gtkwhiteboard.c Sun Aug 08 20:36:10 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, event->area.x, event->area.y); + cairo_rectangle(cr, + event->area.x, event->area.y, + event->area.width, event->area.height); + cairo_fill(cr); + cairo_destroy(cr); return FALSE; } @@ -586,21 +588,13 @@ 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 @@ -608,28 +602,26 @@ 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); + cairo_rectangle(gfx_con, + x - size / 2, y - size / 2, + size, size); + cairo_fill(gfx_con); } 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); + 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 +712,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 Sun Aug 08 20:31:14 2010 +0000 +++ b/pidgin/plugins/markerline.c Sun Aug 08 20:36:10 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; }