Merge branch 'backport' into work
[dana/openbox.git] / obrender / image.c
index 671b7ae..f86a3ee 100644 (file)
@@ -532,7 +532,9 @@ void RrImageDrawImage(RrPixel32 *target, RrTextureImage *img,
 
             /* our size difference metric.. */
             wdiff = self->original[i]->width - area->width;
+            if (wdiff < 0) wdiff *= 2; /* prefer scaling down than up */
             hdiff = self->original[i]->height - area->height;
+            if (hdiff < 0) hdiff *= 2; /* prefer scaling down than up */
             diff = (wdiff * wdiff) + (hdiff * hdiff);
 
             /* find the smallest difference */