Skip to content

Deprecating Device#getDPI #2260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ShahzaibIbrahim
Copy link
Contributor

Having the scale factor being based on the screen DPI leads to unexpected result e.g. Image too big/small. Having a screen dpi independent factor leads to consistent results.

Having the scale factor being based on the screen DPI leads to
unexpected result e.g. Image too big/small. Having a screen dpi
independent factor leads to consistent results
Copy link
Contributor

Test Results

   545 files  + 6     545 suites  +6   31m 21s ⏱️ +4s
 4 403 tests +37   4 385 ✅ +35   18 💤 +3  0 ❌  - 1 
16 733 runs  +37  16 593 ✅ +35  140 💤 +3  0 ❌  - 1 

Results for commit 6495a16. ± Comparison against base commit a413b4b.

Point printerDPI = printer.getDPI();
int scaleFactor = printerDPI.x / screenDPI.x;
int scaleFactor = printerDPI.x / 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't Display:getDPI always returning 96?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it depends on the display. Sometimes 144 or 96 or depending on the monitor. We then decided to use 100 as the base consistent value to calculate the scaleFactor like we did here: https://github.com/eclipse-platform/eclipse.platform.swt/pull/1802/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mark Device::getDPI() method as deprecated Replace Device::getDPI() usage in SWT Snippets/Test
2 participants