diff --git a/internal/graphics/command.go b/internal/graphics/command.go index 9383db6e0..5beb3aa2f 100644 --- a/internal/graphics/command.go +++ b/internal/graphics/command.go @@ -18,8 +18,6 @@ import ( "errors" "fmt" "image" - "image/color" - "math" "github.com/hajimehoshi/ebiten/internal/affine" emath "github.com/hajimehoshi/ebiten/internal/math" @@ -186,38 +184,6 @@ func FlushCommands() error { return theCommandQueue.Flush() } -// fillCommand represents a drawing command to fill an image with a solid color. -type fillCommand struct { - dst *Image - color color.RGBA -} - -// Exec executes the fillCommand. -func (c *fillCommand) Exec(indexOffsetInBytes int) error { - f, err := c.dst.createFramebufferIfNeeded() - if err != nil { - return err - } - f.setAsViewport() - - cr, cg, cb, ca := c.color.R, c.color.G, c.color.B, c.color.A - const max = math.MaxUint8 - r := float32(cr) / max - g := float32(cg) / max - b := float32(cb) / max - a := float32(ca) / max - if err := opengl.GetContext().FillFramebuffer(r, g, b, a); err != nil { - return err - } - - // Flush is needed after filling (#419) - opengl.GetContext().Flush() - // Mysterious, but binding texture is needed after filling - // on some mechines like Photon 2 (#492). - opengl.GetContext().BindTexture(opengl.InvalidTexture) - return nil -} - // drawImageCommand represents a drawing command to draw an image on another image. type drawImageCommand struct { dst *Image diff --git a/internal/graphics/image.go b/internal/graphics/image.go index b4e90f1ac..c4487ba44 100644 --- a/internal/graphics/image.go +++ b/internal/graphics/image.go @@ -87,17 +87,6 @@ func (i *Image) Size() (int, int) { return i.width, i.height } -func (i *Image) Fill(r, g, b, a uint8) { - c := &fillCommand{ - dst: i, - } - c.color.R = r - c.color.G = g - c.color.B = b - c.color.A = a - theCommandQueue.Enqueue(c) -} - func (i *Image) DrawImage(src *Image, vertices []float32, clr *affine.ColorM, mode opengl.CompositeMode, filter Filter) { theCommandQueue.EnqueueDrawImageCommand(i, src, vertices, clr, mode, filter) }