graphics: Use math.Ceil for the screen framebuffer size

There are glitches on some mobile devices like Xperia. As the
screen framebuffer size might not fit with the actual GL surface
size, we guessed that is the cause of the glitches.

By using math.Ceil, the screen framebuffer will be a little bigger
and can cover the GL surface.
This commit is contained in:
Hajime Hoshi 2019-01-16 23:41:49 +09:00
parent 645b94de5f
commit 0b60471ac0

View File

@ -65,8 +65,8 @@ func (c *graphicsContext) SetSize(screenWidth, screenHeight int, screenScale flo
}
c.offscreen = newVolatileImage(screenWidth, screenHeight)
w := int(float64(screenWidth) * screenScale)
h := int(float64(screenHeight) * screenScale)
w := int(math.Ceil(float64(screenWidth) * screenScale))
h := int(math.Ceil(float64(screenHeight) * screenScale))
px0, py0, px1, py1 := ui.ScreenPadding()
c.screen = newImageWithScreenFramebuffer(w+int(math.Ceil(px0+px1)), h+int(math.Ceil(py0+py1)))
c.screenWidth = w