From ee19c6b361a41e76750d3a91b1c2e33aa654dbdd Mon Sep 17 00:00:00 2001 From: faiface Date: Wed, 5 Apr 2017 23:20:55 +0200 Subject: [PATCH] fix GLFrame.SetBounds to not reallocate when not necessary --- pixelgl/glframe.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pixelgl/glframe.go b/pixelgl/glframe.go index 09c4b16..7eac7a1 100644 --- a/pixelgl/glframe.go +++ b/pixelgl/glframe.go @@ -24,6 +24,10 @@ func NewGLFrame(bounds pixel.Rect) *GLFrame { // SetBounds resizes the GLFrame to the new bounds. func (gf *GLFrame) SetBounds(bounds pixel.Rect) { + if bounds == gf.Bounds() { + return + } + mainthread.Call(func() { oldF := gf.frame