• 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
..
pngsuite Loading commit data...
benchGray.png Loading commit data...
benchNRGBA-gradient.png Loading commit data...
benchNRGBA-opaque.png Loading commit data...
benchPaletted.png Loading commit data...
benchRGB-interlace.png Loading commit data...
benchRGB.png Loading commit data...
gray-gradient.interlaced.png Loading commit data...
gray-gradient.png Loading commit data...
invalid-crc32.png Loading commit data...
invalid-noend.png Loading commit data...
invalid-trunc.png Loading commit data...
invalid-zlib.png Loading commit data...