mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +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.
|
||||
func (c *newScreenFramebufferImageCommand) Exec(indexOffset int) error {
|
||||
c.result.image = driver().NewScreenFramebufferImage(c.width, c.height)
|
||||
return nil
|
||||
var err error
|
||||
c.result.image, err = driver().NewScreenFramebufferImage(c.width, c.height)
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *newScreenFramebufferImageCommand) NumVertices() int {
|
||||
|
@ -24,7 +24,7 @@ type GraphicsDriver interface {
|
||||
Flush()
|
||||
MaxImageSize() int
|
||||
NewImage(width, height int) (Image, error)
|
||||
NewScreenFramebufferImage(width, height int) Image
|
||||
NewScreenFramebufferImage(width, height int) (Image, error)
|
||||
Reset() 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
|
||||
}
|
||||
|
||||
func (d *Driver) NewScreenFramebufferImage(width, height int) graphicsdriver.Image {
|
||||
func (d *Driver) NewScreenFramebufferImage(width, height int) (graphicsdriver.Image, error) {
|
||||
d.checkSize(width, height)
|
||||
i := &Image{
|
||||
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
|
||||
// Edge can't treat a bigger viewport than the drawing area (#71).
|
||||
i.framebuffer = newScreenFramebuffer(&d.context, width, height)
|
||||
return i
|
||||
return i, nil
|
||||
}
|
||||
|
||||
// Reset resets or initializes the current OpenGL state.
|
||||
|
Loading…
Reference in New Issue
Block a user