1
0
mirror of https://github.com/golang/go synced 2024-11-24 22:00:09 -07:00

exp/nacl/av: update color to max out at 1<<16-1 instead of 1<<32-1.

Fix missing return in Set(x, y, color).

R=r
CC=golang-dev
https://golang.org/cl/2256042
This commit is contained in:
Nigel Tao 2010-09-21 16:13:19 +10:00
parent c20e024df3
commit bd77a889e6

View File

@ -36,6 +36,7 @@ func (m *Image) At(x, y int) image.Color { return m.Pixel[y][x] }
func (m *Image) Set(x, y int, color image.Color) {
if c, ok := color.(Color); ok {
m.Pixel[y][x] = c
return
}
m.Pixel[y][x] = makeColor(color.RGBA())
}
@ -69,7 +70,7 @@ func (p Color) RGBA() (r, g, b, a uint32) {
}
func makeColor(r, g, b, a uint32) Color {
return Color(a>>24<<24 | r>>24<<16 | g>>24<<8 | b>>24)
return Color(a>>8<<24 | r>>8<<16 | g>>8<<8 | b>>8)
}
func toColor(color image.Color) image.Color {