mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
shareable: Change the argument to color.RGBA at Fill
The argument will be copied explicitly.
This commit is contained in:
parent
9d867850dc
commit
0a872b342a
11
image.go
11
image.go
@ -135,15 +135,10 @@ func (i *Image) Clear() error {
|
|||||||
func (i *Image) Fill(clr color.Color) error {
|
func (i *Image) Fill(clr color.Color) error {
|
||||||
i.copyCheck()
|
i.copyCheck()
|
||||||
|
|
||||||
|
rgba := color.RGBAModel.Convert(clr).(color.RGBA)
|
||||||
if enqueueImageOpIfNeeded(func() func() {
|
if enqueueImageOpIfNeeded(func() func() {
|
||||||
r, g, b, a := clr.RGBA()
|
|
||||||
return func() {
|
return func() {
|
||||||
i.Fill(color.RGBA64{
|
i.Fill(rgba)
|
||||||
R: uint16(r),
|
|
||||||
G: uint16(g),
|
|
||||||
B: uint16(b),
|
|
||||||
A: uint16(a),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
return nil
|
return nil
|
||||||
@ -160,7 +155,7 @@ func (i *Image) Fill(clr color.Color) error {
|
|||||||
|
|
||||||
i.resolvePendingPixels(false)
|
i.resolvePendingPixels(false)
|
||||||
|
|
||||||
i.mipmap.fill(clr)
|
i.mipmap.fill(rgba)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,9 +250,9 @@ func (i *Image) clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fill fills the specified part of the image with a solid color.
|
// Fill fills the specified part of the image with a solid color.
|
||||||
func (i *Image) Fill(clr color.Color) {
|
func (i *Image) Fill(clr color.RGBA) {
|
||||||
i.basePixels = Pixels{
|
i.basePixels = Pixels{
|
||||||
baseColor: color.RGBAModel.Convert(clr).(color.RGBA),
|
baseColor: clr,
|
||||||
}
|
}
|
||||||
i.drawTrianglesHistory = nil
|
i.drawTrianglesHistory = nil
|
||||||
i.stale = false
|
i.stale = false
|
||||||
|
@ -322,7 +322,7 @@ func (i *Image) DrawTriangles(img *Image, vertices []float32, indices []uint16,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Image) Fill(clr color.Color) {
|
func (i *Image) Fill(clr color.RGBA) {
|
||||||
backendsM.Lock()
|
backendsM.Lock()
|
||||||
defer backendsM.Unlock()
|
defer backendsM.Unlock()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user