mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 11:12:44 +01:00
graphics: Refactoring
This commit is contained in:
parent
b691e73342
commit
63c33b24df
3
image.go
3
image.go
@ -377,12 +377,9 @@ func NewImage(width, height int, filter Filter) (*Image, error) {
|
|||||||
// Note that volatile images are internal only and will never be source of drawing.
|
// Note that volatile images are internal only and will never be source of drawing.
|
||||||
//
|
//
|
||||||
// If width or height is less than 1 or more than device-dependent maximum size, newVolatileImage panics.
|
// If width or height is less than 1 or more than device-dependent maximum size, newVolatileImage panics.
|
||||||
//
|
|
||||||
// Error returned by newVolatileImage is always nil as of 1.5.0-alpha.
|
|
||||||
func newVolatileImage(width, height int) *Image {
|
func newVolatileImage(width, height int) *Image {
|
||||||
i := &Image{
|
i := &Image{
|
||||||
shareableImage: shareable.NewVolatileImage(width, height),
|
shareableImage: shareable.NewVolatileImage(width, height),
|
||||||
filter: FilterDefault,
|
|
||||||
}
|
}
|
||||||
i.addr = i
|
i.addr = i
|
||||||
runtime.SetFinalizer(i, (*Image).Dispose)
|
runtime.SetFinalizer(i, (*Image).Dispose)
|
||||||
|
@ -622,8 +622,8 @@ func BenchmarkDrawImage(b *testing.B) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestImageLinear(t *testing.T) {
|
func TestImageLinear(t *testing.T) {
|
||||||
src, _ := NewImage(32, 32, FilterLinear)
|
src, _ := NewImage(32, 32, FilterDefault)
|
||||||
dst, _ := NewImage(64, 64, FilterNearest)
|
dst, _ := NewImage(64, 64, FilterDefault)
|
||||||
src.Fill(color.RGBA{0, 0xff, 0, 0xff})
|
src.Fill(color.RGBA{0, 0xff, 0, 0xff})
|
||||||
ebitenutil.DrawRect(src, 8, 8, 16, 16, color.RGBA{0xff, 0, 0, 0xff})
|
ebitenutil.DrawRect(src, 8, 8, 16, 16, color.RGBA{0xff, 0, 0, 0xff})
|
||||||
|
|
||||||
@ -632,6 +632,7 @@ func TestImageLinear(t *testing.T) {
|
|||||||
op.GeoM.Scale(2, 2)
|
op.GeoM.Scale(2, 2)
|
||||||
r := image.Rect(8, 8, 24, 24)
|
r := image.Rect(8, 8, 24, 24)
|
||||||
op.SourceRect = &r
|
op.SourceRect = &r
|
||||||
|
op.Filter = FilterLinear
|
||||||
dst.DrawImage(src, op)
|
dst.DrawImage(src, op)
|
||||||
|
|
||||||
for j := 0; j < 64; j++ {
|
for j := 0; j < 64; j++ {
|
||||||
|
Loading…
Reference in New Issue
Block a user