From d7d892f2d644804b10c780eea42f1ec8ed62261e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 13 May 2018 23:00:06 +0900 Subject: [PATCH] graphics: Allow a little margin for edge pixels --- image_test.go | 8 ++++---- internal/graphics/shader.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/image_test.go b/image_test.go index 7e3516e6f..261e4aafe 100644 --- a/image_test.go +++ b/image_test.go @@ -541,11 +541,11 @@ func TestImageEdge(t *testing.T) { transparent := color.RGBA{0, 0, 0, 0} angles := []float64{} - for a := 0; a < 360; a++ { - angles = append(angles, float64(a)/360*2*math.Pi) + for a := 0; a < 1440; a++ { + angles = append(angles, float64(a)/1440*2*math.Pi) } - for a := 0; a < 256; a++ { - angles = append(angles, float64(a)/256*2*math.Pi) + for a := 0; a < 4096; a++ { + angles = append(angles, float64(a)/4096*2*math.Pi) } for _, f := range []Filter{FilterNearest, FilterLinear} { diff --git a/internal/graphics/shader.go b/internal/graphics/shader.go index b75d2f002..565c44d1a 100644 --- a/internal/graphics/shader.go +++ b/internal/graphics/shader.go @@ -94,8 +94,8 @@ void main(void) { vec4 color = texture2D(texture, pos); if (pos.x < varying_tex_coord_min.x || pos.y < varying_tex_coord_min.y || - (varying_tex_coord_max.x - texel_size.x / 256.0) <= pos.x || - (varying_tex_coord_max.y - texel_size.y / 256.0) <= pos.y) { + (varying_tex_coord_max.x - texel_size.x / 512.0) <= pos.x || + (varying_tex_coord_max.y - texel_size.y / 512.0) <= pos.y) { color = vec4(0, 0, 0, 0); } #endif @@ -115,11 +115,11 @@ void main(void) { c0 = vec4(0, 0, 0, 0); c1 = vec4(0, 0, 0, 0); } - if ((varying_tex_coord_max.x - texel_size.x / 256.0) <= p1.x) { + if ((varying_tex_coord_max.x - texel_size.x / 512.0) <= p1.x) { c1 = vec4(0, 0, 0, 0); c3 = vec4(0, 0, 0, 0); } - if ((varying_tex_coord_max.y - texel_size.y / 256.0) <= p1.y) { + if ((varying_tex_coord_max.y - texel_size.y / 512.0) <= p1.y) { c2 = vec4(0, 0, 0, 0); c3 = vec4(0, 0, 0, 0); }