{"action":"created","issue":{"url":"https://api.github.com/repos/klayoutmatthias/klayout/issues/94","repository_url":"https://api.github.com/repos/klayoutmatthias/klayout","labels_url":"https://api.github.com/repos/klayoutmatthias/klayout/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/klayoutmatthias/klayout/issues/94/comments","events_url":"https://api.github.com/repos/klayoutmatthias/klayout/issues/94/events","html_url":"https://github.com/klayoutmatthias/klayout/issues/94","id":305789844,"number":94,"title":"(MacOS / hiDPI) Retina display rendering of canvas","user":{"login":"thomaslima","id":1088659,"avatar_url":"https://avatars2.githubusercontent.com/u/1088659?v=4","gravatar_id":"","url":"https://api.github.com/users/thomaslima","html_url":"https://github.com/thomaslima","followers_url":"https://api.github.com/users/thomaslima/followers","following_url":"https://api.github.com/users/thomaslima/following{/other_user}","gists_url":"https://api.github.com/users/thomaslima/gists{/gist_id}","starred_url":"https://api.github.com/users/thomaslima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomaslima/subscriptions","organizations_url":"https://api.github.com/users/thomaslima/orgs","repos_url":"https://api.github.com/users/thomaslima/repos","events_url":"https://api.github.com/users/thomaslima/events{/privacy}","received_events_url":"https://api.github.com/users/thomaslima/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-03-16T03:22:00Z","updated_at":"2018-03-19T22:41:55Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Dear all, \r\n\r\nI'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\r\n\r\nWhen 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](http://doc.qt.io/qt-5/qpixmap.html#setDevicePixelRatio). 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](https://github.com/lightwave-lab/klayout/blob/d97748df12f1841c33a327cf62ccebc1854118a3/src/laybasic/laybasic/layLayoutCanvas.cc#L717) would need some serious refactoring for that to work. I would need help for that.\r\n\r\nI'm working on the `macos_retina` branch in my fork: https://github.com/lightwave-lab/klayout/tree/macos_retina , feel free to contribute! \r\n\r\nBuild 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.\r\n\r\nI'm posting some preview pictures here, including failures in the case of 2x oversampling.\r\n\r\n<img width=\"1252\" alt=\"retina\" src=\"https://user-images.githubusercontent.com/1088659/37502016-3e24b240-28a7-11e8-87e2-fb25f2362fb9.png\">\r\n<img width=\"1252\" alt=\"no-retina\" src=\"https://user-images.githubusercontent.com/1088659/37502020-4245984e-28a7-11e8-8f5f-d83503eddcb5.png\">\r\n<img width=\"1252\" alt=\"retina2x\" src=\"https://user-images.githubusercontent.com/1088659/37502026-4b32558c-28a7-11e8-9e5c-09f73acc9e40.png\">\r\n<img width=\"1252\" alt=\"no-retina2x\" src=\"https://user-images.githubusercontent.com/1088659/37502032-4f914aca-28a7-11e8-84e9-dbde25c599ec.png\">"},"comment":{"url":"https://api.github.com/repos/klayoutmatthias/klayout/issues/comments/374409159","html_url":"https://github.com/klayoutmatthias/klayout/issues/94#issuecomment-374409159","issue_url":"https://api.github.com/repos/klayoutmatthias/klayout/issues/94","id":374409159,"user":{"login":"thomaslima","id":1088659,"avatar_url":"https://avatars2.githubusercontent.com/u/1088659?v=4","gravatar_id":"","url":"https://api.github.com/users/thomaslima","html_url":"https://github.com/thomaslima","followers_url":"https://api.github.com/users/thomaslima/followers","following_url":"https://api.github.com/users/thomaslima/following{/other_user}","gists_url":"https://api.github.com/users/thomaslima/gists{/gist_id}","starred_url":"https://api.github.com/users/thomaslima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomaslima/subscriptions","organizations_url":"https://api.github.com/users/thomaslima/orgs","repos_url":"https://api.github.com/users/thomaslima/repos","events_url":"https://api.github.com/users/thomaslima/events{/privacy}","received_events_url":"https://api.github.com/users/thomaslima/received_events","type":"User","site_admin":false},"created_at":"2018-03-19T22:41:55Z","updated_at":"2018-03-19T22:41:55Z","author_association":"CONTRIBUTOR","body":"@klayoutmatthias I think it has to do with the `m_trans` variable in the `ViewObjectWidget::mouse_event_trans` method. Really excited to test this out."}}
{"actor":{"display_login":"thomaslima"}}