1
0
mirror of https://github.com/golang/go synced 2024-11-20 01:14:40 -07:00
go/src
Jed Denlea 31cd20a70e image/gif: try harder to use global color table
The GIF format allows for an image to contain a global color table which
might be used for some or every frame in an animated GIF.  This palette
contains 24-bit opaque RGB values.  An individual frame may use the
global palette and enable transparency by picking one number to be
transparent, instead of the color value in the palette.

image/gif decodes a GIF, which contains an []*image.Paletted that holds
each frame.  When decoded, if a frame has a transparent color and uses
the global palette, a copy of the global []color.Color is made, and the
transparency color index is replaced with color.RGBA{}.

When encoding a GIF, each frame's palette is encoded to the form it
might exist in a GIF, up to 768 bytes "RGBRGBRGBRGB...". If a frame's
encoded palette is equal to the encoded global color table, the frame
will be encoded with the flag set to use the global color table,
otherwise the frame's palette will be included.

So, if the color in the global color table that matches the transparent
index of one frame wasn't black (and it frequently is not), reencoding a
GIF will likely result in a larger file because each frame's palette
will have to be encoded inline.

This commit takes a frame's transparent color index into account when
comparing an individual image.Paletted's encoded color table to the
global color table.

Fixes #22137

Change-Id: I5460021da6e4d7ce19198d5f94a8ce714815bc08
Reviewed-on: https://go-review.googlesource.com/68313
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2017-10-13 04:28:53 +00:00
..
archive archive/tar: ignore ChangeTime and AccessTime unless Format is specified 2017-10-10 20:13:27 +00:00
bufio Revert "bufio: make Reader.Peek invalidate Unreads" 2017-07-06 03:06:44 +00:00
builtin
bytes bytes: panic in ReadFrom with more information with negative Read counts 2017-10-06 06:49:40 +00:00
cmd cmd/compile: attempt to deflake debug_test.go 2017-10-13 03:25:23 +00:00
compress
container
context
crypto crypto/x509: reject intermediates with unknown critical extensions. 2017-10-10 15:49:01 +00:00
database/sql
debug debug/elf: add relocation constants 2017-10-11 16:40:10 +00:00
encoding encoding/json: use Deprecated markers 2017-10-11 22:09:22 +00:00
errors
expvar
flag
fmt fmt: Implement pp.WriteString method 2017-09-20 06:48:34 +00:00
go io: simplify pipe implementation 2017-10-11 20:00:54 +00:00
hash
html all: revert "all: prefer strings.IndexByte over strings.Index" 2017-10-05 23:19:10 +00:00
image image/gif: try harder to use global color table 2017-10-13 04:28:53 +00:00
index/suffixarray
internal internal/poll: only call SetFileCompletionNotificationModes for sockets 2017-10-12 07:13:23 +00:00
io io: simplify pipe implementation 2017-10-11 20:00:54 +00:00
log log: fix data race on log.Output 2017-09-19 20:35:24 +00:00
math math/big: provide support for conversion bases up to 62 2017-10-06 17:46:15 +00:00
mime all: revert "all: prefer strings.IndexByte over strings.Index" 2017-10-05 23:19:10 +00:00
net net: implement deadline functionality on Pipe 2017-10-11 20:00:52 +00:00
os all: revert "all: prefer strings.LastIndexByte over strings.LastIndex" 2017-10-05 23:19:42 +00:00
path all: revert "all: prefer strings.LastIndexByte over strings.LastIndex" 2017-10-05 23:19:42 +00:00
plugin
reflect reflect: allow Copy to a byte array or byte slice from a string 2017-10-13 02:35:56 +00:00
regexp all: revert "all: prefer strings.IndexByte over strings.Index" 2017-10-05 23:19:10 +00:00
runtime runtime: factor amd64 specifics from vdso_linux.go 2017-10-13 02:04:20 +00:00
sort
strconv
strings
sync
syscall
testing testing: add PAUSE, CONT output lines to explain Parallel execution 2017-10-10 17:44:22 +00:00
text
time all: revert "all: prefer strings.LastIndexByte over strings.LastIndex" 2017-10-05 23:19:42 +00:00
unicode all: revert "all: prefer strings.IndexByte over strings.Index" 2017-10-05 23:19:10 +00:00
unsafe all: remove some double spaces from comments 2017-08-26 15:09:09 +00:00
vendor/golang_org/x
all.bash
all.bat all.bat,make.bat,run.bat: make these work even when directory has space in it 2013-03-25 12:13:34 +11:00
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash build: clean current tree in clean.bash 2015-08-05 19:36:15 +00:00
clean.bat build: fix clean scripts 2015-06-18 16:13:13 +00:00
clean.rc
cmp.bash
iostest.bash
make.bash build: add go env GOROOT as default GOROOT_BOOTSTRAP value 2017-08-25 05:36:27 +00:00
make.bat
Make.dist
make.rc
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc