1 #include "xorrectangle.h"
5 bool XORRectangle::initialised() const
10 void XORRectangle::lazy_init()
13 cr = gdk_cairo_create(gtk_widget_get_window(m_widget));
17 void XORRectangle::draw() const
19 const int x = float_to_integer(m_rectangle.x);
20 const int y = float_to_integer(m_rectangle.y);
21 const int w = float_to_integer(m_rectangle.w);
22 const int h = float_to_integer(m_rectangle.h);
23 GtkAllocation allocation;
24 gtk_widget_get_allocation(m_widget, &allocation);
25 cairo_rectangle(cr, x, -(h) - (y - allocation.height), w, h);
26 cairo_set_source_rgb(cr, 1, 1, 1);
27 cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
31 XORRectangle::XORRectangle(ui::GLArea widget) : m_widget(widget), cr(0)
35 XORRectangle::~XORRectangle()
42 void XORRectangle::set(rectangle_t rectangle)
44 if (gtk_widget_get_realized(m_widget)) {
47 m_rectangle = rectangle;