Commit bd77a889 authored by Nigel Tao's avatar Nigel Tao

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