graphics: Bug fix: examples/blocks had a wrong colored background

This commit is contained in:
Hajime Hoshi 2016-11-04 14:14:29 +09:00
parent 07294a98b6
commit bb9e69c924
2 changed files with 12 additions and 0 deletions

View File

@ -43,7 +43,13 @@ func vertices(parts ImageParts, width, height int, geo *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)/w, float64(sy0)/h, float64(sx1)/w, float64(sy1)/h
vs.SetIndex(n, dx0)
vs.SetIndex(n+1, dy0)

View File

@ -42,8 +42,14 @@ func vertices(parts ImageParts, width, height int, geo *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)/w, float32(sy0)/h, float32(sx1)/w, float32(sy1)/h
vs[n] = x0
vs[n+1] = y0