st-theme-node-drawing: Fix implementation of cover and contain
The math was incorrect for non-square containers https://bugzilla.gnome.org/show_bug.cgi?id=672321
This commit is contained in:
parent
1983097d3a
commit
3dbf06420d
@ -409,16 +409,12 @@ get_background_scale (StThemeNode *node,
|
|||||||
*scale_w = 1.0;
|
*scale_w = 1.0;
|
||||||
break;
|
break;
|
||||||
case ST_BACKGROUND_SIZE_CONTAIN:
|
case ST_BACKGROUND_SIZE_CONTAIN:
|
||||||
if (background_image_width > background_image_height)
|
*scale_w = MIN (painting_area_width / background_image_width,
|
||||||
*scale_w = painting_area_width / background_image_width;
|
painting_area_height / background_image_height);
|
||||||
else
|
|
||||||
*scale_w = painting_area_height / background_image_height;
|
|
||||||
break;
|
break;
|
||||||
case ST_BACKGROUND_SIZE_COVER:
|
case ST_BACKGROUND_SIZE_COVER:
|
||||||
if (background_image_width < background_image_height)
|
*scale_w = MAX (painting_area_width / background_image_width,
|
||||||
*scale_w = painting_area_width / background_image_width;
|
painting_area_height / background_image_height);
|
||||||
else
|
|
||||||
*scale_w = painting_area_height / background_image_height;
|
|
||||||
break;
|
break;
|
||||||
case ST_BACKGROUND_SIZE_FIXED:
|
case ST_BACKGROUND_SIZE_FIXED:
|
||||||
if (node->background_size_w > -1)
|
if (node->background_size_w > -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user