mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +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.
|
// newScreenFramebufferImageCommand is a command to create a special image for the screen.
|
||||||
type newScreenFramebufferImageCommand struct {
|
type newScreenFramebufferImageCommand struct {
|
||||||
result *Image
|
result *Image
|
||||||
width int
|
width int
|
||||||
height int
|
height int
|
||||||
offsetX float64
|
|
||||||
offsetY float64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exec executes a newScreenFramebufferImageCommand.
|
// 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.
|
// 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
|
// 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).
|
||||||
c.result.framebuffer = newScreenFramebuffer(c.width, c.height, c.offsetX, c.offsetY)
|
c.result.framebuffer = newScreenFramebuffer(c.width, c.height)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -43,11 +43,6 @@ type framebuffer struct {
|
|||||||
proMatrix []float32
|
proMatrix []float32
|
||||||
width int
|
width int
|
||||||
height 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.
|
// 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.
|
// newScreenFramebuffer creates a framebuffer for the screen.
|
||||||
func newScreenFramebuffer(width, height int, offsetX, offsetY float64) *framebuffer {
|
func newScreenFramebuffer(width, height int) *framebuffer {
|
||||||
return &framebuffer{
|
return &framebuffer{
|
||||||
native: opengl.GetContext().ScreenFramebuffer(),
|
native: opengl.GetContext().ScreenFramebuffer(),
|
||||||
flipY: true,
|
flipY: true,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
offsetX: offsetX,
|
|
||||||
offsetY: offsetY,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,17 +60,15 @@ func NewImageFromImage(img *image.RGBA, width, height int) *Image {
|
|||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewScreenFramebufferImage(width, height int, offsetX, offsetY float64) *Image {
|
func NewScreenFramebufferImage(width, height int) *Image {
|
||||||
i := &Image{
|
i := &Image{
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
}
|
}
|
||||||
c := &newScreenFramebufferImageCommand{
|
c := &newScreenFramebufferImageCommand{
|
||||||
result: i,
|
result: i,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
offsetX: offsetX,
|
|
||||||
offsetY: offsetY,
|
|
||||||
}
|
}
|
||||||
theCommandQueue.Enqueue(c)
|
theCommandQueue.Enqueue(c)
|
||||||
return i
|
return i
|
||||||
|
@ -119,7 +119,7 @@ func NewImageFromImage(source image.Image) *Image {
|
|||||||
// NewScreenFramebufferImage creates a special image that framebuffer is one for the screen.
|
// NewScreenFramebufferImage creates a special image that framebuffer is one for the screen.
|
||||||
func NewScreenFramebufferImage(width, height int, paddingX0, paddingY0, paddingX1, paddingY1 float64) *Image {
|
func NewScreenFramebufferImage(width, height int, paddingX0, paddingY0, paddingX1, paddingY1 float64) *Image {
|
||||||
i := &Image{
|
i := &Image{
|
||||||
image: graphics.NewScreenFramebufferImage(width, height, paddingX0, paddingY0),
|
image: graphics.NewScreenFramebufferImage(width, height),
|
||||||
volatile: true,
|
volatile: true,
|
||||||
screen: true,
|
screen: true,
|
||||||
paddingX0: paddingX0,
|
paddingX0: paddingX0,
|
||||||
@ -322,7 +322,7 @@ func (i *Image) restore() error {
|
|||||||
if i.screen {
|
if i.screen {
|
||||||
// The screen image should also be recreated because framebuffer might
|
// The screen image should also be recreated because framebuffer might
|
||||||
// be changed.
|
// be changed.
|
||||||
i.image = graphics.NewScreenFramebufferImage(w, h, i.paddingX0, i.paddingY0)
|
i.image = graphics.NewScreenFramebufferImage(w, h)
|
||||||
i.basePixels = nil
|
i.basePixels = nil
|
||||||
i.drawImageHistory = nil
|
i.drawImageHistory = nil
|
||||||
i.stale = false
|
i.stale = false
|
||||||
|
Loading…
Reference in New Issue
Block a user