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 ( 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.