Commit 873266ff authored by Georges Basile Stavracas Neto's avatar Georges Basile Stavracas Neto Committed by Marinus Schraal

albumartcache: Also consider height when scaling covers

When scaling down the cover artwork, the current code only understands
the case where the width of the cover is the big axis. The problem with
that is that it ends up overgrowing covers which the height is the big
axis, and breaking the layout of the Albums view.

Fix that by checking which is the biggest axis and always scaling down
the cover to fit it.

https://bugzilla.gnome.org/show_bug.cgi?id=772403
parent 8f4954be
......@@ -53,8 +53,14 @@ def _make_icon_frame(pixbuf, art_size=None, scale=1):
radius = 3 * scale
ratio = pixbuf.get_height() / pixbuf.get_width()
w = art_size.width * scale
h = int(art_size.height * ratio * scale)
# Scale down the image according to the biggest axis
if ratio > 1:
w = int(art_size.width / ratio * scale)
h = art_size.height * scale
else:
w = art_size.width * scale
h = int(art_size.height * ratio * scale)
new_pixbuf = pixbuf.scale_simple(w - border * 2,
h - border * 2,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment