graphics: Try to make CI happy

This commit is contained in:
Hajime Hoshi 2017-02-11 03:44:29 +09:00
parent 6ccd27ee67
commit 9748b28c0e
4 changed files with 26 additions and 5 deletions

View File

@ -642,7 +642,7 @@ func TestImageEdge(t *testing.T) {
if c == transparent {
continue
}
t.Errorf("img1.At(%d, %d) want: red or transparent, got: %v", i, j, c)
t.Errorf("img1.At(%d, %d) (angle: %d) want: red or transparent, got: %v", i, j, a, c)
}
}
}

21
vertices.go Normal file
View File

@ -0,0 +1,21 @@
// Copyright 2017 The Ebiten Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ebiten
// texelAdjustment represents a number to be used to adjust texel.
// Texels are adjusted by amount propotional to inverse of texelAdjustment.
// This is necessary not to use unexpected pixels outside of texels.
// See #317.
const texelAdjustment = 128

View File

@ -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 / wf / 256.0
v1 -= 1.0 / hf / 256.0
u1 -= 1.0 / wf / texelAdjustment
v1 -= 1.0 / hf / texelAdjustment
vs.SetIndex(n, dx0)
vs.SetIndex(n+1, dy0)
vs.SetIndex(n+2, u0)

View File

@ -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 / wf / 256.0
v1 -= 1.0 / hf / 256.0
u1 -= 1.0 / wf / texelAdjustment
v1 -= 1.0 / hf / texelAdjustment
vs[n] = x0
vs[n+1] = y0
vs[n+2] = u0