mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/restorable: integrate ReadPixels into internal/atlas
Updates #805
This commit is contained in:
parent
c5d0ec3de7
commit
e804f9e58c
@ -546,8 +546,15 @@ func (i *Image) readPixels(graphicsDriver graphicsdriver.Graphics, pixels []byte
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
r := i.regionWithPadding()
|
if err := i.backend.restorable.Image.ReadPixels(graphicsDriver, []graphicsdriver.PixelsArgs{
|
||||||
return i.backend.restorable.ReadPixels(graphicsDriver, pixels, region.Add(r.Min))
|
{
|
||||||
|
Pixels: pixels,
|
||||||
|
Region: region.Add(i.regionWithPadding().Min),
|
||||||
|
},
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deallocate deallocates the internal state.
|
// Deallocate deallocates the internal state.
|
||||||
|
@ -144,15 +144,3 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageCount]*Image, vertices [
|
|||||||
}
|
}
|
||||||
i.Image.DrawTriangles(imgs, vertices, indices, blend, dstRegion, srcRegions, shader.shader, uniforms, fillRule)
|
i.Image.DrawTriangles(imgs, vertices, indices, blend, dstRegion, srcRegions, shader.shader, uniforms, fillRule)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Image) ReadPixels(graphicsDriver graphicsdriver.Graphics, pixels []byte, region image.Rectangle) error {
|
|
||||||
if err := i.Image.ReadPixels(graphicsDriver, []graphicsdriver.PixelsArgs{
|
|
||||||
{
|
|
||||||
Pixels: pixels,
|
|
||||||
Region: region,
|
|
||||||
},
|
|
||||||
}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user