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

Nearest Neighbour Scaling not working with Windows 10 Scaling #191

Open
gameshistory opened this issue Sep 3, 2019 · 4 comments
Open

Nearest Neighbour Scaling not working with Windows 10 Scaling #191

gameshistory opened this issue Sep 3, 2019 · 4 comments

Comments

@gameshistory
Copy link

gameshistory commented Sep 3, 2019

If I set my Windows 10 Display Scaling to 100%, the nearest neighbour scaling works perfectly.
But if I set it to any other value (I normally use 150%), the image starts to blur.

Here is a comparison: https://i.imgur.com/F3diLIj.png

On the left is SDLPoP with 100% scaling. On the right is SDLPoP with 125% scaling.

If you zoom in, you can see that the left is crisp, while the right is blurry.

@NagyD
Copy link
Owner

NagyD commented Sep 7, 2019

Here's a workaround:
Right-click on prince.exe, click Properties, go to the Compatibility tab, click the High DPI settings button, enable override, and select "Application".
This should disable the bitmap-stretching that Windows does after SDLPoP has already scaled the image.

Notes:

  • This issue is similar to integer scaling on a Mac Retina screen #173, in that the application can't use the full pixel density of the screen without specifically asking for it.
  • This behavior could be made default by including an appropriate manifest in the EXE.
    @Falcury, do you think it's a good idea? (By the way, DOSBox does the same, although without a manifest.)

@Falcury
Copy link
Contributor

Falcury commented Sep 14, 2019

I'll try to look into this. Maybe SDL_GetRendererOutputSize() will be of help in some way (see for example here).

@Falcury
Copy link
Contributor

Falcury commented Sep 14, 2019

Maybe SDL_GetRendererOutputSize() will be of help

Ah, no, I was wrong, it does not look like something that an SDL call can fix.
However, instead of using a manifest you can apparently also call a Windows API to get the same effect:
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setprocessdpiaware?redirectedfrom=MSDN

Calling one of the APIs directly (e.g. SetProcessDPIAware) seems to be the easier method.
Although Microsoft for some reason recommends the manifest approach (I have no clue why).

I made a pull request for the API in #192

@NagyD
Copy link
Owner

NagyD commented Sep 22, 2019

I've merged the pull request.

@i-hate-drm2, can you compile the source for yourself to try it?

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

No branches or pull requests

3 participants