We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
RawImageWidget ignores imageAxisOrder config option
### Short description
RawImageWidget ignores imageAxisOrder whereas RawImageGLWidget respects it.
In the included example below, the user needs to manually transpose the image.

### Code to reproduce
```python
import scipy.misc
import pyqtgraph as pg
from pyqtgraph.widgets.RawImageWidget import RawImageWidget, RawImageGLWidget

pg.setConfigOptions(imageAxisOrder='row-major')

data = scipy.misc.face()

app = pg.mkQApp()
win = pg.Qt.QtWidgets.QMainWindow()
if 1:
    wgt = RawImageWidget(scaled=True)
    # data = data.transpose(1,0,2)    # needs a manual transpose
else:
    wgt = RawImageGLWidget()
wgt.setImage(data)
win.setCentralWidget(wgt)
win.resize(800, 600)
win.show()
app.exec_()
```

### Expected behavior
<!-- What should happen? -->
Image displayed right-side up

### Real behavior
<!-- What happens? -->
Image displayed transposed

### Tested environment(s)

 * PyQtGraph version: 0.11.1.dev0
 * Qt Python binding: PyQt5 5.15.2 Qt 5.15.2
 * Python version: 3.7.9
 * NumPy version: 1.19.4
 * Operating system: Windows 10 x64
 * Installation method: pip install -e .

