Dear all,
I've been working on this retina display rendering feature recently. I've scratched my head quite a bit and I think I'm starting to, dare I say, deal with some bugs in Qt. Here's the Qt doc about it: http://doc.qt.io/qt-5/qpainter.html#drawing-high-resolution-versions-of-pixmaps-and-images
When you have a QImage, it suffices to say qimg.setDevicePixelRatio(2) for retina Macs, then the QPixmap created after it respects the DPR and renders correctly. But a QBitmap (which inherits QPixmap) object, such as the ruler, fails to render correctly, even though it should. I've tried many ways to make it render, and the only way i got it to work was to convert the bitmap to an image, and then back to pixmap. This part of the code would need some serious refactoring for that to work. I would need help for that.
I'm working on the macos_retina branch in my fork: https://github.com/lightwave-lab/klayout/tree/macos_retina , feel free to contribute!
Build with ./build4mac.py -p B36 -q Qt5Custom && ./build4mac.py -p B36 -q Qt5Custom -Y && qt5.pkg.macos-HighSierra-release/klayout.app/Contents/MacOS/klayout, with qt and python from brew.
I'm posting some preview pictures here, including failures in the case of 2x oversampling.




Dear all,
I've been working on this retina display rendering feature recently. I've scratched my head quite a bit and I think I'm starting to, dare I say, deal with some bugs in Qt. Here's the Qt doc about it: http://doc.qt.io/qt-5/qpainter.html#drawing-high-resolution-versions-of-pixmaps-and-images
When you have a
QImage, it suffices to sayqimg.setDevicePixelRatio(2)for retina Macs, then theQPixmapcreated after it respects the DPR and renders correctly. But aQBitmap(which inheritsQPixmap) object, such as the ruler, fails to render correctly, even though it should. I've tried many ways to make it render, and the only way i got it to work was to convert the bitmap to an image, and then back to pixmap. This part of the code would need some serious refactoring for that to work. I would need help for that.I'm working on the
macos_retinabranch in my fork: https://github.com/lightwave-lab/klayout/tree/macos_retina , feel free to contribute!Build with
./build4mac.py -p B36 -q Qt5Custom && ./build4mac.py -p B36 -q Qt5Custom -Y && qt5.pkg.macos-HighSierra-release/klayout.app/Contents/MacOS/klayout, withqtandpythonfrom brew.I'm posting some preview pictures here, including failures in the case of 2x oversampling.