use Format_RGB32 when using QImage as paint device
this allows sub-pixel font antialiasing to take place.
This commit is contained in:
parent
a9161e0794
commit
fbc86cd2c5
@ -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.
|
||||
else:
|
||||
self.shm = mmap.mmap(self.shmFile.fileno(), size, mmap.MAP_SHARED, mmap.PROT_READ)
|
||||
self.shm.seek(0)
|
||||
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._img = QtGui.QImage(self.shm, w, h, QtGui.QImage.Format.Format_RGB32).copy()
|
||||
self.update()
|
||||
|
||||
def paintEvent(self, ev):
|
||||
if self._img is None:
|
||||
return
|
||||
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()
|
||||
|
||||
def serialize_mouse_enum(self, *args):
|
||||
@ -243,7 +240,7 @@ class Renderer(GraphicsView):
|
||||
# PySide2, PySide6
|
||||
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.fill(0xffffffff)
|
||||
|
Loading…
Reference in New Issue
Block a user