Mercurial > pidgin
comparison pidgin/gtkwhiteboard.c @ 30995:6ea43032df70
Replace GdkGC in whiteboard stuff. But I don't have Yahoo!, so don't
know if it really works.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Wed, 28 Jul 2010 04:36:15 +0000 |
parents | 2b9db39bd7ed |
children | 33d2caadee60 |
comparison
equal
deleted
inserted
replaced
30994:4458f98f42ba | 30995:6ea43032df70 |
---|---|
584 { | 584 { |
585 PidginWhiteboard *gtkwb = wb->ui_data; | 585 PidginWhiteboard *gtkwb = wb->ui_data; |
586 GtkWidget *widget = gtkwb->drawing_area; | 586 GtkWidget *widget = gtkwb->drawing_area; |
587 GdkPixmap *pixmap = gtkwb->pixmap; | 587 GdkPixmap *pixmap = gtkwb->pixmap; |
588 | 588 |
589 GdkRectangle update_rect; | 589 cairo_t *gfx_con = gdk_cairo_create(GDK_DRAWABLE(pixmap)); |
590 | |
591 GdkGC *gfx_con = gdk_gc_new(pixmap); | |
592 GdkColor col; | 590 GdkColor col; |
593 | |
594 update_rect.x = x - size / 2; | |
595 update_rect.y = y - size / 2; | |
596 update_rect.width = size; | |
597 update_rect.height = size; | |
598 | 591 |
599 /* Interpret and convert color */ | 592 /* Interpret and convert color */ |
600 pidgin_whiteboard_rgb24_to_rgb48(color, &col); | 593 pidgin_whiteboard_rgb24_to_rgb48(color, &col); |
601 | 594 |
602 gdk_gc_set_rgb_fg_color(gfx_con, &col); | 595 gdk_cairo_set_source_color(gfx_con, &col); |
603 /* gdk_gc_set_rgb_bg_color(gfx_con, &col); */ | |
604 | 596 |
605 /* NOTE 5 is a size constant for now... this is because of how poorly the | 597 /* NOTE 5 is a size constant for now... this is because of how poorly the |
606 * gdk_draw_arc draws small circles | 598 * gdk_draw_arc draws small circles |
607 */ | 599 */ |
608 if(size < 5) | 600 if(size < 5) |
609 { | 601 { |
610 /* Draw a rectangle/square */ | 602 /* Draw a rectangle/square */ |
611 gdk_draw_rectangle(pixmap, | 603 cairo_rectangle(gfx_con, |
612 gfx_con, | 604 x - size / 2, y - size / 2, |
613 TRUE, | 605 size, size); |
614 update_rect.x, update_rect.y, | 606 cairo_fill(gfx_con); |
615 update_rect.width, update_rect.height); | |
616 } | 607 } |
617 else | 608 else |
618 { | 609 { |
619 /* Draw a circle */ | 610 /* Draw a circle */ |
620 gdk_draw_arc(pixmap, | 611 cairo_arc(gfx_con, |
621 gfx_con, | 612 x, y, |
622 TRUE, | 613 size / 2.0, |
623 update_rect.x, update_rect.y, | 614 0.0, 2.0 * M_PI); |
624 update_rect.width, update_rect.height, | 615 cairo_fill(gfx_con); |
625 0, FULL_CIRCLE_DEGREES); | |
626 } | 616 } |
627 | 617 |
628 gtk_widget_queue_draw_area(widget, | 618 gtk_widget_queue_draw_area(widget, |
629 update_rect.x, update_rect.y, | 619 x - size / 2, y - size / 2, |
630 update_rect.width, update_rect.height); | 620 size, size); |
631 | 621 |
632 g_object_unref(G_OBJECT(gfx_con)); | 622 cairo_destroy(gfx_con); |
633 } | 623 } |
634 | 624 |
635 /* Uses Bresenham's algorithm (as provided by Wikipedia) */ | 625 /* Uses Bresenham's algorithm (as provided by Wikipedia) */ |
636 static void pidgin_whiteboard_draw_brush_line(PurpleWhiteboard *wb, int x0, int y0, int x1, int y1, int color, int size) | 626 static void pidgin_whiteboard_draw_brush_line(PurpleWhiteboard *wb, int x0, int y0, int x1, int y1, int color, int size) |
637 { | 627 { |