From f71f789b6044b4250d22a246e0f5076bc42cc45c Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 1 Feb 2023 01:52:50 -0500 Subject: [PATCH] BasicCanvas.Reallocate refuses to work on cut canvases --- canvas.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/canvas.go b/canvas.go index c1153d0..608d388 100644 --- a/canvas.go +++ b/canvas.go @@ -64,6 +64,8 @@ func (canvas BasicCanvas) Buffer () (data []color.RGBA, stride int) { // Reallocate efficiently reallocates the canvas. The data within will be // garbage. This method will do nothing if this is a cut image. func (canvas *BasicCanvas) Reallocate (width, height int) { + if canvas.rect.Min != (image.Point { }) { return } + previousLen := len(canvas.pix) newLen := width * height bigger := newLen > previousLen