From 5a3cdaca89f07ff92c2299bf50902ae0c38ee632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Fri, 13 Sep 2019 21:09:51 +0200 Subject: [PATCH] libgui/GuiCanvasWxBackend.py:GuiBufferedDC.__init__(): directly select buffer into DC. libroar/RoarCanvasWindow.py:applyTool(): normalise mapPoint w/ viewRect if mapPoint != None. --- libgui/GuiCanvasWxBackend.py | 7 ++----- libroar/RoarCanvasWindow.py | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libgui/GuiCanvasWxBackend.py b/libgui/GuiCanvasWxBackend.py index f3d4748..658c753 100644 --- a/libgui/GuiCanvasWxBackend.py +++ b/libgui/GuiCanvasWxBackend.py @@ -22,11 +22,8 @@ class GuiBufferedDC(wx.MemoryDC): viewRect = [m * n for m, n in zip(backend.cellSize, viewRect)] viewSize = [min(m, n) for m, n in zip(canvasSize, clientSize)] viewSize = [m * n for m, n in zip(backend.cellSize, viewSize)] - bitmap = wx.Bitmap(viewSize); self.SelectObject(bitmap); - bufferDc = wx.MemoryDC(); bufferDc.SelectObject(buffer); - self.Blit(0, 0, *viewSize, bufferDc, *viewRect) - bufferDc.SelectObject(wx.NullBitmap) - self.dc, self.viewSize = dc, viewSize + self.SelectObject(buffer); self.SetDeviceOrigin(*viewRect); + self.dc, self.viewRect, self.viewSize = dc, viewRect, viewSize # }}} class GuiCanvasWxBackend(): diff --git a/libroar/RoarCanvasWindow.py b/libroar/RoarCanvasWindow.py index 6dcb5a5..dde9b0b 100644 --- a/libroar/RoarCanvasWindow.py +++ b/libroar/RoarCanvasWindow.py @@ -47,6 +47,8 @@ class RoarCanvasWindow(GuiWindow): # {{{ applyTool(self, eventDc, eventMouse, keyChar, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, tool, viewRect) def applyTool(self, eventDc, eventMouse, keyChar, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, tool, viewRect): + if mapPoint != None: + mapPoint = [a + b for a, b in zip(mapPoint, viewRect)] dirty, self.canvas.dirtyCursor, rc = False, False, False self.canvas.journal.begin() if eventMouse: