Merge pull request #228 from Rio6/fix-fill-with-same-aspect

fix --max and --fill not scaling image when the image has the same aspect ratio as the screen
This commit is contained in:
Raymond Li 2021-06-18 00:09:18 -04:00 committed by GitHub
commit 3de6adbd38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1132,7 +1132,7 @@ void draw_image(uint32_t* root_resolution, cairo_surface_t *img, cairo_t* xcb_ct
} else if (bg_type == MAX || bg_type == FILL) {
double aspect_diff = (double) xr_resolutions[i].height / xr_resolutions[i].width - image_height / image_width;
if((bg_type == MAX && aspect_diff > 0) || (bg_type == FILL && aspect_diff < 0)) {
if((bg_type == MAX && aspect_diff >= 0) || (bg_type == FILL && aspect_diff <= 0)) {
scale_x = scale_y = xr_resolutions[i].width / image_width;
} else if ((bg_type == MAX && aspect_diff < 0) || (bg_type == FILL && aspect_diff > 0)) {
scale_x = scale_y = xr_resolutions[i].height / image_height;