mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +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
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"image"
|
||||
"io"
|
||||
"sort"
|
||||
@ -204,9 +205,8 @@ func (i *Image) dumpName(path string) string {
|
||||
//
|
||||
// This is for testing usage.
|
||||
func (i *Image) dumpTo(w io.Writer, graphicsDriver graphicsdriver.Graphics, blackbg bool, rect image.Rectangle) error {
|
||||
// Screen image cannot be dumped.
|
||||
if i.screen {
|
||||
return nil
|
||||
return fmt.Errorf("graphicscommand: a screen image cannot be dumped")
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
for _, img := range images {
|
||||
// Screen image cannot be dumped.
|
||||
if img.screen {
|
||||
continue
|
||||
}
|
||||
|
||||
f, err := zw.Create(img.dumpName("*.png"))
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user