[gnome-music] albumartcache: Also consider height when scaling covers
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] albumartcache: Also consider height when scaling covers
- Date: Tue, 4 Oct 2016 13:10:45 +0000 (UTC)
commit 873266ff5f05f03c105fa30e7da28cee9d4d2707
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Oct 4 09:50:14 2016 -0300
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
gnomemusic/albumartcache.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/albumartcache.py b/gnomemusic/albumartcache.py
index 13cd14f..286f16c 100644
--- a/gnomemusic/albumartcache.py
+++ b/gnomemusic/albumartcache.py
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]