mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
buffered: Bug fix: Pixel data was not invalidated after DrawImage/Triangles
This commit is contained in:
parent
4a7929cf71
commit
198621404f
@ -2172,3 +2172,27 @@ func TestImageFloatTranslate(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Issue #1213
|
||||
func TestImageColorMCopy(t *testing.T) {
|
||||
const w, h = 16, 16
|
||||
dst, _ := NewImage(w, h, FilterDefault)
|
||||
src, _ := NewImage(w, h, FilterDefault)
|
||||
|
||||
for k := 0; k < 256; k++ {
|
||||
op := &DrawImageOptions{}
|
||||
op.ColorM.Translate(float64(k)/0xff, 1, 1, 1)
|
||||
op.CompositeMode = CompositeModeCopy
|
||||
dst.DrawImage(src, op)
|
||||
|
||||
for j := 0; j < h; j++ {
|
||||
for i := 0; i < w; i++ {
|
||||
got := dst.At(i, j).(color.RGBA)
|
||||
want := color.RGBA{byte(k), 0xff, 0xff, 0xff}
|
||||
if !sameColors(got, want, 1) {
|
||||
t.Fatalf("dst.At(%d, %d), k: %d: got %v, want %v", i, j, k, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,6 +275,7 @@ func (i *Image) drawImage(src *Image, bounds image.Rectangle, g mipmap.GeoM, col
|
||||
src.resolvePendingPixels(true)
|
||||
i.resolvePendingPixels(false)
|
||||
i.img.DrawImage(src.img, bounds, g, colorm, mode, filter)
|
||||
i.invalidatePendingPixels()
|
||||
}
|
||||
|
||||
// DrawTriangles draws the src image with the given vertices.
|
||||
@ -329,6 +330,7 @@ func (i *Image) DrawTriangles(src *Image, vertices []float32, indices []uint16,
|
||||
srcImg = src.img
|
||||
}
|
||||
i.img.DrawTriangles(srcImg, vertices, indices, colorm, mode, filter, address, s, us)
|
||||
i.invalidatePendingPixels()
|
||||
}
|
||||
|
||||
type Shader struct {
|
||||
|
Loading…
Reference in New Issue
Block a user