internal/graphicscommand: rename pixelCommand -> readPixelCommand

Updates #1995
This commit is contained in:
Hajime Hoshi 2022-08-08 01:46:45 +09:00
parent c382cb2b05
commit 869147eda0
2 changed files with 6 additions and 6 deletions

View File

@ -533,21 +533,21 @@ func (c *replacePixelsCommand) Exec(graphicsDriver graphicsdriver.Graphics, inde
return nil return nil
} }
type pixelsCommand struct { type readPixelsCommand struct {
result []byte result []byte
img *Image img *Image
} }
// Exec executes a pixelsCommand. // Exec executes a readPixelsCommand.
func (c *pixelsCommand) Exec(graphicsDriver graphicsdriver.Graphics, indexOffset int) error { func (c *readPixelsCommand) Exec(graphicsDriver graphicsdriver.Graphics, indexOffset int) error {
if err := c.img.image.ReadPixels(c.result); err != nil { if err := c.img.image.ReadPixels(c.result); err != nil {
return err return err
} }
return nil return nil
} }
func (c *pixelsCommand) String() string { func (c *readPixelsCommand) String() string {
return fmt.Sprintf("pixels: image: %d", c.img.id) return fmt.Sprintf("read-pixels: image: %d", c.img.id)
} }
// disposeImageCommand represents a command to dispose an image. // disposeImageCommand represents a command to dispose an image.

View File

@ -155,7 +155,7 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageCount]*Image, offsets [g
// ReadPixels returns an error when an error happens in the graphics driver. // ReadPixels returns an error when an error happens in the graphics driver.
func (i *Image) ReadPixels(graphicsDriver graphicsdriver.Graphics, buf []byte) error { func (i *Image) ReadPixels(graphicsDriver graphicsdriver.Graphics, buf []byte) error {
i.resolveBufferedReplacePixels() i.resolveBufferedReplacePixels()
c := &pixelsCommand{ c := &readPixelsCommand{
img: i, img: i,
result: buf, result: buf,
} }