Skip to content

Commit bdb1e6b

Browse files
committed
FIX: Crash when screenshotting in-game window with non-0 position
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11717 8aca7d54-2c30-db11-9de9-000461428c89
1 parent b87aea5 commit bdb1e6b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

simutrans/history.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
CHG: Pause tool unpauses server waiting for clients
77
FIX: new city buildings were built when exceeded 2x1 size (only renovated)
88
FIX: Missing collision check for water factories
9+
FIX: Crash when screenshotting in-game window with non-0 position
10+
911

10-
1112
Release of 124.3.1 (r11671 on 5-Apr-2025):
1213
CHG: option for pakset dump versus all other debug by appending 'p' to the debug level, e.g. "-debug 0p" to show only pak details to declutter server logs
1314
CHG: tram system type way can be laid over other tracks as well (like pak192 narrowgauge over normal rails)

src/simutrans/display/simgraph16.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ struct imd {
374374

375375
#define TRANSPARENT_RUN (0x8000u)
376376

377-
static scr_coord_val disp_width = 640;
378-
static scr_coord_val disp_actual_width = 640;
379-
static scr_coord_val disp_height = 480;
377+
static scr_coord_val disp_width = 640; // pitch (in pixels) of the render target texture
378+
static scr_coord_val disp_actual_width = 640; // window width
379+
static scr_coord_val disp_height = 480; // window height
380380

381381

382382
/*
@@ -4666,11 +4666,11 @@ bool display_snapshot( const scr_rect &area )
46664666

46674667
raw_image_t img(clipped_area.w, clipped_area.h, raw_image_t::FMT_RGB888);
46684668

4669-
for (scr_coord_val y = clipped_area.y; y < clipped_area.y + clipped_area.h; ++y) {
4669+
for (scr_coord_val y = 0; y < clipped_area.h; ++y) {
46704670
uint8 *dst = img.access_pixel(0, y);
4671-
const PIXVAL *row = textur + clipped_area.x + y*disp_width;
4671+
const PIXVAL *row = textur + (clipped_area.x + 0) + (clipped_area.y + y) * disp_width;
46724672

4673-
for (scr_coord_val x = clipped_area.x; x < clipped_area.x + clipped_area.w; ++x) {
4673+
for (scr_coord_val x = 0; x < clipped_area.w; ++x) {
46744674
const rgb888_t pixel = pixval_to_rgb888(*row++);
46754675
*dst++ = pixel.r;
46764676
*dst++ = pixel.g;

0 commit comments

Comments
 (0)