Commit 2b98290d authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko

game-thumbnail: Clamp border-radius

Drawing breaks when it's larger than max(width/2, height/2), so ensure
it never exceeds that.
parent 24a5afbb
Pipeline #105260 passed with stages
in 15 minutes and 25 seconds
......@@ -132,6 +132,7 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
return false;
var border_radius = (int) context.style.get_property (Gtk.STYLE_PROPERTY_BORDER_RADIUS, context.state);
border_radius = border_radius.clamp (0, int.max (context.width / 2, context.height / 2));
context.cr.set_source_rgb (0, 0, 0);
rounded_rectangle (context.cr, 0.5, 0.5, context.width - 1, context.height - 1, border_radius);
......@@ -312,6 +313,7 @@ private class Games.GameThumbnail : Gtk.DrawingArea {
Cairo.ImageSurface mask = new Cairo.ImageSurface (Cairo.Format.A8, context.width, context.height);
var border_radius = (int) context.style.get_property (Gtk.STYLE_PROPERTY_BORDER_RADIUS, context.state);
border_radius = border_radius.clamp (0, int.max (context.width / 2, context.height / 2));
Cairo.Context cr = new Cairo.Context (mask);
cr.set_source_rgba (0, 0, 0, 0.9);
......
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