diff --git a/image.go b/image.go index 56edbbabf..f77ee1ac6 100644 --- a/image.go +++ b/image.go @@ -245,8 +245,7 @@ func (i *Image) DrawImage(img *Image, options *DrawImageOptions) { }) } - // TODO: Do not pass the filter value. We are removing this argument (#2369). - i.image.DrawTriangles(srcs, vs, is, affine.ColorMIdentity{}, mode, filter, graphicsdriver.AddressUnsafe, i.adjustedRegion(), graphicsdriver.Region{}, [graphics.ShaderImageCount - 1][2]float32{}, shader.shader, uniforms, false, canSkipMipmap(options.GeoM, filter)) + i.image.DrawTriangles(srcs, vs, is, affine.ColorMIdentity{}, mode, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, i.adjustedRegion(), graphicsdriver.Region{}, [graphics.ShaderImageCount - 1][2]float32{}, shader.shader, uniforms, false, canSkipMipmap(options.GeoM, filter)) } // Vertex represents a vertex passed to DrawTriangles. @@ -454,7 +453,7 @@ func (i *Image) DrawTriangles(vertices []Vertex, indices []uint16, img *Image, o }) } - i.image.DrawTriangles(srcs, vs, is, affine.ColorMIdentity{}, mode, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, i.adjustedRegion(), sr, [graphics.ShaderImageCount - 1][2]float32{}, shader.shader, uniforms, options.FillRule == EvenOdd, false) + i.image.DrawTriangles(srcs, vs, is, affine.ColorMIdentity{}, mode, graphicsdriver.FilterNearest, graphicsdriver.AddressUnsafe, i.adjustedRegion(), sr, [graphics.ShaderImageCount - 1][2]float32{}, shader.shader, uniforms, options.FillRule == EvenOdd, filter != graphicsdriver.FilterLinear) } // DrawTrianglesShaderOptions represents options for DrawTrianglesShader. diff --git a/internal/mipmap/mipmap.go b/internal/mipmap/mipmap.go index f5f92e67a..b2409d6b3 100644 --- a/internal/mipmap/mipmap.go +++ b/internal/mipmap/mipmap.go @@ -89,13 +89,13 @@ func (m *Mipmap) DrawTriangles(srcs [graphics.ShaderImageCount]*Mipmap, vertices dy2 := vertices[n*indices[3*i+2]+1] sx2 := vertices[n*indices[3*i+2]+2] sy2 := vertices[n*indices[3*i+2]+3] - if l := mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1, filter); level > l { + if l := mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1); level > l { level = l } - if l := mipmapLevelFromDistance(dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, filter); level > l { + if l := mipmapLevelFromDistance(dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2); level > l { level = l } - if l := mipmapLevelFromDistance(dx2, dy2, dx0, dy0, sx2, sy2, sx0, sy0, filter); level > l { + if l := mipmapLevelFromDistance(dx2, dy2, dx0, dy0, sx2, sy2, sx0, sy0); level > l { level = l } } @@ -232,7 +232,7 @@ func (m *Mipmap) disposeMipmaps() { } // mipmapLevel returns an appropriate mipmap level for the given distance. -func mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1 float32, filter graphicsdriver.Filter) int { +func mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1 float32) int { const maxLevel = 6 d := (dx1-dx0)*(dx1-dx0) + (dy1-dy0)*(dy1-dy0) @@ -252,10 +252,6 @@ func mipmapLevelFromDistance(dx0, dy0, dx1, dy1, sx0, sy0, sx1, sy1 float32, fil return 0 } - if filter != graphicsdriver.FilterLinear { - return 0 - } - level := 0 for scale < 0.25 { level++