mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +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 {
|
||||
i.copyCheck()
|
||||
|
||||
rgba := color.RGBAModel.Convert(clr).(color.RGBA)
|
||||
if enqueueImageOpIfNeeded(func() func() {
|
||||
r, g, b, a := clr.RGBA()
|
||||
return func() {
|
||||
i.Fill(color.RGBA64{
|
||||
R: uint16(r),
|
||||
G: uint16(g),
|
||||
B: uint16(b),
|
||||
A: uint16(a),
|
||||
})
|
||||
i.Fill(rgba)
|
||||
}
|
||||
}) {
|
||||
return nil
|
||||
@ -160,7 +155,7 @@ func (i *Image) Fill(clr color.Color) error {
|
||||
|
||||
i.resolvePendingPixels(false)
|
||||
|
||||
i.mipmap.fill(clr)
|
||||
i.mipmap.fill(rgba)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -250,9 +250,9 @@ func (i *Image) clear() {
|
||||
}
|
||||
|
||||
// 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{
|
||||
baseColor: color.RGBAModel.Convert(clr).(color.RGBA),
|
||||
baseColor: clr,
|
||||
}
|
||||
i.drawTrianglesHistory = nil
|
||||
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()
|
||||
defer backendsM.Unlock()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user