diff --git a/data/app.gresource.xml b/data/app.gresource.xml index e6a3989..5803443 100644 --- a/data/app.gresource.xml +++ b/data/app.gresource.xml @@ -5,6 +5,8 @@ style.css style-dark.css + + assets/cover.png icons/hicolor/symbolic/actions/show-lyrics-symbolic.svg diff --git a/data/assets/cover.png b/data/assets/cover.png new file mode 100644 index 0000000..99bda7c Binary files /dev/null and b/data/assets/cover.png differ diff --git a/src/window.vala b/src/window.vala index 071693d..9c7bbd4 100644 --- a/src/window.vala +++ b/src/window.vala @@ -384,7 +384,16 @@ namespace Victrola { buffer?.unmap ((!) info); } } catch (Error e) { - // w/e lol lmao even + var pixbuf = new Gdk.Pixbuf.from_resource ("/com/fyralabs/Victrola/cover.png"); + var width = pixbuf.width; var height = pixbuf.height; + if (size > 0 && width > size && height > size) { + var scale = width > height ? (size / (double) height) : (size / (double) width); + var dx = (int) (width * scale + 0.5); var dy = (int) (height * scale + 0.5); + var newbuf = pixbuf.scale_simple (dx, dy, Gdk.InterpType.TILES); + if (newbuf != null) + return ((!) newbuf); + buffer?.unmap ((!) info); + } } } return null; @@ -401,7 +410,15 @@ namespace Victrola { return ((!) newbuf); } } catch (Error e) { - // w/e lol lmao even + var pixbuf = new Gdk.Pixbuf.from_resource ("/com/fyralabs/Victrola/cover.png"); + var width = pixbuf.width; var height = pixbuf.height; + if (size > 0 && width > size && height > size) { + var scale = width > height ? (size / (double) height) : (size / (double) width); + var dx = (int) (width * scale + 0.5); var dy = (int) (height * scale + 0.5); + var newbuf = pixbuf.scale_simple (dx, dy, Gdk.InterpType.TILES); + if (newbuf != null) + return ((!) newbuf); + } } return null; }