How do I bugfix surface size in Windows high DPI?

I don’t mean using GPU/library primitives to draw content. I mean that every single pixel rendered is a result of an integer assignment operator in my own render code. For instance in Source for scratch emulator test (coosucks.repl.co) I wrote my own primitives to build a software renderer, including text rendering, and I’m currently working on introducing scalability to the infrastructure. Using GPU text rendering or whatever is going to lead to suboptimal results due to me not having control over how it is rendered. The reason 2D games use GPU is to optimize the gaming experience, and the reason retro emulators use GPU is to emulate other graphical hardware. I mainly make productivity software in which render quality is essential, and the only way I can ensure the necessary render quality for the use case is with my own renderer.

In my own experience, I can achieve whatever quality I want (pixel-perfect if it needs to be) using SDL2’s GPU-accelerated renderer. Have you actually tried it?

Quality of what UI element? There are various elements that could be rendered, ranging from solid colors (which are widely available) to fully scalable pixel-perfect text (which is currently impossible cross platform as it is only in Microsoft’s GDI TrueType renderer, since no other TrueType renderer even comes close to such render quality or performance, let alone both).

If someone as particular about pixel perfection as @rtrussell is (no offense intended) is happy with the quality he gets from SDL_Renderer then everyone should be.

Anyway, this is a dumb thread. SDL has a bug, discovered by someone who doesn’t like using the GPU because reasons. I even told you how you could get around this bug using SDL_Renderer but still be doing the drawing yourself by doing your own pixel plotting to a buffer and then uploading that as a texture and then having SDL_Renderer put your texture on the screen, but :man_shrugging:

No offence taken! I agree. :wink:

You are the one who brought up GPU rendering. And your sarcastic remarks about pixel perfect rendering aren’t doing any favors.

SDL_UpdateWindowSurface doesn’t but SDL_UpdateWindowSurfaceRects does.

If this is indeed an SDL glitching, it should be referred to as Surface glitching.

The bugfix for Surface glitching has been committed to the SDL library source. SDL: Handle DPI scaling in SDL_GetWindowSurface - SDL Commits - Simple Directmedia Layer (libsdl.org)

In SDL 2.28.0, Surface glitching has been finally bugfixed.

SDL 2.27.1:
96dpi:
image
108dpi:
image
120dpi:
image
144dpi:
image
168dpi:
image
192dpi:


216dpi:

240dpi:

288dpi:

336dpi:

SDL 2.28.0:
96dpi:
image
108dpi:
image
120dpi:
image
144dpi:
image
168dpi:
image
192dpi:


216dpi:

240dpi:

288dpi:

336dpi:

2 Likes