mirror of
https://github.com/golang/go
synced 2024-11-24 21: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:
parent
c20e024df3
commit
bd77a889e6
@ -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) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user