Skip to content
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

DolphinQt: cache icons instead of single pixmaps #11785

Merged
merged 1 commit into from Apr 29, 2023

Conversation

shuffle2
Copy link
Contributor

@shuffle2 shuffle2 commented Apr 23, 2023

Fixes dynamically changing dpi scaling.
Load resources from svg if possible.
Currently svg support is not in Qt build in Externals, and image files need to be added later.

you can find a build with my current accumulated qt changes and built against qt6.5 (with svg support) here: https://drive.google.com/file/d/1fMCdqPTmhYYc0yAvKY6kyBodMQ6J5VCv
this build also uses the default Qt6 dpi scale rounding mode of passthrough.
note: you should pass -style fusion to this build if you want it to look pretty :')

here are some svg resources i've collected: Resources.zip
these are mainly to see how the scaling looks. I don't care which actual images wind up being used.

@MayImilae
Copy link
Contributor

I take it from the code is still switching between 1x, 2x, and 4x as appropriate, but what does it do in between them, say, 1.5x? Is that 1x scaled up to 1.5x, or 2x scaled down to 1.5x? Do you know when Qt switches source images?

@shuffle2
Copy link
Contributor Author

shuffle2 commented Apr 23, 2023

Right, the point at which qt decides to switch source images hasn’t changed- the pr basically just ensures qt always has the full set of source images to choose from. Previously, if you opened the app on a screen with 100% scaling, only the 1x images would ever be loaded. This becomes problematic if you move to different screen or if you change dpi scaling while dolphin is open.

If you opened with scaling set to 150%, only 1x and 2x would be loaded, then if you opened at a high scaling factor ( I forget exactly when it switched over) , only 1x and 4x would be loaded. The logic about when to switch hasn’t changed as we let qt handle it ( and I don’t think there’s an easy way to change it anyway). It’s just that we now make sure there’s either an svg or all the sizes of the png which exist on the file system available for qt to pick from.

Note this pr does not yet enable pass through rounding mode for dpi scaling in qt. I figured it can be done in a separate pr. So if you want to test that you need to use above linked binary, change it yourself, or use env variable QT_SCALE_FACTOR (set to e.g. 1.5 for 150%) to override the app. This is now in master, and this PR is rebased on it.

The behavior of this pr is also affected by #11774 (dpiAware setting), which is why the build above includes it. This is also in master now.

@shuffle2
Copy link
Contributor Author

Note the previous code to manually additionally load 4x resources was bugged in multiple ways - that code was basically a noop

Fixes dynamically changing dpi scaling.
Load resources from svg if possible.
Currently svg support is not in Qt build in Externals,
and image files need to be added later.
@shuffle2
Copy link
Contributor Author

this pr is ready for review/merge btw (maybe the first comment was confusing since it mentions stuff like svg resources - but actually adding those is for another pr)

@AdmiralCurtiss
Copy link
Contributor

Seems to work fine (well, can't test the svg part).

@AdmiralCurtiss AdmiralCurtiss merged commit 6e6865a into dolphin-emu:master Apr 29, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants