diff --git a/examples/filter/main.go b/examples/filter/main.go index c7f5a61ce..9cda97078 100644 --- a/examples/filter/main.go +++ b/examples/filter/main.go @@ -79,9 +79,6 @@ func main() { log.Fatal(err) } - // Specifying filter on NewImage[FromImage] is just for backward compatibility. - // Now specifying filter at DrawImageOptions is recommended. - // Specify FilterDefault here, that means to prefer filter specified at DrawImageOptions. ebitenImage, _ = ebiten.NewImageFromImage(img) ebiten.SetWindowSize(screenWidth, screenHeight) diff --git a/examples/minify/main.go b/examples/minify/main.go index 83a5a6f22..799892a6f 100644 --- a/examples/minify/main.go +++ b/examples/minify/main.go @@ -111,9 +111,6 @@ func main() { log.Fatal(err) } - // Specifying filter on NewImage[FromImage] is just for backward compatibility. - // Now specifying filter at DrawImageOptions is recommended. - // Specify FilterDefault here, that means to prefer filter specified at DrawImageOptions. gophersImage, _ = ebiten.NewImageFromImage(img) ebiten.SetWindowSize(screenWidth, screenHeight) diff --git a/graphics.go b/graphics.go index e8a8d50e7..5beb0fd15 100644 --- a/graphics.go +++ b/graphics.go @@ -22,9 +22,6 @@ import ( type Filter int const ( - // FilterDefault represents the default filter. - FilterDefault Filter = 0 - // FilterNearest represents nearest (crisp-edged) filter FilterNearest Filter = Filter(driver.FilterNearest) diff --git a/image.go b/image.go index a134f3efa..6c916b796 100644 --- a/image.go +++ b/image.go @@ -121,15 +121,10 @@ type DrawImageOptions struct { CompositeMode CompositeMode // Filter is a type of texture filter. - // The default (zero) value is FilterDefault. + // The default (zero) value is FilterNearest. // // Filter can also be specified at NewImage* functions, but // specifying filter at DrawImageOptions is recommended (as of 1.7.0). - // - // If both Filter specified at NewImage* and DrawImageOptions are FilterDefault, - // FilterNearest is used. - // If either is FilterDefault and the other is not, the latter is used. - // Otherwise, Filter specified at DrawImageOptions is used. Filter Filter } @@ -193,11 +188,7 @@ func (i *Image) DrawImage(img *Image, options *DrawImageOptions) error { bounds := img.Bounds() mode := driver.CompositeMode(options.CompositeMode) - - filter := driver.FilterNearest - if options.Filter != FilterDefault { - filter = driver.Filter(options.Filter) - } + filter := driver.Filter(options.Filter) a, b, c, d, tx, ty := options.GeoM.elements32() @@ -262,7 +253,7 @@ type DrawTrianglesOptions struct { CompositeMode CompositeMode // Filter is a type of texture filter. - // The default (zero) value is FilterDefault. + // The default (zero) value is FilterNearest. Filter Filter // Address is a sampler address mode. @@ -324,10 +315,7 @@ func (i *Image) DrawTriangles(vertices []Vertex, indices []uint16, img *Image, o } } - filter := driver.FilterNearest - if options.Filter != FilterDefault { - filter = driver.Filter(options.Filter) - } + filter := driver.Filter(options.Filter) vs := make([]float32, len(vertices)*graphics.VertexFloatNum) for i, v := range vertices { diff --git a/internal/driver/filter.go b/internal/driver/filter.go index 187e19c08..3484c9568 100644 --- a/internal/driver/filter.go +++ b/internal/driver/filter.go @@ -17,7 +17,7 @@ package driver type Filter int const ( - FilterNearest Filter = iota + 1 // TODO: Remove '+ 1' when ebiten.FilterDefault can be removed. + FilterNearest Filter = iota FilterLinear FilterScreen )