Skip to content

Commit

Permalink
Merge pull request #228 from Rio6/fix-fill-with-same-aspect
Browse files Browse the repository at this point in the history
fix --max and --fill not scaling image when the image has the same aspect ratio as the screen
  • Loading branch information
Raymo111 authored Jun 18, 2021
2 parents fc59f5b + b0f64a6 commit 3de6adb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion unlock_indicator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3de6adb

Please sign in to comment.