mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
ebiten: optimization: use FilterNearest for an integer scale
Updates #1772
This commit is contained in:
parent
8b7273b74a
commit
352fd76312
@ -16,6 +16,7 @@ package ebiten
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver"
|
||||
)
|
||||
@ -107,9 +108,12 @@ func (c *gameForUI) Draw(screenScale float64, offsetX, offsetY float64, needsCle
|
||||
|
||||
// filterScreen works with >=1 scale, but does not well with <1 scale.
|
||||
// Use regular FilterLinear instead so far (#669).
|
||||
if s >= 1 {
|
||||
switch {
|
||||
case math.Floor(s) == s:
|
||||
op.Filter = FilterNearest
|
||||
case s > 1:
|
||||
op.Filter = filterScreen
|
||||
} else {
|
||||
default:
|
||||
op.Filter = FilterLinear
|
||||
}
|
||||
c.screen.DrawImage(c.offscreen, op)
|
||||
|
Loading…
Reference in New Issue
Block a user