From 7f38aac9019281034a993e4a66f6bb6ca008ef41 Mon Sep 17 00:00:00 2001
From: faiface <faiface@ksp.sk>
Date: Wed, 8 Mar 2017 22:51:18 +0100
Subject: [PATCH] minor stability change in Canvas.SetBounds

---
 pixelgl/canvas.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pixelgl/canvas.go b/pixelgl/canvas.go
index 34033c1..11f37f5 100644
--- a/pixelgl/canvas.go
+++ b/pixelgl/canvas.go
@@ -164,7 +164,9 @@ func (c *Canvas) SetBounds(bounds pixel.Rect) {
 	c.bounds = bounds
 
 	// if this bounds fit into the original bounds, no need to reallocate
-	if c.orig.borders.Contains(bounds.Pos) && c.orig.borders.Contains(bounds.Pos+bounds.Size) {
+	borX, borY, borW, borH := intBounds(c.orig.borders)
+	bndX, bndY, bndW, bndH := intBounds(bounds)
+	if borX <= bndX && bndX+bndW <= borX+borW && borY <= bndY && bndY+bndH <= borY+borH {
 		return
 	}
 
-- 
GitLab