Skip to content

(MacOS / hiDPI) Retina display rendering #94

@thomaslima

Description

@thomaslima

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.

retina

no-retina

retina2x

no-retina2x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions