mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 12:08:58 +01:00
graphics: Allow a little margin for edge pixels
This commit is contained in:
parent
a1dd7b39a3
commit
d7d892f2d6
@ -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} {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user