Revert "grahics: Remove unneeded 'if' branches"

This reverts commit aa8e77e0bf.
This commit is contained in:
Hajime Hoshi 2017-05-03 02:51:38 +09:00
parent 16b0c9186e
commit e97a0b3e37
2 changed files with 12 additions and 0 deletions

View File

@ -46,7 +46,13 @@ func vertices(parts ImageParts, width, height int, geo *affine.GeoM) []float32 {
n := 0
for i := 0; i < l; i++ {
dx0, dy0, dx1, dy1 := parts.Dst(i)
if dx0 == dx1 || dy0 == dy1 {
continue
}
sx0, sy0, sx1, sy1 := parts.Src(i)
if sx0 == sx1 || sy0 == sy1 {
continue
}
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 / wf / texelAdjustment

View File

@ -44,8 +44,14 @@ func vertices(parts ImageParts, width, height int, geo *affine.GeoM) []float32 {
n := 0
for i := 0; i < l; i++ {
dx0, dy0, dx1, dy1 := parts.Dst(i)
if dx0 == dx1 || dy0 == dy1 {
continue
}
x0, y0, x1, y1 := float32(dx0), float32(dy0), float32(dx1), float32(dy1)
sx0, sy0, sx1, sy1 := parts.Src(i)
if sx0 == sx1 || sy0 == sy1 {
continue
}
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 / wf / texelAdjustment