Skip to content

Commit

Permalink
Merge pull request #5274 from maron2000/fix_screenreport
Browse files Browse the repository at this point in the history
Suppress redundant screen reports in log
  • Loading branch information
joncampbell123 authored Nov 10, 2024
2 parents c8069ef + 6cec5a0 commit 4466428
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/gui/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ std::string RENDER_GetScaler(void) {
return prop->GetSection()->Get_string("type");
}

static int aspect_x=0, aspect_y=0;

void RENDER_Reset( void ) {
Bitu width=render.src.width;
Bitu height=render.src.height;
Expand Down Expand Up @@ -750,7 +752,11 @@ void RENDER_Reset( void ) {
sdl.srcAspect.y = aspect_ratio_y>0?aspect_ratio_y:(int)floor((render.src.height * (render.src.dblh ? 2 : 1) * render.src.ratio) + 0.5);
sdl.srcAspect.xToY = (double)sdl.srcAspect.x / sdl.srcAspect.y;
sdl.srcAspect.yToX = (double)sdl.srcAspect.y / sdl.srcAspect.x;
LOG_MSG("Aspect ratio: %u x %u xToY=%.3f yToX=%.3f",sdl.srcAspect.x,sdl.srcAspect.y,sdl.srcAspect.xToY,sdl.srcAspect.yToX);
if(aspect_x != sdl.srcAspect.x || aspect_y != sdl.srcAspect.y) {
LOG_MSG("Aspect ratio: %u x %u xToY=%.3f yToX=%.3f", sdl.srcAspect.x, sdl.srcAspect.y, sdl.srcAspect.xToY, sdl.srcAspect.yToX);
aspect_x = sdl.srcAspect.x;
aspect_y = sdl.srcAspect.y;
}
/* Setup the scaler variables */
#if C_OPENGL
GFX_SetShader(render.shader_src);
Expand Down
13 changes: 11 additions & 2 deletions src/gui/sdlmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,8 @@ void UpdateWindowDimensions(Bitu width, Bitu height)
currentWindowHeight = height;
}

static Bitu dim_width=0, dim_height=0, dpi_width=0, dpi_height=0;

void PrintScreenSizeInfo(void) {
#if 1
const char *method = "?";
Expand All @@ -708,10 +710,12 @@ void PrintScreenSizeInfo(void) {
case METHOD_XRANDR: method = "XRandR"; break;
case METHOD_WIN98BASE: method = "Win98base"; break;
case METHOD_COREGRAPHICS:method = "CoreGraphics";break;
default: break;
default: break;
}

LOG_MSG("Screen report: Method '%s' (%.3f x %.3f pixels) at (%.3f x %.3f) (%.3f x %.3f mm) (%.3f x %.3f in) (%.3f x %.3f DPI)",
if(dim_width != screen_size_info.screen_dimensions_pixels.width || dim_height != screen_size_info.screen_dimensions_pixels.height
|| dpi_width != screen_size_info.screen_dpi.width || dpi_height != screen_size_info.screen_dpi.height) {
LOG_MSG("Screen report: Method '%s' (%.3f x %.3f pixels) at (%.3f x %.3f) (%.3f x %.3f mm) (%.3f x %.3f in) (%.3f x %.3f DPI)",
method,

screen_size_info.screen_dimensions_pixels.width,
Expand All @@ -728,6 +732,11 @@ void PrintScreenSizeInfo(void) {

screen_size_info.screen_dpi.width,
screen_size_info.screen_dpi.height);
dim_width = screen_size_info.screen_dimensions_pixels.width;
dim_height = screen_size_info.screen_dimensions_pixels.height;
dpi_width = screen_size_info.screen_dpi.width;
dpi_height = screen_size_info.screen_dpi.height;
}
#endif
}

Expand Down

0 comments on commit 4466428

Please sign in to comment.