mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphics: Use the viewport size same as the framebuffer size
Fixes #691
This commit is contained in:
parent
c4abed0a22
commit
fad65f2f5d
@ -16,7 +16,6 @@ package graphics
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/internal/opengl"
|
"github.com/hajimehoshi/ebiten/internal/opengl"
|
||||||
"github.com/hajimehoshi/ebiten/internal/web"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// orthoProjectionMatrix returns an orthogonal projection matrix for OpenGL.
|
// orthoProjectionMatrix returns an orthogonal projection matrix for OpenGL.
|
||||||
@ -68,15 +67,10 @@ func newScreenFramebuffer(width, height int) *framebuffer {
|
|||||||
|
|
||||||
// viewportSize returns the viewport size of the framebuffer.
|
// viewportSize returns the viewport size of the framebuffer.
|
||||||
func (f *framebuffer) viewportSize() (int, int) {
|
func (f *framebuffer) viewportSize() (int, int) {
|
||||||
// On some browsers, viewport size must be within the framebuffer size.
|
// On some environments, viewport size must be within the framebuffer size.
|
||||||
// e.g. Edge (#71), Chrome on GPD Pocket (#420)
|
// e.g. Edge (#71), Chrome on GPD Pocket (#420), macOS Mojave (#691).
|
||||||
if web.IsBrowser() {
|
// Use the same size of the framebuffer here.
|
||||||
return f.width, f.height
|
return f.width, f.height
|
||||||
}
|
|
||||||
|
|
||||||
// If possible, always use the same viewport size to reduce draw calls.
|
|
||||||
m := MaxImageSize()
|
|
||||||
return m, m
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setAsViewport sets the framebuffer as the current viewport.
|
// setAsViewport sets the framebuffer as the current viewport.
|
||||||
|
Loading…
Reference in New Issue
Block a user