From 06394680c142040608dbcc6585cd5a89513fe37f Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 6 Feb 2017 10:35:42 +0900 Subject: [PATCH] graphics: Better texels adjusting for small textures (#317) --- vertices_js.go | 4 ++-- vertices_notjs.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vertices_js.go b/vertices_js.go index 768ac7228..350f633f7 100644 --- a/vertices_js.go +++ b/vertices_js.go @@ -57,8 +57,8 @@ func vertices(parts ImageParts, width, height int, geo *affine.GeoM) []float32 { } u0, v0, u1, v1 := float64(sx0)/wf, float64(sy0)/hf, float64(sx1)/wf, float64(sy1)/hf // Adjust texels to fix a problem that outside texels are used (#317). - u1 -= 1.0 / 16384.0 - v1 -= 1.0 / 16384.0 + u1 -= 1.0 / wf / 256.0 + v1 -= 1.0 / hf / 256.0 vs.SetIndex(n, dx0) vs.SetIndex(n+1, dy0) vs.SetIndex(n+2, u0) diff --git a/vertices_notjs.go b/vertices_notjs.go index 2666a6b22..4393643b0 100644 --- a/vertices_notjs.go +++ b/vertices_notjs.go @@ -56,8 +56,8 @@ func vertices(parts ImageParts, width, height int, geo *affine.GeoM) []float32 { } u0, v0, u1, v1 := float32(sx0)/wf, float32(sy0)/hf, float32(sx1)/wf, float32(sy1)/hf // Adjust texels to fix a problem that outside texels are used (#317). - u1 -= 1.0 / 16384.0 - v1 -= 1.0 / 16384.0 + u1 -= 1.0 / wf / 256.0 + v1 -= 1.0 / hf / 256.0 vs[n] = x0 vs[n+1] = y0 vs[n+2] = u0