• Nigel Tao's avatar
    image/png: don't read filter bytes for empty interlace passes. · ca6ba492
    Nigel Tao authored
    Fixes #11604
    
    The gray-gradient.png image was created by a Go program:
    
    ----
    package main
    
    import (
    	"image"
    	"image/color"
    	"image/png"
    	"log"
    	"os"
    )
    
    func main() {
    	f, err := os.Create("a.png")
    	if err != nil {
    		log.Fatal(err)
    	}
    	defer f.Close()
    	m := image.NewGray(image.Rect(0, 0, 1, 16))
    	for i := 0; i < 16; i++ {
    		m.SetGray(0, i, color.Gray{uint8(i * 0x11)})
    	}
    	err = png.Encode(f, m)
    	if err != nil {
    		log.Fatal(err)
    	}
    }
    ----
    
    The equivalent gray-gradient.interlaced.png image was created via ImageMagick:
    $ convert -interlace PNG gray-gradient.png gray-gradient.interlaced.png
    
    As a sanity check:
    $ file gray-gradient.*
    gray-gradient.interlaced.png: PNG image data, 1 x 16, 4-bit grayscale, interlaced
    gray-gradient.png:            PNG image data, 1 x 16, 8-bit grayscale, non-interlaced
    
    Change-Id: I7700284f74d1ea30073aede3bce4d7651787bdbc
    Reviewed-on: https://go-review.googlesource.com/12064Reviewed-by: 's avatarRob Pike <r@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    ca6ba492
Name
Last commit
Last update
..
color Loading commit data...
draw Loading commit data...
gif Loading commit data...
internal/imageutil Loading commit data...
jpeg Loading commit data...
png Loading commit data...
testdata Loading commit data...
decode_example_test.go Loading commit data...
decode_test.go Loading commit data...
format.go Loading commit data...
geom.go Loading commit data...
geom_test.go Loading commit data...
image.go Loading commit data...
image_test.go Loading commit data...
names.go Loading commit data...
ycbcr.go Loading commit data...
ycbcr_test.go Loading commit data...