diff --git a/src/graph_tool/draw/gtk_draw.py b/src/graph_tool/draw/gtk_draw.py
index 6139a3b..95392cc 100644
a
|
b
|
class GraphWidget(Gtk.DrawingArea): |
240 | 240 | |
241 | 241 | self.geometry = None |
242 | 242 | self.base = None |
| 243 | self.base_geometry = None |
243 | 244 | self.background = None |
244 | 245 | self.bg_color = bg_color if bg_color is not None else [1, 1, 1, 1] |
245 | 246 | self.surface_callback = None |
… |
… |
class GraphWidget(Gtk.DrawingArea): |
384 | 385 | self.get_allocated_height()) |
385 | 386 | self.smatrix = self.smatrix * m |
386 | 387 | self.tmatrix = self.tmatrix * self.smatrix |
387 | | if (self.base is None or self.base.get_width() != geometry[0] or |
388 | | self.base.get_height() != geometry[1]): |
| 388 | if (self.base is None or self.base_geometry[0] != geometry[0] or |
| 389 | self.base_geometry[1] != geometry[1]): |
389 | 390 | # self.base = cairo.ImageSurface(cairo.FORMAT_ARGB32, |
390 | 391 | # *geometry) |
391 | 392 | w = self.get_window() |
… |
… |
class GraphWidget(Gtk.DrawingArea): |
393 | 394 | return False |
394 | 395 | self.base = w.create_similar_surface(cairo.CONTENT_COLOR_ALPHA, |
395 | 396 | *geometry) |
| 397 | self.base_geometry = geometry |
| 398 | |
396 | 399 | cr = cairo.Context(self.base) |
397 | 400 | cr.set_source_rgba(*self.bg_color) |
398 | 401 | cr.paint() |
… |
… |
class GraphWidget(Gtk.DrawingArea): |
421 | 424 | self.geometry = geometry |
422 | 425 | |
423 | 426 | ul = self.pos_to_device((0, 0), surface=True) |
424 | | lr = self.pos_to_device((self.base.get_width(), |
425 | | self.base.get_height()), |
426 | | surface=True) |
| 427 | lr = self.pos_to_device(self.base_geometry, surface=True) |
| 428 | |
427 | 429 | if (ul[0] > 0 or lr[0] < geometry[0] or |
428 | 430 | ul[1] > 0 or lr[1] < geometry[1]): |
429 | 431 | self.regenerate_surface() |