mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
graphics: Remove offsetX/offsetY from framebuffer
This commit is contained in:
parent
c5d1f11d95
commit
a2d40e0908
@ -371,11 +371,9 @@ func (c *newImageCommand) Exec(indexOffsetInBytes int) error {
|
||||
|
||||
// newScreenFramebufferImageCommand is a command to create a special image for the screen.
|
||||
type newScreenFramebufferImageCommand struct {
|
||||
result *Image
|
||||
width int
|
||||
height int
|
||||
offsetX float64
|
||||
offsetY float64
|
||||
result *Image
|
||||
width int
|
||||
height int
|
||||
}
|
||||
|
||||
// Exec executes a newScreenFramebufferImageCommand.
|
||||
@ -389,6 +387,6 @@ func (c *newScreenFramebufferImageCommand) Exec(indexOffsetInBytes int) error {
|
||||
// The (default) framebuffer size can't be converted to a power of 2.
|
||||
// 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).
|
||||
c.result.framebuffer = newScreenFramebuffer(c.width, c.height, c.offsetX, c.offsetY)
|
||||
c.result.framebuffer = newScreenFramebuffer(c.width, c.height)
|
||||
return nil
|
||||
}
|
||||
|
@ -43,11 +43,6 @@ type framebuffer struct {
|
||||
proMatrix []float32
|
||||
width int
|
||||
height int
|
||||
|
||||
// offsetX and offsetY are translation part of the projection matrix.
|
||||
// offsetX and offsetY are used for the fullscreen mode.
|
||||
offsetX float64
|
||||
offsetY float64
|
||||
}
|
||||
|
||||
// newFramebufferFromTexture creates a framebuffer from the given texture.
|
||||
@ -64,14 +59,12 @@ func newFramebufferFromTexture(texture *texture, width, height int) (*framebuffe
|
||||
}
|
||||
|
||||
// newScreenFramebuffer creates a framebuffer for the screen.
|
||||
func newScreenFramebuffer(width, height int, offsetX, offsetY float64) *framebuffer {
|
||||
func newScreenFramebuffer(width, height int) *framebuffer {
|
||||
return &framebuffer{
|
||||
native: opengl.GetContext().ScreenFramebuffer(),
|
||||
flipY: true,
|
||||
width: width,
|
||||
height: height,
|
||||
offsetX: offsetX,
|
||||
offsetY: offsetY,
|
||||
native: opengl.GetContext().ScreenFramebuffer(),
|
||||
flipY: true,
|
||||
width: width,
|
||||
height: height,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,17 +60,15 @@ func NewImageFromImage(img *image.RGBA, width, height int) *Image {
|
||||
return i
|
||||
}
|
||||
|
||||
func NewScreenFramebufferImage(width, height int, offsetX, offsetY float64) *Image {
|
||||
func NewScreenFramebufferImage(width, height int) *Image {
|
||||
i := &Image{
|
||||
width: width,
|
||||
height: height,
|
||||
}
|
||||
c := &newScreenFramebufferImageCommand{
|
||||
result: i,
|
||||
width: width,
|
||||
height: height,
|
||||
offsetX: offsetX,
|
||||
offsetY: offsetY,
|
||||
result: i,
|
||||
width: width,
|
||||
height: height,
|
||||
}
|
||||
theCommandQueue.Enqueue(c)
|
||||
return i
|
||||
|
@ -119,7 +119,7 @@ func NewImageFromImage(source image.Image) *Image {
|
||||
// NewScreenFramebufferImage creates a special image that framebuffer is one for the screen.
|
||||
func NewScreenFramebufferImage(width, height int, paddingX0, paddingY0, paddingX1, paddingY1 float64) *Image {
|
||||
i := &Image{
|
||||
image: graphics.NewScreenFramebufferImage(width, height, paddingX0, paddingY0),
|
||||
image: graphics.NewScreenFramebufferImage(width, height),
|
||||
volatile: true,
|
||||
screen: true,
|
||||
paddingX0: paddingX0,
|
||||
@ -322,7 +322,7 @@ func (i *Image) restore() error {
|
||||
if i.screen {
|
||||
// The screen image should also be recreated because framebuffer might
|
||||
// be changed.
|
||||
i.image = graphics.NewScreenFramebufferImage(w, h, i.paddingX0, i.paddingY0)
|
||||
i.image = graphics.NewScreenFramebufferImage(w, h)
|
||||
i.basePixels = nil
|
||||
i.drawImageHistory = nil
|
||||
i.stale = false
|
||||
|
Loading…
Reference in New Issue
Block a user