Preserve aspect ratio of album covers in grid views (close #111)
This commit is contained in:
parent
0a109bc886
commit
9b29f7b274
1 changed files with 24 additions and 19 deletions
|
|
@ -444,15 +444,9 @@ class LibraryPanel(Adw.Bin):
|
|||
self.standalone_image.set_pixel_size(min(size_width, size_height)/2)
|
||||
return
|
||||
|
||||
# Skalierungswert für Breite und Höhe ermitteln
|
||||
ratio_w = float(size_width) / float(pixbuf.get_width())
|
||||
ratio_h = float(size_height) / float(pixbuf.get_height())
|
||||
# Kleineren beider Skalierungswerte nehmen, nicht Hochskalieren
|
||||
ratio = min(ratio_w, ratio_h)
|
||||
ratio = min(ratio, 1)
|
||||
# Neue Breite und Höhe berechnen
|
||||
width = int(math.floor(pixbuf.get_width() * ratio))
|
||||
height = int(math.floor(pixbuf.get_height() * ratio))
|
||||
(width, height) = Utils.calculate_size(pixbuf.get_width(),
|
||||
pixbuf.get_height(), size_width,
|
||||
size_height)
|
||||
if width <= 0 or height <= 0:
|
||||
return
|
||||
# Pixelpuffer auf Oberfläche zeichnen
|
||||
|
|
|
|||
Loading…
Reference in a new issue