Commit ab5e5635 authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko

game-thumbnail: Support HiDPI for icons as well

I didn't notice the default icon was also blurry.

Nintendo DS icons were too small, since cover and icon drawing code is
shared.
parent b38c611d
Pipeline #105400 passed with stages
in 15 minutes and 17 seconds
......@@ -155,7 +155,7 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
var color = context.style.get_color (context.state);
var theme = Gtk.IconTheme.get_default ();
var size = int.min (context.width, context.height) * scale;
var size = int.min (context.width, context.height) * scale * scale_factor;
try {
var icon_info = theme.lookup_icon (icon_name, (int) size, Gtk.IconLookupFlags.FORCE_SIZE);
emblem = icon_info.load_symbolic (color);
......@@ -167,11 +167,16 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
if (emblem == null)
return;
double offset_x = context.width / 2.0 - emblem.width / 2.0;
double offset_y = context.height / 2.0 - emblem.height / 2.0;
double offset_x = context.width * scale_factor / 2.0 - emblem.width / 2.0;
double offset_y = context.height * scale_factor / 2.0 - emblem.height / 2.0;
context.cr.save ();
context.cr.scale (1.0 / scale_factor, 1.0 / scale_factor);
Gdk.cairo_set_source_pixbuf (context.cr, emblem, offset_x, offset_y);
context.cr.paint ();
context.cr.restore ();
}
private Gdk.Pixbuf? get_scaled_icon (DrawingContext context, GLib.Icon? icon, double scale) {
......@@ -180,7 +185,7 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
var theme = Gtk.IconTheme.get_default ();
var lookup_flags = Gtk.IconLookupFlags.FORCE_SIZE | Gtk.IconLookupFlags.FORCE_REGULAR;
var size = int.min (context.width, context.height) * scale;
var size = int.min (context.width, context.height) * scale * scale_factor;
var icon_info = theme.lookup_by_gicon (icon, (int) size, lookup_flags);
if (icon_info == null)
......
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