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:
Jasper St. Pierre 2012-03-18 05:55:50 -04:00
parent 1983097d3a
commit 3dbf06420d

View File

@ -409,16 +409,12 @@ get_background_scale (StThemeNode *node,
*scale_w = 1.0;
break;
case ST_BACKGROUND_SIZE_CONTAIN:
if (background_image_width > background_image_height)
*scale_w = painting_area_width / background_image_width;
else
*scale_w = painting_area_height / background_image_height;
*scale_w = MIN (painting_area_width / background_image_width,
painting_area_height / background_image_height);
break;
case ST_BACKGROUND_SIZE_COVER:
if (background_image_width < background_image_height)
*scale_w = painting_area_width / background_image_width;
else
*scale_w = painting_area_height / background_image_height;
*scale_w = MAX (painting_area_width / background_image_width,
painting_area_height / background_image_height);
break;
case ST_BACKGROUND_SIZE_FIXED:
if (node->background_size_w > -1)