mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
Revert "graphics: Bug fix: a sub image's Size was wrong"
This reverts commit 76ac850f6b
.
Reason: This breaks many examples
This commit is contained in:
parent
76ac850f6b
commit
27331024af
5
image.go
5
image.go
@ -150,8 +150,7 @@ func (i *Image) copyCheck() {
|
||||
|
||||
// Size returns the size of the image.
|
||||
func (i *Image) Size() (width, height int) {
|
||||
s := i.Bounds().Size()
|
||||
return s.X, s.Y
|
||||
return i.mipmap.original().Size()
|
||||
}
|
||||
|
||||
func (i *Image) isDisposed() bool {
|
||||
@ -570,7 +569,7 @@ func (i *Image) SubImage(r image.Rectangle) image.Image {
|
||||
// Bounds returns the bounds of the image.
|
||||
func (i *Image) Bounds() image.Rectangle {
|
||||
if i.bounds == nil {
|
||||
w, h := i.mipmap.original().Size()
|
||||
w, h := i.Size()
|
||||
return image.Rect(0, 0, w, h)
|
||||
}
|
||||
return *i.bounds
|
||||
|
@ -1034,14 +1034,3 @@ func TestImageSubImageAt(t *testing.T) {
|
||||
t.Errorf("got: %v, want: %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageSubImageSize(t *testing.T) {
|
||||
img, _ := NewImage(16, 16, FilterDefault)
|
||||
img.Fill(color.RGBA{0xff, 0, 0, 0xff})
|
||||
|
||||
got, _ := img.SubImage(image.Rect(1, 1, 16, 16)).(*Image).Size()
|
||||
want := 15
|
||||
if got != want {
|
||||
t.Errorf("got: %v, want: %v", got, want)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user