Skip to content

Remove DPI_AWARE flag and GetVirtualScreenSize workaround#9866

Open
EthanBlazkowicz wants to merge 2 commits into
PathOfBuildingCommunity:devfrom
EthanBlazkowicz:test
Open

Remove DPI_AWARE flag and GetVirtualScreenSize workaround#9866
EthanBlazkowicz wants to merge 2 commits into
PathOfBuildingCommunity:devfrom
EthanBlazkowicz:test

Conversation

@EthanBlazkowicz
Copy link
Copy Markdown
Contributor

Remove DPI_AWARE flag and GetVirtualScreenSize workaround

Requires PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic#100

Background

SimpleGraphic PR #100 decoupled the DPI_AWARE flag's dual responsibilities (rendering pipeline vs API contract). The flag now only controls whether the API uses physical or virtual units. PoB works exclusively in virtual units, so the flag is no longer needed.
Additionally, GetScreenSize() now natively returns virtual units regardless of the flag, making the GetVirtualScreenSize() workaround obsolete.

Changes

src/Launch.lua (line 68):

- RenderInit("DPI_AWARE")
+ RenderInit()

src/Modules/Common.lua (lines 978-986):

- function GetVirtualScreenSize()
-     local width, height = GetScreenSize()
-     local scale = GetScreenScale and GetScreenScale() or 1.0
-     if scale ~= 1.0 then
-         width = math.floor(width / scale)
-         height = math.floor(height / scale)
-     end
-     return width, height
- end
+ function GetVirtualScreenSize()
+     return GetScreenSize()
+ end

What this means

Aspect Before After
RenderInit "DPI_AWARE" passed no flags
GetScreenSize() returned physical (3840x2160) - workaround divided by scale returns virtual (1920x1080) natively
GetScreenScale() returned 2.0 (unchanged) 2.0 (unchanged)
SetDPIScaleOverridePercent() worked (flag forced scaling on) works (scaling always active regardless of flag)
Visual scaling pre-scale coords path same pre-scale coords path

No other files or callers need changes - all consumers of GetVirtualScreenSize() continue working with the same return values.

1.0 to 3.0 DPI scaling all tested.

Code and PR Co-Written by DeepSeek

ethanblazkowicz added 2 commits May 21, 2026 23:41
The DPI_AWARE flag in SimpleGraphic was decoupled from the rendering
pipeline - it now only controls the API unit contract. PoB uses virtual
units everywhere, so the flag is no longer needed.
GetScreenSize now natively returns virtual units, removing the need for
the GetVirtualScreenSize workaround that manually divided by the scale
factor.
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.

1 participant