### Additional context
None

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pyqtgraph/widgets/RawImageWidget.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 """
3 RawImageWidget.py
4 Copyright 2010-2016 Luke Campagnola
5 Distributed under MIT/X11 license. See license.txt for more infomation.
6 """
7 
8 from .. import getConfigOption, functions as fn, getCupy
9 from ..Qt import QtCore, QtGui
10 
11 try:
12     from ..Qt import QtWidgets
13     from OpenGL.GL import *
14 
15     HAVE_OPENGL = True
16 except (ImportError, AttributeError):
17     # Would prefer `except ImportError` here, but some versions of pyopengl generate
18     # AttributeError upon import
19     HAVE_OPENGL = False
20 
21 
22 class RawImageWidget(QtGui.QWidget):
23     """
24     Widget optimized for very fast video display.
25     Generally using an ImageItem inside GraphicsView is fast enough.
26     On some systems this may provide faster video. See the VideoSpeedTest example for benchmarking.
27     """
28 
29     def __init__(self, parent=None, scaled=False):
30         """
31         Setting scaled=True will cause the entire image to be displayed within the boundaries of the widget.
32         This also greatly reduces the speed at which it will draw frames.
33         """
34         QtGui.QWidget.__init__(self, parent)
35         self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
36         self.scaled = scaled
37         self.opts = None
38         self.image = None
39         self._cp = getCupy()
40 
41     def setImage(self, img, *args, **kargs):
42         """
43         img must be ndarray of shape (x,y), (x,y,3), or (x,y,4).
44         Extra arguments are sent to functions.makeARGB
45         """
46         self.opts = (img, args, kargs)
47         self.image = None
48         self.update()
49 
50     def paintEvent(self, ev):
51         if self.opts is None:
52             return
53         if self.image is None:
54             argb, alpha = fn.makeARGB(self.opts[0], *self.opts[1], **self.opts[2])
55             if self._cp and self._cp.get_array_module(argb) == self._cp:
56                 argb = argb.get()  # transfer GPU data back to the CPU
57             self.image = fn.makeQImage(argb, alpha)
58             self.opts = ()
59         # if self.pixmap is None:
60             # self.pixmap = QtGui.QPixmap.fromImage(self.image)
61         p = QtGui.QPainter(self)
62         if self.scaled:
63             rect = self.rect()
64             ar = rect.width() / float(rect.height())
65             imar = self.image.width() / float(self.image.height())
66             if ar > imar:
67                 rect.setWidth(int(rect.width() * imar / ar))
68             else:
69                 rect.setHeight(int(rect.height() * ar / imar))
70 
71             p.drawImage(rect, self.image)
72         else:
73             p.drawImage(QtCore.QPointF(), self.image)
74         # p.drawPixmap(self.rect(), self.pixmap)
75         p.end()
76 
77 
78 if HAVE_OPENGL:
79     class RawImageGLWidget(QtWidgets.QOpenGLWidget):
80         """
81         Similar to RawImageWidget, but uses a GL widget to do all drawing.
82         Perfomance varies between platforms; see examples/VideoSpeedTest for benchmarking.
83 
84         Checks if setConfigOptions(imageAxisOrder='row-major') was set.
85         """
86 
87         def __init__(self, parent=None, scaled=False):
88             QtWidgets.QOpenGLWidget.__init__(self, parent)
89             self.scaled = scaled
90             self.image = None
91             self.uploaded = False
92             self.smooth = False
93             self.opts = None
94             self.row_major = getConfigOption('imageAxisOrder') == 'row-major'
95 
96         def setImage(self, img, *args, **kargs):
97             """
98             img must be ndarray of shape (x,y), (x,y,3), or (x,y,4).
99             Extra arguments are sent to functions.makeARGB
100             """
101             self.opts = (img, args, kargs)
102             self.image = None
103             self.uploaded = False
104             self.update()
105 
106         def initializeGL(self):
107             self.texture = glGenTextures(1)
108 
109         def uploadTexture(self):
110             glEnable(GL_TEXTURE_2D)
111             glBindTexture(GL_TEXTURE_2D, self.texture)
112             if self.smooth:
113                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
114                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
115             else:
116                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
117                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
118             glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER)
119             glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER)
120             # glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER)
121 
122             if self.row_major:
123                 image = self.image
124             else:
125                 image = self.image.transpose((1, 0, 2))
126 
127             # ## Test texture dimensions first
128             # shape = self.image.shape
129             # glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, shape[0], shape[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, None)
130             # if glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH) == 0:
131             # raise Exception("OpenGL failed to create 2D texture (%dx%d); too large for this hardware." % shape[:2])
132 
133             glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.shape[1], image.shape[0], 0, GL_RGBA, GL_UNSIGNED_BYTE, image)
134             glDisable(GL_TEXTURE_2D)
135 
136         def paintGL(self):
137             glClear(GL_COLOR_BUFFER_BIT)
138 
139             if self.image is None:
140                 if self.opts is None:
141                     return
142                 img, args, kwds = self.opts
143                 kwds['useRGBA'] = True
144                 self.image, alpha = fn.makeARGB(img, *args, **kwds)
145 
146             if not self.uploaded:
147                 self.uploadTexture()
148 
149             glEnable(GL_TEXTURE_2D)
150             glBindTexture(GL_TEXTURE_2D, self.texture)
151             glColor4f(1, 1, 1, 1)
152 
153             glBegin(GL_QUADS)
154             glTexCoord2f(0, 1)
155             glVertex3f(-1, -1, 0)
156             glTexCoord2f(1, 1)
157             glVertex3f(1, -1, 0)
158             glTexCoord2f(1, 0)
159             glVertex3f(1, 1, 0)
160             glTexCoord2f(0, 0)
161             glVertex3f(-1, 1, 0)
162             glEnd()
163             glDisable(GL_TEXTURE_3D)
164
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pyqtgraph/widgets/RawImageWidget.py b/pyqtgraph/widgets/RawImageWidget.py
--- a/pyqtgraph/widgets/RawImageWidget.py
+++ b/pyqtgraph/widgets/RawImageWidget.py
@@ -43,6 +43,8 @@
         img must be ndarray of shape (x,y), (x,y,3), or (x,y,4).
         Extra arguments are sent to functions.makeARGB
         """
+        if getConfigOption('imageAxisOrder') == 'row-major':
+            img = img.transpose((1, 0, 2))
         self.opts = (img, args, kargs)
         self.image = None
         self.update()
@@ -79,7 +81,7 @@
     class RawImageGLWidget(QtWidgets.QOpenGLWidget):
         """
         Similar to RawImageWidget, but uses a GL widget to do all drawing.
-        Perfomance varies between platforms; see examples/VideoSpeedTest for benchmarking.
+        Performance varies between platforms; see examples/VideoSpeedTest for benchmarking.
 
         Checks if setConfigOptions(imageAxisOrder='row-major') was set.
         """
@@ -91,7 +93,6 @@
             self.uploaded = False
             self.smooth = False
             self.opts = None
-            self.row_major = getConfigOption('imageAxisOrder') == 'row-major'
 
         def setImage(self, img, *args, **kargs):
             """
@@ -118,20 +119,20 @@
             glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER)
             glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER)
             # glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER)
