BasicCanvas.Reallocate refuses to work on cut canvases
This commit is contained in:
parent
8f0f2be9e9
commit
f71f789b60
@ -64,6 +64,8 @@ func (canvas BasicCanvas) Buffer () (data []color.RGBA, stride int) {
|
|||||||
// Reallocate efficiently reallocates the canvas. The data within will be
|
// Reallocate efficiently reallocates the canvas. The data within will be
|
||||||
// garbage. This method will do nothing if this is a cut image.
|
// garbage. This method will do nothing if this is a cut image.
|
||||||
func (canvas *BasicCanvas) Reallocate (width, height int) {
|
func (canvas *BasicCanvas) Reallocate (width, height int) {
|
||||||
|
if canvas.rect.Min != (image.Point { }) { return }
|
||||||
|
|
||||||
previousLen := len(canvas.pix)
|
previousLen := len(canvas.pix)
|
||||||
newLen := width * height
|
newLen := width * height
|
||||||
bigger := newLen > previousLen
|
bigger := newLen > previousLen
|
||||||
|
Reference in New Issue
Block a user