Merge pull request #1738 from pijyoi/fix_font
use Format_RGB32 when using QImage as paint device
This commit is contained in:
commit
cf95964678
@ -80,17 +80,14 @@ class RemoteGraphicsView(QtGui.QWidget):
|
|||||||
self.shm = mmap.mmap(-1, size, self.shmtag) ## can't use tmpfile on windows because the file can only be opened once.
|
self.shm = mmap.mmap(-1, size, self.shmtag) ## can't use tmpfile on windows because the file can only be opened once.
|
||||||
else:
|
else:
|
||||||
self.shm = mmap.mmap(self.shmFile.fileno(), size, mmap.MAP_SHARED, mmap.PROT_READ)
|
self.shm = mmap.mmap(self.shmFile.fileno(), size, mmap.MAP_SHARED, mmap.PROT_READ)
|
||||||
self.shm.seek(0)
|
self._img = QtGui.QImage(self.shm, w, h, QtGui.QImage.Format.Format_RGB32).copy()
|
||||||
data = self.shm.read(w*h*4)
|
|
||||||
self._img = QtGui.QImage(data, w, h, QtGui.QImage.Format_ARGB32)
|
|
||||||
self._img.data = data # data must be kept alive or PySide 1.2.1 (and probably earlier) will crash.
|
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def paintEvent(self, ev):
|
def paintEvent(self, ev):
|
||||||
if self._img is None:
|
if self._img is None:
|
||||||
return
|
return
|
||||||
p = QtGui.QPainter(self)
|
p = QtGui.QPainter(self)
|
||||||
p.drawImage(self.rect(), self._img, QtCore.QRect(0, 0, self._img.width(), self._img.height()))
|
p.drawImage(self.rect(), self._img, self._img.rect())
|
||||||
p.end()
|
p.end()
|
||||||
|
|
||||||
def serialize_mouse_enum(self, *args):
|
def serialize_mouse_enum(self, *args):
|
||||||
@ -243,7 +240,7 @@ class Renderer(GraphicsView):
|
|||||||
# PySide2, PySide6
|
# PySide2, PySide6
|
||||||
img_ptr = self.shm
|
img_ptr = self.shm
|
||||||
|
|
||||||
self.img = QtGui.QImage(img_ptr, iwidth, iheight, QtGui.QImage.Format_ARGB32)
|
self.img = QtGui.QImage(img_ptr, iwidth, iheight, QtGui.QImage.Format.Format_RGB32)
|
||||||
self.img.setDevicePixelRatio(dpr)
|
self.img.setDevicePixelRatio(dpr)
|
||||||
|
|
||||||
self.img.fill(0xffffffff)
|
self.img.fill(0xffffffff)
|
||||||
|
Loading…
Reference in New Issue
Block a user