From 60eb3a14d7d1bc27adfd1e5586fefa540016edab Mon Sep 17 00:00:00 2001 From: Jeffery Myers Date: Thu, 10 Apr 2025 13:59:09 -0700 Subject: [PATCH] Only scale the screenshot by the DPI scale if we are doing automatic High DPI scaling, otherwise the native resolution is correct. --- src/rcore.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rcore.c b/src/rcore.c index 65c37a23c..ea971b52f 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1879,7 +1879,10 @@ void TakeScreenshot(const char *fileName) // Security check to (partially) avoid malicious code if (strchr(fileName, '\'') != NULL) { TRACELOG(LOG_WARNING, "SYSTEM: Provided fileName could be potentially malicious, avoid [\'] character"); return; } - Vector2 scale = GetWindowScaleDPI(); + // apply a scale if we are doing HIGHDPI auto-scaling + Vector2 scale = { 1,1 }; + if (IsWindowState(FLAG_WINDOW_HIGHDPI)) scale = GetWindowScaleDPI(); + unsigned char *imgData = rlReadScreenPixels((int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y)); Image image = { imgData, (int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y), 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };