cpw.qulogic.cairo: 18ad20d3: Replace GdkGC in whiteboard stuff. But I...
qulogic at pidgin.im
qulogic at pidgin.im
Wed Jul 28 00:59:21 EDT 2010
----------------------------------------------------------------------
Revision: 18ad20d37405c4392ebe2846a94196ef2c81d368
Parent: 4e44fc436fc4acb2854f44ba9151711f31f0f701
Author: qulogic at pidgin.im
Date: 07/28/10 00:36:15
Branch: im.pidgin.cpw.qulogic.cairo
URL: http://d.pidgin.im/viewmtn/revision/info/18ad20d37405c4392ebe2846a94196ef2c81d368
Changelog:
Replace GdkGC in whiteboard stuff. But I don't have Yahoo!, so don't
know if it really works.
Changes against parent 4e44fc436fc4acb2854f44ba9151711f31f0f701
patched pidgin/gtkwhiteboard.c
-------------- next part --------------
============================================================
--- pidgin/gtkwhiteboard.c 64d9c4a7954626da010388d4e03f88fb60d97968
+++ pidgin/gtkwhiteboard.c b1c7637f55dda4e5c2e37ec653ad4fdce812919b
@@ -586,21 +586,13 @@ static void pidgin_whiteboard_draw_brush
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 +600,26 @@ static void pidgin_whiteboard_draw_brush
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) */
More information about the Commits
mailing list