-
-            if self.row_major:
+            if getConfigOption('imageAxisOrder') == 'row-major':
                 image = self.image
             else:
                 image = self.image.transpose((1, 0, 2))
 
-            # ## Test texture dimensions first
+            ## Test texture dimensions first
             # shape = self.image.shape
             # glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, shape[0], shape[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, None)
             # if glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH) == 0:
-            # raise Exception("OpenGL failed to create 2D texture (%dx%d); too large for this hardware." % shape[:2])
+                # raise Exception("OpenGL failed to create 2D texture (%dx%d); too large for this hardware." % shape[:2])
 
             glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.shape[1], image.shape[0], 0, GL_RGBA, GL_UNSIGNED_BYTE, image)
             glDisable(GL_TEXTURE_2D)
+            self.uploaded = True
 
         def paintGL(self):
             glClear(GL_COLOR_BUFFER_BIT)

{"golden_diff": "diff --git a/pyqtgraph/widgets/RawImageWidget.py b/pyqtgraph/widgets/RawImageWidget.py\n--- a/pyqtgraph/widgets/RawImageWidget.py\n+++ b/pyqtgraph/widgets/RawImageWidget.py\n@@ -43,6 +43,8 @@\n         img must be ndarray of shape (x,y), (x,y,3), or (x,y,4).\n         Extra arguments are sent to functions.makeARGB\n         \"\"\"\n+        if getConfigOption('imageAxisOrder') == 'row-major':\n+            img = img.transpose((1, 0, 2))\n         self.opts = (img, args, kargs)\n         self.image = None\n         self.update()\n@@ -79,7 +81,7 @@\n     class RawImageGLWidget(QtWidgets.QOpenGLWidget):\n         \"\"\"\n         Similar to RawImageWidget, but uses a GL widget to do all drawing.\n-        Perfomance varies between platforms; see examples/VideoSpeedTest for benchmarking.\n+        Performance varies between platforms; see examples/VideoSpeedTest for benchmarking.\n \n         Checks if setConfigOptions(imageAxisOrder='row-major') was set.\n         \"\"\"\n@@ -91,7 +93,6 @@\n             self.uploaded = False\n             self.smooth = False\n             self.opts = None\n-            self.row_major = getConfigOption('imageAxisOrder') == 'row-major'\n \n         def setImage(self, img, *args, **kargs):\n             \"\"\"\n@@ -118,20 +119,20 @@\n             glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER)\n             glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER)\n             # glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER)\n-\n-            if self.row_major:\n+            if getConfigOption('imageAxisOrder') == 'row-major':\n                 image = self.image\n             else:\n                 image = self.image.transpose((1, 0, 2))\n \n-            # ## Test texture dimensions first\n+            ## Test texture dimensions first\n             # shape = self.image.shape\n             # glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, shape[0], shape[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, None)\n             # if glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH) == 0:\n-            # raise Exception(\"OpenGL failed to create 2D texture (%dx%d); too large for this hardware.\" % shape[:2])\n+                # raise Exception(\"OpenGL failed to create 2D texture (%dx%d); too large for this hardware.\" % shape[:2])\n \n             glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.shape[1], image.shape[0], 0, GL_RGBA, GL_UNSIGNED_BYTE, image)\n             glDisable(GL_TEXTURE_2D)\n+            self.uploaded = True\n \n         def paintGL(self):\n             glClear(GL_COLOR_BUFFER_BIT)\n", "issue": "RawImageWidget ignores imageAxisOrder config option\n### Short description\r\nRawImageWidget ignores imageAxisOrder whereas RawImageGLWidget respects it.\r\nIn the included example below, the user needs to manually transpose the image.\r\n\r\n### Code to reproduce\r\n```python\r\nimport scipy.misc\r\nimport pyqtgraph as pg\r\nfrom pyqtgraph.widgets.RawImageWidget import RawImageWidget, RawImageGLWidget\r\n\r\npg.setConfigOptions(imageAxisOrder='row-major')\r\n\r\ndata = scipy.misc.face()\r\n\r\napp = pg.mkQApp()\r\nwin = pg.Qt.QtWidgets.QMainWindow()\r\nif 1:\r\n    wgt = RawImageWidget(scaled=True)\r\n    # data = data.transpose(1,0,2)    # needs a manual transpose\r\nelse:\r\n    wgt = RawImageGLWidget()\r\nwgt.setImage(data)\r\nwin.setCentralWidget(wgt)\r\nwin.resize(800, 600)\r\nwin.show()\r\napp.exec_()\r\n```\r\n\r\n### Expected behavior\r\n<!-- What should happen? -->\r\nImage displayed right-side up\r\n\r\n### Real behavior\r\n<!-- What happens? -->\r\nImage displayed transposed\r\n\r\n### Tested environment(s)\r\n\r\n * PyQtGraph version: 0.11.1.dev0\r\n * Qt Python binding: PyQt5 5.15.2 Qt 5.15.2\r\n * Python version: 3.7.9\r\n * NumPy version: 1.19.4\r\n * Operating system: Windows 10 x64\r\n * Installation method: pip install -e .\r\n\r\n### Additional context\r\nNone\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nRawImageWidget.py\nCopyright 2010-2016 Luke Campagnola\nDistributed under MIT/X11 license. See license.txt for more infomation.\n\"\"\"\n\nfrom .. import getConfigOption, functions as fn, getCupy\nfrom ..Qt import QtCore, QtGui\n\ntry:\n    from ..Qt import QtWidgets\n    from OpenGL.GL import *\n\n    HAVE_OPENGL = True\nexcept (ImportError, AttributeError):\n    # Would prefer `except ImportError` here, but some versions of pyopengl generate\n    # AttributeError upon import\n    HAVE_OPENGL = False\n\n\nclass RawImageWidget(QtGui.QWidget):\n    \"\"\"\n    Widget optimized for very fast video display.\n    Generally using an ImageItem inside GraphicsView is fast enough.\n    On some systems this may provide faster video. See the VideoSpeedTest example for benchmarking.\n    \"\"\"\n\n    def __init__(self, parent=None, scaled=False):\n        \"\"\"\n        Setting scaled=True will cause the entire image to be displayed within the boundaries of the widget.\n        This also greatly reduces the speed at which it will draw frames.\n        \"\"\"\n        QtGui.QWidget.__init__(self, parent)\n        self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))\n        self.scaled = scaled\n        self.opts = None\n        self.image = None\n        self._cp = getCupy()\n\n    def setImage(self, img, *args, **kargs):\n        \"\"\"\n        img must be ndarray of shape (x,y), (x,y,3), or (x,y,4).\n        Extra arguments are sent to functions.makeARGB\n        \"\"\"\n        self.opts = (img, args, kargs)\n        self.image = None\n        self.update()\n\n    def paintEvent(self, ev):\n        if self.opts is None:\n            return\n        if self.image is None:\n            argb, alpha = fn.makeARGB(self.opts[0], *self.opts[1], **self.opts[2])\n            if self._cp and self._cp.get_array_module(argb) == self._cp:\n                argb = argb.get()  # transfer GPU data back to the CPU\n            self.image = fn.makeQImage(argb, alpha)\n            self.opts = ()\n        # if self.pixmap is None:\n            # self.pixmap = QtGui.QPixmap.fromImage(self.image)\n        p = QtGui.QPainter(self)\n        if self.scaled:\n            rect = self.rect()\n            ar = rect.width() / float(rect.height())\n            imar = self.image.width() / float(self.image.height())\n            if ar > imar:\n                rect.setWidth(int(rect.width() * imar / ar))\n            else:\n                rect.setHeight(int(rect.height() * ar / imar))\n\n            p.drawImage(rect, self.image)\n        else:\n            p.drawImage(QtCore.QPointF(), self.image)\n        # p.drawPixmap(self.rect(), self.pixmap)\n        p.end()\n\n\nif HAVE_OPENGL:\n    class RawImageGLWidget(QtWidgets.QOpenGLWidget):\n        \"\"\"\n        Similar to RawImageWidget, but uses a GL widget to do all drawing.\n        Perfomance varies between platforms; see examples/VideoSpeedTest for benchmarking.\n\n        Checks if setConfigOptions(imageAxisOrder='row-major') was set.\n        \"\"\"\n\n        def __init__(self, parent=None, scaled=False):\n            QtWidgets.QOpenGLWidget.__init__(self, parent)\n            self.scaled = scaled\n            self.image = None\n            self.uploaded = False\n            self.smooth = False\n            self.opts = None\n            self.row_major = getConfigOption('imageAxisOrder') == 'row-major'\n\n        def setImage(self, img, *args, **kargs):\n            \"\"\"\n            img must be ndarray of shape (x,y), (x,y,3), or (x,y,4).\n            Extra arguments are sent to functions.makeARGB\n            \"\"\"\n            self.opts = (img, args, kargs)\n            self.image = None\n            self.uploaded = False\n            self.update()\n\n        def initializeGL(self):\n            self.texture = glGenTextures(1)\n\n        def uploadTexture(self):\n            glEnable(GL_TEXTURE_2D)\n            glBindTexture(GL_TEXTURE_2D, self.texture)\n            if self.smooth:\n                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)\n                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)\n            else:\n                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)\n                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)\n            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER)\n            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER)\n            # glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER)\n\n            if self.row_major:\n                image = self.image\n            else:\n                image = self.image.transpose((1, 0, 2))\n\n            # ## Test texture dimensions first\n            # shape = self.image.shape\n            # glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, shape[0], shape[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, None)\n            # if glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH) == 0:\n            # raise Exception(\"OpenGL failed to create 2D texture (%dx%d); too large for this hardware.\" % shape[:2])\n\n            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.shape[1], image.shape[0], 0, GL_RGBA, GL_UNSIGNED_BYTE, image)\n            glDisable(GL_TEXTURE_2D)\n\n        def paintGL(self):\n            glClear(GL_COLOR_BUFFER_BIT)\n\n            if self.image is None:\n                if self.opts is None:\n                    return\n                img, args, kwds = self.opts\n                kwds['useRGBA'] = True\n                self.image, alpha = fn.makeARGB(img, *args, **kwds)\n\n            if not self.uploaded:\n                self.uploadTexture()\n\n            glEnable(GL_TEXTURE_2D)\n            glBindTexture(GL_TEXTURE_2D, self.texture)\n            glColor4f(1, 1, 1, 1)\n\n            glBegin(GL_QUADS)\n            glTexCoord2f(0, 1)\n            glVertex3f(-1, -1, 0)\n            glTexCoord2f(1, 1)\n            glVertex3f(1, -1, 0)\n            glTexCoord2f(1, 0)\n            glVertex3f(1, 1, 0)\n            glTexCoord2f(0, 0)\n            glVertex3f(-1, 1, 0)\n            glEnd()\n            glDisable(GL_TEXTURE_3D)\n", "path": "pyqtgraph/widgets/RawImageWidget.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nRawImageWidget.py\nCopyright 2010-2016 Luke Campagnola\nDistributed under MIT/X11 license. See license.txt for more infomation.\n\"\"\"\n\nfrom .. import getConfigOption, functions as fn, getCupy\nfrom ..Qt import QtCore, QtGui\n\ntry:\n    from ..Qt import QtWidgets\n    from OpenGL.GL import *\n\n    HAVE_OPENGL = True\nexcept (ImportError, AttributeError):\n    # Would prefer `except ImportError` here, but some versions of pyopengl generate\n    # AttributeError upon import\n    HAVE_OPENGL = False\n\n\nclass RawImageWidget(QtGui.QWidget):\n    \"\"\"\n    Widget optimized for very fast video display.\n    Generally using an ImageItem inside GraphicsView is fast enough.\n    On some systems this may provide faster video. See the VideoSpeedTest example for benchmarking.\n    \"\"\"\n\n    def __init__(self, parent=None, scaled=False):\n        \"\"\"\n        Setting scaled=True will cause the entire image to be displayed within the boundaries of the widget.\n        This also greatly reduces the speed at which it will draw frames.\n        \"\"\"\n        QtGui.QWidget.__init__(self, parent)\n        self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))\n        self.scaled = scaled\n        self.opts = None\n        self.image = None\n        self._cp = getCupy()\n\n    def setImage(self, img, *args, **kargs):\n        \"\"\"\n        img must be ndarray of shape (x,y), (x,y,3), or (x,y,4).\n        Extra arguments are sent to functions.makeARGB\n        \"\"\"\n        if getConfigOption('imageAxisOrder') == 'row-major':\n            img = img.transpose((1, 0, 2))\n        self.opts = (img, args, kargs)\n        self.image = None\n        self.update()\n\n    def paintEvent(self, ev):\n        if self.opts is None:\n            return\n        if self.image is None:\n            argb, alpha = fn.makeARGB(self.opts[0], *self.opts[1], **self.opts[2])\n            if self._cp and self._cp.get_array_module(argb) == self._cp:\n                argb = argb.get()  # transfer GPU data back to the CPU\n            self.image = fn.makeQImage(argb, alpha)\n            self.opts = ()\n        # if self.pixmap is None:\n            # self.pixmap = QtGui.QPixmap.fromImage(self.image)\n        p = QtGui.QPainter(self)\n        if self.scaled:\n            rect = self.rect()\n            ar = rect.width() / float(rect.height())\n            imar = self.image.width() / float(self.image.height())\n            if ar > imar:\n                rect.setWidth(int(rect.width() * imar / ar))\n            else:\n                rect.setHeight(int(rect.height() * ar / imar))\n\n            p.drawImage(rect, self.image)\n        else:\n            p.drawImage(QtCore.QPointF(), self.image)\n        # p.drawPixmap(self.rect(), self.pixmap)\n        p.end()\n\n\nif HAVE_OPENGL:\n    class RawImageGLWidget(QtWidgets.QOpenGLWidget):\n        \"\"\"\n        Similar to RawImageWidget, but uses a GL widget to do all drawing.\n        Performance varies between platforms; see examples/VideoSpeedTest for benchmarking.\n\n        Checks if setConfigOptions(imageAxisOrder='row-major') was set.\n        \"\"\"\n\n        def __init__(self, parent=None, scaled=False):\n            QtWidgets.QOpenGLWidget.__init__(self, parent)\n            self.scaled = scaled\n            self.image = None\n            self.uploaded = False\n            self.smooth = False\n            self.opts = None\n\n        def setImage(self, img, *args, **kargs):\n            \"\"\"\n            img must be ndarray of shape (x,y), (x,y,3), or (x,y,4).\n            Extra arguments are sent to functions.makeARGB\n            \"\"\"\n            self.opts = (img, args, kargs)\n            self.image = None\n            self.uploaded = False\n            self.update()\n\n        def initializeGL(self):\n            self.texture = glGenTextures(1)\n\n        def uploadTexture(self):\n            glEnable(GL_TEXTURE_2D)\n            glBindTexture(GL_TEXTURE_2D, self.texture)\n            if self.smooth:\n                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)\n                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)\n            else:\n                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)\n                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)\n            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER)\n            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER)\n            # glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER)\n            if getConfigOption('imageAxisOrder') == 'row-major':\n                image = self.image\n            else:\n                image = self.image.transpose((1, 0, 2))\n\n            ## Test texture dimensions first\n            # shape = self.image.shape\n            # glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, shape[0], shape[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, None)\n            # if glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH) == 0:\n                # raise Exception(\"OpenGL failed to create 2D texture (%dx%d); too large for this hardware.\" % shape[:2])\n\n            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.shape[1], image.shape[0], 0, GL_RGBA, GL_UNSIGNED_BYTE, image)\n            glDisable(GL_TEXTURE_2D)\n            self.uploaded = True\n\n        def paintGL(self):\n            glClear(GL_COLOR_BUFFER_BIT)\n\n            if self.image is None:\n                if self.opts is None:\n                    return\n                img, args, kwds = self.opts\n                kwds['useRGBA'] = True\n                self.image, alpha = fn.makeARGB(img, *args, **kwds)\n\n            if not self.uploaded:\n                self.uploadTexture()\n\n            glEnable(GL_TEXTURE_2D)\n            glBindTexture(GL_TEXTURE_2D, self.texture)\n            glColor4f(1, 1, 1, 1)\n\n            glBegin(GL_QUADS)\n            glTexCoord2f(0, 1)\n            glVertex3f(-1, -1, 0)\n            glTexCoord2f(1, 1)\n            glVertex3f(1, -1, 0)\n            glTexCoord2f(1, 0)\n            glVertex3f(1, 1, 0)\n            glTexCoord2f(0, 0)\n            glVertex3f(-1, 1, 0)\n            glEnd()\n            glDisable(GL_TEXTURE_3D)\n", "path": "pyqtgraph/widgets/RawImageWidget.py"}]}