mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
graphicsdriver: Adjust API
This commit is contained in:
parent
907a28c434
commit
cc2174bd69
@ -433,8 +433,9 @@ func (c *newScreenFramebufferImageCommand) String() string {
|
|||||||
|
|
||||||
// Exec executes a newScreenFramebufferImageCommand.
|
// Exec executes a newScreenFramebufferImageCommand.
|
||||||
func (c *newScreenFramebufferImageCommand) Exec(indexOffset int) error {
|
func (c *newScreenFramebufferImageCommand) Exec(indexOffset int) error {
|
||||||
c.result.image = driver().NewScreenFramebufferImage(c.width, c.height)
|
var err error
|
||||||
return nil
|
c.result.image, err = driver().NewScreenFramebufferImage(c.width, c.height)
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *newScreenFramebufferImageCommand) NumVertices() int {
|
func (c *newScreenFramebufferImageCommand) NumVertices() int {
|
||||||
|
@ -24,7 +24,7 @@ type GraphicsDriver interface {
|
|||||||
Flush()
|
Flush()
|
||||||
MaxImageSize() int
|
MaxImageSize() int
|
||||||
NewImage(width, height int) (Image, error)
|
NewImage(width, height int) (Image, error)
|
||||||
NewScreenFramebufferImage(width, height int) Image
|
NewScreenFramebufferImage(width, height int) (Image, error)
|
||||||
Reset() error
|
Reset() error
|
||||||
Draw(indexLen int, indexOffset int, mode graphics.CompositeMode, colorM *affine.ColorM, filter graphics.Filter) error
|
Draw(indexLen int, indexOffset int, mode graphics.CompositeMode, colorM *affine.ColorM, filter graphics.Filter) error
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ func (d *Driver) NewImage(width, height int) (graphicsdriver.Image, error) {
|
|||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) NewScreenFramebufferImage(width, height int) graphicsdriver.Image {
|
func (d *Driver) NewScreenFramebufferImage(width, height int) (graphicsdriver.Image, error) {
|
||||||
d.checkSize(width, height)
|
d.checkSize(width, height)
|
||||||
i := &Image{
|
i := &Image{
|
||||||
driver: d,
|
driver: d,
|
||||||
@ -78,7 +78,7 @@ func (d *Driver) NewScreenFramebufferImage(width, height int) graphicsdriver.Ima
|
|||||||
// On browsers, c.width and c.height are used as viewport size and
|
// On browsers, c.width and c.height are used as viewport size and
|
||||||
// Edge can't treat a bigger viewport than the drawing area (#71).
|
// Edge can't treat a bigger viewport than the drawing area (#71).
|
||||||
i.framebuffer = newScreenFramebuffer(&d.context, width, height)
|
i.framebuffer = newScreenFramebuffer(&d.context, width, height)
|
||||||
return i
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset resets or initializes the current OpenGL state.
|
// Reset resets or initializes the current OpenGL state.
|
||||||
|
Loading…
Reference in New Issue
Block a user