From 0b60471ac08215cd0ed47608fcc0fa1e00ffd162 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 16 Jan 2019 23:41:49 +0900 Subject: [PATCH] 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. --- graphicscontext.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphicscontext.go b/graphicscontext.go index cb0b5a140..2c1252063 100644 --- a/graphicscontext.go +++ b/graphicscontext.go @@ -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