graphics: Use the viewport size same as the framebuffer size

Fixes #691
This commit is contained in:
Hajime Hoshi 2018-09-29 19:53:18 +09:00
parent c4abed0a22
commit fad65f2f5d

View File

@ -16,7 +16,6 @@ package graphics
import (
"github.com/hajimehoshi/ebiten/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/web"
)
// orthoProjectionMatrix returns an orthogonal projection matrix for OpenGL.
@ -68,17 +67,12 @@ func newScreenFramebuffer(width, height int) *framebuffer {
// viewportSize returns the viewport size of the framebuffer.
func (f *framebuffer) viewportSize() (int, int) {
// On some browsers, viewport size must be within the framebuffer size.
// e.g. Edge (#71), Chrome on GPD Pocket (#420)
if web.IsBrowser() {
// On some environments, viewport size must be within the framebuffer size.
// e.g. Edge (#71), Chrome on GPD Pocket (#420), macOS Mojave (#691).
// Use the same size of the framebuffer here.
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.
func (f *framebuffer) setAsViewport() {
w, h := f.viewportSize()