]> Cypherpunks repositories - gostls13.git/commit
image/gif: don't assume Encode src's origin is (0, 0)
authorNigel Tao <nigeltao@golang.org>
Thu, 21 Mar 2019 04:08:41 +0000 (15:08 +1100)
committerNigel Tao <nigeltao@golang.org>
Thu, 21 Mar 2019 22:35:59 +0000 (22:35 +0000)
commit4dad64f5f1530a02404d562c7e6992d285bd9087
tree57bdbb6322b14e6be26b6080bf46bf6f33af58f4
parentf23c601bf9f66ef4a0d9d2dcd003b95e78fb28f8
image/gif: don't assume Encode src's origin is (0, 0)

When gif.Encode is given an "m image.Image" argument that isn't an
*image.Paletted, it creates a temporary *image.Paletted (called pm) that
is intended to be a copy of this image, only with fewer colors.

That creation process, and specifically the opts.Drawer.Draw call that
does the copy, incorrectly assumed that m.Bounds().Min is the zero point
(0, 0). This commit fixes that.

Fixes #30887

Change-Id: Ie03bddec359e2dcc52f18451049452105514e179
Reviewed-on: https://go-review.googlesource.com/c/go/+/168418
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
src/image/gif/writer.go
src/image/gif/writer_test.go