From 31f9d0024a9225b3b250221f7ecbf4169495c359 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sat, 17 Jul 2021 07:56:21 +0800 Subject: [PATCH] simplify modelview projection computation 1) no need to get rect(), which is actually defined as QRect(0, 0, width(), height()) 2) use col-maj data() instead of row-maj copyDataTo() - glLoadMatrixf() takes col-maj --- pyqtgraph/graphicsItems/PlotCurveItem.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pyqtgraph/graphicsItems/PlotCurveItem.py b/pyqtgraph/graphicsItems/PlotCurveItem.py index d062c495..f31fd458 100644 --- a/pyqtgraph/graphicsItems/PlotCurveItem.py +++ b/pyqtgraph/graphicsItems/PlotCurveItem.py @@ -575,13 +575,11 @@ class PlotCurveItem(GraphicsObject): # https://code.woboq.org/qt6/qtbase/src/opengl/qopenglpaintengine.cpp.html # Technically, we could enable it for all platforms, but for now, just # enable it where it is required, i.e. Windows - tr = self.sceneTransform() - rect = widget.rect() gl.glMatrixMode(gl.GL_PROJECTION) gl.glLoadIdentity() - gl.glOrtho(rect.x(), rect.width(), rect.height(), rect.y(), -999999, 999999) + gl.glOrtho(0, widget.width(), widget.height(), 0, -999999, 999999) gl.glMatrixMode(gl.GL_MODELVIEW) - gl.glLoadTransposeMatrixf(QtGui.QMatrix4x4(tr).copyDataTo()) + gl.glLoadMatrixf(QtGui.QMatrix4x4(self.sceneTransform()).data()) ## set clipping viewport view = self.getViewBox()