mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/graphicscommand: bug fix: 0-sized image was included in dumped internal images
Updates #2270
This commit is contained in:
parent
b53c686017
commit
d66c552912
@ -15,6 +15,7 @@
|
|||||||
package graphicscommand
|
package graphicscommand
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"io"
|
"io"
|
||||||
"sort"
|
"sort"
|
||||||
@ -204,9 +205,8 @@ func (i *Image) dumpName(path string) string {
|
|||||||
//
|
//
|
||||||
// This is for testing usage.
|
// This is for testing usage.
|
||||||
func (i *Image) dumpTo(w io.Writer, graphicsDriver graphicsdriver.Graphics, blackbg bool, rect image.Rectangle) error {
|
func (i *Image) dumpTo(w io.Writer, graphicsDriver graphicsdriver.Graphics, blackbg bool, rect image.Rectangle) error {
|
||||||
// Screen image cannot be dumped.
|
|
||||||
if i.screen {
|
if i.screen {
|
||||||
return nil
|
return fmt.Errorf("graphicscommand: a screen image cannot be dumped")
|
||||||
}
|
}
|
||||||
|
|
||||||
pix := make([]byte, 4*i.width*i.height)
|
pix := make([]byte, 4*i.width*i.height)
|
||||||
|
@ -63,6 +63,11 @@ func DumpImages(images []*Image, graphicsDriver graphicsdriver.Graphics, dir str
|
|||||||
zw := zip.NewWriter(buf)
|
zw := zip.NewWriter(buf)
|
||||||
|
|
||||||
for _, img := range images {
|
for _, img := range images {
|
||||||
|
// Screen image cannot be dumped.
|
||||||
|
if img.screen {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
f, err := zw.Create(img.dumpName("*.png"))
|
f, err := zw.Create(img.dumpName("*.png"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user