mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 10:42:42 +01:00
ebiten: Remove the returning value from (*Image).ReplacePixels
Updates #1380
This commit is contained in:
parent
525d16bec8
commit
04bbe1ebb6
7
image.go
7
image.go
@ -701,13 +701,11 @@ func (i *Image) Dispose() {
|
||||
// When len(pix) is not appropriate, ReplacePixels panics.
|
||||
//
|
||||
// When the image is disposed, ReplacePixels does nothing.
|
||||
//
|
||||
// ReplacePixels always returns nil as of 1.5.0.
|
||||
func (i *Image) ReplacePixels(pixels []byte) error {
|
||||
func (i *Image) ReplacePixels(pixels []byte) {
|
||||
i.copyCheck()
|
||||
|
||||
if i.isDisposed() {
|
||||
return nil
|
||||
return
|
||||
}
|
||||
r := i.Bounds()
|
||||
|
||||
@ -717,7 +715,6 @@ func (i *Image) ReplacePixels(pixels []byte) error {
|
||||
if err := i.mipmap.ReplacePixels(pixels, r.Min.X, r.Min.Y, r.Dx(), r.Dy()); err != nil {
|
||||
theUIContext.setError(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewImage returns an empty image.
|
||||
|
@ -323,10 +323,7 @@ func TestImageReplacePixels(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := img0.ReplacePixels(img.Pix); err != nil {
|
||||
t.Fatal(err)
|
||||
return
|
||||
}
|
||||
img0.ReplacePixels(img.Pix)
|
||||
for j := 0; j < img0.Bounds().Size().Y; j++ {
|
||||
for i := 0; i < img0.Bounds().Size().X; i++ {
|
||||
got := img0.At(i, j)
|
||||
@ -341,10 +338,7 @@ func TestImageReplacePixels(t *testing.T) {
|
||||
for i := range p {
|
||||
p[i] = 0x80
|
||||
}
|
||||
if err := img0.ReplacePixels(p); err != nil {
|
||||
t.Fatal(err)
|
||||
return
|
||||
}
|
||||
img0.ReplacePixels(p)
|
||||
// Even if p is changed after calling ReplacePixel, img0 uses the original values.
|
||||
for i := range p {
|
||||
p[i] = 0
|
||||
|
Loading…
Reference in New Issue
Block a user