mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
graphics: Remove unused arguments
This commit is contained in:
parent
f897c3958e
commit
912d498cdf
@ -84,6 +84,7 @@ func (c *graphicsContext) Update() error {
|
|||||||
if err := c.defaultRenderTarget.DrawImage(c.screen, options); err != nil {
|
if err := c.defaultRenderTarget.DrawImage(c.screen, options); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
graphics.FlushCommands(ui.GLContext())
|
||||||
// Call glFlush to prevent black flicking (especially on Android (#226)).
|
// Call glFlush to prevent black flicking (especially on Android (#226)).
|
||||||
ui.GLContext().Flush()
|
ui.GLContext().Flush()
|
||||||
return nil
|
return nil
|
||||||
|
12
image.go
12
image.go
@ -199,10 +199,10 @@ type imageImpl struct {
|
|||||||
texture *graphics.Texture
|
texture *graphics.Texture
|
||||||
defaultFramebuffer bool
|
defaultFramebuffer bool
|
||||||
disposed bool
|
disposed bool
|
||||||
pixels []uint8
|
|
||||||
width int
|
width int
|
||||||
height int
|
height int
|
||||||
filter Filter
|
filter Filter
|
||||||
|
pixels []uint8
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *imageImpl) Fill(clr color.Color) error {
|
func (i *imageImpl) Fill(clr color.Color) error {
|
||||||
@ -213,7 +213,7 @@ func (i *imageImpl) Fill(clr color.Color) error {
|
|||||||
return errors.New("ebiten: image is already disposed")
|
return errors.New("ebiten: image is already disposed")
|
||||||
}
|
}
|
||||||
i.pixels = nil
|
i.pixels = nil
|
||||||
return i.framebuffer.Fill(ui.GLContext(), clr)
|
return i.framebuffer.Fill(clr)
|
||||||
}
|
}
|
||||||
if theDelayedImageTasks.add(f) {
|
if theDelayedImageTasks.add(f) {
|
||||||
return nil
|
return nil
|
||||||
@ -261,7 +261,7 @@ func (i *imageImpl) DrawImage(image *Image, options *DrawImageOptions) error {
|
|||||||
geom := &options.GeoM
|
geom := &options.GeoM
|
||||||
colorm := &options.ColorM
|
colorm := &options.ColorM
|
||||||
mode := opengl.CompositeMode(options.CompositeMode)
|
mode := opengl.CompositeMode(options.CompositeMode)
|
||||||
if err := i.framebuffer.DrawTexture(ui.GLContext(), image.impl.texture, vertices[:16*n], geom, colorm, mode); err != nil {
|
if err := i.framebuffer.DrawTexture(image.impl.texture, vertices[:16*n], geom, colorm, mode); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -373,12 +373,12 @@ func (i *imageImpl) ReplacePixels(p []uint8) error {
|
|||||||
f := func() error {
|
f := func() error {
|
||||||
imageM.Lock()
|
imageM.Lock()
|
||||||
defer imageM.Unlock()
|
defer imageM.Unlock()
|
||||||
// Don't set i.pixels here because i.pixels is used not every time.
|
// TODO: Copy p?
|
||||||
i.pixels = nil
|
i.pixels = nil
|
||||||
if i.isDisposed() {
|
if i.isDisposed() {
|
||||||
return errors.New("ebiten: image is already disposed")
|
return errors.New("ebiten: image is already disposed")
|
||||||
}
|
}
|
||||||
return i.framebuffer.ReplacePixels(ui.GLContext(), i.texture, p)
|
return i.framebuffer.ReplacePixels(i.texture, p)
|
||||||
}
|
}
|
||||||
if theDelayedImageTasks.add(f) {
|
if theDelayedImageTasks.add(f) {
|
||||||
return nil
|
return nil
|
||||||
@ -427,7 +427,7 @@ func NewImage(width, height int, filter Filter) (*Image, error) {
|
|||||||
image.framebuffer = framebuffer
|
image.framebuffer = framebuffer
|
||||||
image.texture = texture
|
image.texture = texture
|
||||||
runtime.SetFinalizer(image, (*imageImpl).Dispose)
|
runtime.SetFinalizer(image, (*imageImpl).Dispose)
|
||||||
if err := image.framebuffer.Fill(ui.GLContext(), color.Transparent); err != nil {
|
if err := image.framebuffer.Fill(color.Transparent); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -66,6 +66,10 @@ func (q *commandQueue) Flush(context *opengl.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FlushCommands(context *opengl.Context) error {
|
||||||
|
return theCommandQueue.Flush(context)
|
||||||
|
}
|
||||||
|
|
||||||
type fillCommand struct {
|
type fillCommand struct {
|
||||||
dst *Framebuffer
|
dst *Framebuffer
|
||||||
color color.Color
|
color color.Color
|
||||||
|
@ -96,7 +96,7 @@ func (f *Framebuffer) projectionMatrix() *[4][4]float64 {
|
|||||||
return f.proMatrix
|
return f.proMatrix
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Framebuffer) Fill(context *opengl.Context, clr color.Color) error {
|
func (f *Framebuffer) Fill(clr color.Color) error {
|
||||||
c := &fillCommand{
|
c := &fillCommand{
|
||||||
dst: f,
|
dst: f,
|
||||||
color: clr,
|
color: clr,
|
||||||
@ -105,7 +105,7 @@ func (f *Framebuffer) Fill(context *opengl.Context, clr color.Color) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Framebuffer) DrawTexture(context *opengl.Context, t *Texture, vertices []int16, geo, clr Matrix, mode opengl.CompositeMode) error {
|
func (f *Framebuffer) DrawTexture(t *Texture, vertices []int16, geo, clr Matrix, mode opengl.CompositeMode) error {
|
||||||
c := &drawImageCommand{
|
c := &drawImageCommand{
|
||||||
dst: f,
|
dst: f,
|
||||||
src: t,
|
src: t,
|
||||||
@ -115,13 +115,6 @@ func (f *Framebuffer) DrawTexture(context *opengl.Context, t *Texture, vertices
|
|||||||
mode: mode,
|
mode: mode,
|
||||||
}
|
}
|
||||||
theCommandQueue.Enqueue(c)
|
theCommandQueue.Enqueue(c)
|
||||||
// Drawing a texture to the default buffer must be the last command.
|
|
||||||
// TODO(hajimehoshi): This seems a little hacky. Refactor.
|
|
||||||
if f.native == opengl.ZeroFramebuffer {
|
|
||||||
if err := theCommandQueue.Flush(context); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +126,7 @@ func (f *Framebuffer) Pixels(context *opengl.Context) ([]uint8, error) {
|
|||||||
return context.FramebufferPixels(f.native, f.width, f.height)
|
return context.FramebufferPixels(f.native, f.width, f.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Framebuffer) ReplacePixels(context *opengl.Context, t *Texture, p []uint8) error {
|
func (f *Framebuffer) ReplacePixels(t *Texture, p []uint8) error {
|
||||||
c := &replacePixelsCommand{
|
c := &replacePixelsCommand{
|
||||||
dst: f,
|
dst: f,
|
||||||
texture: t,
|
texture: t,
|
||||||
|
Loading…
Reference in New Issue
Block a user