From 07ecae706da8296a6edb22d1375082f289b886ac Mon Sep 17 00:00:00 2001 From: faiface <faiface@ksp.sk> Date: Tue, 14 Mar 2017 19:27:28 +0100 Subject: [PATCH] fix consistency in Canvas.SetBounds --- pixelgl/canvas.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pixelgl/canvas.go b/pixelgl/canvas.go index debfc2b..f721855 100644 --- a/pixelgl/canvas.go +++ b/pixelgl/canvas.go @@ -159,14 +159,12 @@ func (c *Canvas) SetColorMask(col color.Color) { // SetBounds resizes the Canvas to the new bounds. Old content will be preserved. // -// If the new Bounds fit into the Original capacity bounds, no new Canvas will be allocated. +// If the new Bounds fit into the Original borders, no new Canvas will be allocated. func (c *Canvas) SetBounds(bounds pixel.Rect) { c.bounds = bounds // if this bounds fit into the original bounds, no need to reallocate - 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 { + if c.orig.borders.Contains(bounds.Min) && c.orig.borders.Contains(bounds.Max) { return } -- GitLab