mirror of
https://github.com/MiSTer-devel/Main_MiSTer.git
synced 2026-04-12 03:04:02 +00:00
Screenshot: don't squish video when it is rotated (#929)
This commit is contained in:
13
user_io.cpp
13
user_io.cpp
@@ -4124,6 +4124,17 @@ bool user_io_screenshot(const char *pngname, int rescale)
|
||||
}
|
||||
else
|
||||
{
|
||||
int scwidth = ms->output_width;
|
||||
int scheight = ms->output_height;
|
||||
|
||||
if (video_get_rotated())
|
||||
{
|
||||
|
||||
//If the video is rotated, the scaled output resolution results in a squished image.
|
||||
//Calculate the scaled output res using the original AR
|
||||
scwidth = scheight * ((float)ms->width/ms->height);
|
||||
}
|
||||
|
||||
const char *basename = last_filename;
|
||||
if( pngname && *pngname )
|
||||
basename = pngname;
|
||||
@@ -4140,7 +4151,7 @@ bool user_io_screenshot(const char *pngname, int rescale)
|
||||
/* do we want to save a rescaled image? */
|
||||
if (rescale)
|
||||
{
|
||||
Imlib_Image im_scaled=imlib_create_cropped_scaled_image(0,0,ms->width,ms->height,ms->output_width,ms->output_height);
|
||||
Imlib_Image im_scaled=imlib_create_cropped_scaled_image(0,0,ms->width,ms->height,scwidth,scheight);
|
||||
imlib_free_image_and_decache();
|
||||
imlib_context_set_image(im_scaled);
|
||||
}
|
||||
|
||||
@@ -3904,3 +3904,12 @@ static void video_calculate_cvt(int h_pixels, int v_lines, float refresh_rate, i
|
||||
video_calculate_cvt_int(h_pixels, v_lines, refresh_rate, 1, vmode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int video_get_rotated()
|
||||
{
|
||||
return current_video_info.rotated;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user