mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +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.
|
||||
//
|
||||
// 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 {
|
||||
i := &Image{
|
||||
shareableImage: shareable.NewVolatileImage(width, height),
|
||||
filter: FilterDefault,
|
||||
}
|
||||
i.addr = i
|
||||
runtime.SetFinalizer(i, (*Image).Dispose)
|
||||
|
@ -622,8 +622,8 @@ func BenchmarkDrawImage(b *testing.B) {
|
||||
}
|
||||
|
||||
func TestImageLinear(t *testing.T) {
|
||||
src, _ := NewImage(32, 32, FilterLinear)
|
||||
dst, _ := NewImage(64, 64, FilterNearest)
|
||||
src, _ := NewImage(32, 32, FilterDefault)
|
||||
dst, _ := NewImage(64, 64, FilterDefault)
|
||||
src.Fill(color.RGBA{0, 0xff, 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)
|
||||
r := image.Rect(8, 8, 24, 24)
|
||||
op.SourceRect = &r
|
||||
op.Filter = FilterLinear
|
||||
dst.DrawImage(src, op)
|
||||
|
||||
for j := 0; j < 64; j++ {
|
||||
|
Loading…
Reference in New Issue
Block a user