[gnome-games] game-thumbnail: Clamp border-radius
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] game-thumbnail: Clamp border-radius
- Date: Fri, 16 Aug 2019 17:47:30 +0000 (UTC)
commit 2b98290d5895f660f4b309df2ead478e1417fdbd
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Fri Aug 16 22:46:46 2019 +0500
game-thumbnail: Clamp border-radius
Drawing breaks when it's larger than max(width/2, height/2), so ensure
it never exceeds that.
src/ui/game-thumbnail.vala | 2 ++
1 file changed, 2 insertions(+)
---
diff --git a/src/ui/game-thumbnail.vala b/src/ui/game-thumbnail.vala
index 9d0faf5b..72501be3 100644
--- a/src/ui/game-thumbnail.vala
+++ b/src/ui/game-thumbnail.vala
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]