diff --git a/internal/graphicscommand/command.go b/internal/graphicscommand/command.go index e8dbb8b42..215f6f6aa 100644 --- a/internal/graphicscommand/command.go +++ b/internal/graphicscommand/command.go @@ -466,7 +466,7 @@ func mightOverlapDstRegions(vertices1, vertices2 []float32) bool { // writePixelsCommand represents a command to replace pixels of an image. type writePixelsCommand struct { dst *Image - args []*graphicsdriver.PixelsArgs + args []graphicsdriver.PixelsArgs } func (c *writePixelsCommand) String() string { diff --git a/internal/graphicscommand/image.go b/internal/graphicscommand/image.go index 5e27c08ca..cd01f807a 100644 --- a/internal/graphicscommand/image.go +++ b/internal/graphicscommand/image.go @@ -43,7 +43,7 @@ type Image struct { // have its graphicsdriver.Image. id int - bufferedWP []*graphicsdriver.PixelsArgs + bufferedWritePixelsArgs []graphicsdriver.PixelsArgs } var nextID = 1 @@ -93,19 +93,20 @@ func NewImage(width, height int, screenFramebuffer bool) *Image { } func (i *Image) flushBufferedWritePixels() { - if len(i.bufferedWP) == 0 { + if len(i.bufferedWritePixelsArgs) == 0 { return } c := &writePixelsCommand{ dst: i, - args: i.bufferedWP, + args: i.bufferedWritePixelsArgs, } currentCommandQueue().Enqueue(c) - i.bufferedWP = nil + + i.bufferedWritePixelsArgs = nil } func (i *Image) Dispose() { - i.bufferedWP = nil + i.bufferedWritePixelsArgs = nil c := &disposeImageCommand{ target: i, } @@ -178,7 +179,7 @@ func (i *Image) ReadPixels(graphicsDriver graphicsdriver.Graphics, buf []byte, r } func (i *Image) WritePixels(pixels []byte, region image.Rectangle) { - i.bufferedWP = append(i.bufferedWP, &graphicsdriver.PixelsArgs{ + i.bufferedWritePixelsArgs = append(i.bufferedWritePixelsArgs, graphicsdriver.PixelsArgs{ Pixels: pixels, Region: region, }) diff --git a/internal/graphicsdriver/directx/image11_windows.go b/internal/graphicsdriver/directx/image11_windows.go index 7387dd79d..9d9e75266 100644 --- a/internal/graphicsdriver/directx/image11_windows.go +++ b/internal/graphicsdriver/directx/image11_windows.go @@ -130,7 +130,7 @@ func (i *image11) ReadPixels(buf []byte, region image.Rectangle) error { return nil } -func (i *image11) WritePixels(args []*graphicsdriver.PixelsArgs) error { +func (i *image11) WritePixels(args []graphicsdriver.PixelsArgs) error { for _, a := range args { i.graphics.deviceContext.UpdateSubresource(unsafe.Pointer(i.texture), 0, &_D3D11_BOX{ left: uint32(a.Region.Min.X), diff --git a/internal/graphicsdriver/directx/image12_windows.go b/internal/graphicsdriver/directx/image12_windows.go index 0adf1c7f0..cd9b6af18 100644 --- a/internal/graphicsdriver/directx/image12_windows.go +++ b/internal/graphicsdriver/directx/image12_windows.go @@ -149,7 +149,7 @@ func (i *image12) ReadPixels(buf []byte, region image.Rectangle) error { return nil } -func (i *image12) WritePixels(args []*graphicsdriver.PixelsArgs) error { +func (i *image12) WritePixels(args []graphicsdriver.PixelsArgs) error { if i.screen { return errors.New("directx: WritePixels cannot be called on the screen") } diff --git a/internal/graphicsdriver/graphics.go b/internal/graphicsdriver/graphics.go index 1704540f5..31db7a3ab 100644 --- a/internal/graphicsdriver/graphics.go +++ b/internal/graphicsdriver/graphics.go @@ -68,7 +68,7 @@ type Image interface { Dispose() IsInvalidated() bool ReadPixels(buf []byte, region image.Rectangle) error - WritePixels(args []*PixelsArgs) error + WritePixels(args []PixelsArgs) error } type ImageID int diff --git a/internal/graphicsdriver/metal/graphics_darwin.go b/internal/graphicsdriver/metal/graphics_darwin.go index 92b6e28ab..da1c966da 100644 --- a/internal/graphicsdriver/metal/graphics_darwin.go +++ b/internal/graphicsdriver/metal/graphics_darwin.go @@ -831,7 +831,7 @@ func (i *Image) ReadPixels(buf []byte, region image.Rectangle) error { return nil } -func (i *Image) WritePixels(args []*graphicsdriver.PixelsArgs) error { +func (i *Image) WritePixels(args []graphicsdriver.PixelsArgs) error { g := i.graphics g.flushRenderCommandEncoderIfNeeded() diff --git a/internal/graphicsdriver/opengl/image.go b/internal/graphicsdriver/opengl/image.go index 826a13209..e75d6170d 100644 --- a/internal/graphicsdriver/opengl/image.go +++ b/internal/graphicsdriver/opengl/image.go @@ -131,7 +131,7 @@ func (i *Image) ensureStencilBuffer() error { return nil } -func (i *Image) WritePixels(args []*graphicsdriver.PixelsArgs) error { +func (i *Image) WritePixels(args []graphicsdriver.PixelsArgs) error { if i.screen { return errors.New("opengl: WritePixels cannot be called on the screen") }