Commit 16fba789 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix issue with missing geometry in the Cairo surface created with Quartz

parent b7552219
......@@ -240,6 +240,7 @@ class GraphWidget(Gtk.DrawingArea):
self.geometry = None
self.base = None
self.base_geometry = None
self.background = None
self.bg_color = bg_color if bg_color is not None else [1, 1, 1, 1]
self.surface_callback = None
......@@ -384,8 +385,8 @@ class GraphWidget(Gtk.DrawingArea):
self.get_allocated_height())
self.smatrix = self.smatrix * m
self.tmatrix = self.tmatrix * self.smatrix
if (self.base is None or self.base.get_width() != geometry[0] or
self.base.get_height() != geometry[1]):
if (self.base is None or self.base_geometry[0] != geometry[0] or
self.base_geometry[1] != geometry[1]):
# self.base = cairo.ImageSurface(cairo.FORMAT_ARGB32,
# *geometry)
w = self.get_window()
......@@ -393,6 +394,8 @@ class GraphWidget(Gtk.DrawingArea):
return False
self.base = w.create_similar_surface(cairo.CONTENT_COLOR_ALPHA,
*geometry)
self.base_geometry = geometry
cr = cairo.Context(self.base)
cr.set_source_rgba(*self.bg_color)
cr.paint()
......@@ -421,9 +424,8 @@ class GraphWidget(Gtk.DrawingArea):
self.geometry = geometry
ul = self.pos_to_device((0, 0), surface=True)
lr = self.pos_to_device((self.base.get_width(),
self.base.get_height()),
surface=True)
lr = self.pos_to_device(self.base_geometry, surface=True)
if (ul[0] > 0 or lr[0] < geometry[0] or
ul[1] > 0 or lr[1] < geometry[1]):
self.regenerate_surface()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment