summaryrefslogtreecommitdiff
path: root/redo/area_unix.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-21 19:09:40 -0400
committerPietro Gagliardi <[email protected]>2014-08-21 19:10:10 -0400
commitdf8cbec7b8928c22a461468b6bef3078d3d831ea (patch)
treea508edb020f92d0474fb0abaddf42734cde3ac8b /redo/area_unix.go
parent8feaa1c439bbce90c7fb8ce9f63baa650a005a05 (diff)
Quick update to Area GTK+ drawing in an attempt fo figure out what's going on: we store the Area's width/height already; no need to get it back out from GTK+ itself.
Diffstat (limited to 'redo/area_unix.go')
-rw-r--r--redo/area_unix.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/redo/area_unix.go b/redo/area_unix.go
index 781a11b..8c732b7 100644
--- a/redo/area_unix.go
+++ b/redo/area_unix.go
@@ -100,7 +100,6 @@ var areaCallbacks = []struct {
//export our_area_draw_callback
func our_area_draw_callback(widget *C.GtkWidget, cr *C.cairo_t, data C.gpointer) C.gboolean {
var x0, y0, x1, y1 C.double
- var maxwid, maxht C.gint
a := (*area)(unsafe.Pointer(data))
// thanks to desrt in irc.gimp.net/#gtk+
@@ -109,8 +108,7 @@ func our_area_draw_callback(widget *C.GtkWidget, cr *C.cairo_t, data C.gpointer)
// we do not need to clear the cliprect; GtkDrawingArea did it for us beforehand
cliprect := image.Rect(int(x0), int(y0), int(x1), int(y1))
// the cliprect can actually fall outside the size of the Area; clip it by intersecting the two rectangles
- C.gtk_widget_get_size_request(widget, &maxwid, &maxht)
- cliprect = image.Rect(0, 0, int(maxwid), int(maxht)).Intersect(cliprect)
+ cliprect = image.Rect(0, 0, a.width, a.height).Intersect(cliprect)
if cliprect.Empty() { // no intersection; nothing to paint
return C.FALSE // signals handled without stopping the event chain (thanks to desrt again)
}
@@ -133,7 +131,7 @@ func our_area_draw_callback(widget *C.GtkWidget, cr *C.cairo_t, data C.gpointer)
0, 0) // origin of the surface
// that just set the brush that cairo uses: we have to actually draw now
// (via https://developer.gnome.org/gtkmm-tutorial/stable/sec-draw-images.html.en)
- C.cairo_rectangle(cr, x0, y0, x1, y1) // breaking the nrom here since we have the coordinates as a C double already
+ C.cairo_rectangle(cr, x0, y0, x1, y1) // breaking the norm here since we have the coordinates as a C double already
C.cairo_fill(cr)
C.cairo_surface_destroy(surface) // free surface
return C.FALSE // signals handled without stopping the event chain (thanks to desrt again)