mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
all: use bufio.Reader to improve reading speed
This commit is contained in:
parent
563f2e0e0b
commit
ef5ac4175d
@ -15,6 +15,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -81,7 +82,7 @@ func main() {
|
|||||||
fmt.Println("Play the default video. You can specify a video file as an argument.")
|
fmt.Println("Play the default video. You can specify a video file as an argument.")
|
||||||
}
|
}
|
||||||
|
|
||||||
player, err := newMPEGPlayer(in)
|
player, err := newMPEGPlayer(bufio.NewReader(in))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
package mtl_test
|
package mtl_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
@ -147,7 +148,7 @@ func readPNG(name string) (image.Image, error) {
|
|||||||
defer func() {
|
defer func() {
|
||||||
_ = f.Close()
|
_ = f.Close()
|
||||||
}()
|
}()
|
||||||
return png.Decode(f)
|
return png.Decode(bufio.NewReader(f))
|
||||||
}
|
}
|
||||||
|
|
||||||
// imageEq reports whether images m, n are considered equivalent. Two images are considered
|
// imageEq reports whether images m, n are considered equivalent. Two images are considered
|
||||||
|
Loading…
Reference in New Issue
Block a user