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
|
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;
|
const char *basename = last_filename;
|
||||||
if( pngname && *pngname )
|
if( pngname && *pngname )
|
||||||
basename = pngname;
|
basename = pngname;
|
||||||
@@ -4140,7 +4151,7 @@ bool user_io_screenshot(const char *pngname, int rescale)
|
|||||||
/* do we want to save a rescaled image? */
|
/* do we want to save a rescaled image? */
|
||||||
if (rescale)
|
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_free_image_and_decache();
|
||||||
imlib_context_set_image(im_scaled);
|
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);
|
video_calculate_cvt_int(h_pixels, v_lines, refresh_rate, 1, vmode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int video_get_rotated()
|
||||||
|
{
|
||||||
|
return current_video_info.rotated;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
video.h
2
video.h
@@ -47,6 +47,8 @@ char* video_get_shadow_mask(int only_name = 1);
|
|||||||
void video_set_shadow_mask(const char *name);
|
void video_set_shadow_mask(const char *name);
|
||||||
void video_loadPreset(char *name, bool save);
|
void video_loadPreset(char *name, bool save);
|
||||||
|
|
||||||
|
int video_get_rotated();
|
||||||
|
|
||||||
void video_cfg_reset();
|
void video_cfg_reset();
|
||||||
|
|
||||||
void video_mode_adjust();
|
void video_mode_adjust();
|
||||||
|
|||||||
Reference in New Issue
Block a user