Commit 55badd47 authored by Nigel Tao's avatar Nigel Tao

image/png: use image-specific methods for checking opacity.

R=rsc
CC=golang-dev, mpl
https://golang.org/cl/1894047
parent 6d37724c
......@@ -32,8 +32,15 @@ func writeUint32(b []uint8, u uint32) {
b[3] = uint8(u >> 0)
}
type opaquer interface {
Opaque() bool
}
// Returns whether or not the image is fully opaque.
func opaque(m image.Image) bool {
if o, ok := m.(opaquer); ok {
return o.Opaque()
}
for y := 0; y < m.Height(); y++ {
for x := 0; x < m.Width(); x++ {
_, _, _, a := m.At(x, y).RGBA()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment