mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-10-10 02:10:12 +08:00
internal/graphicsdriver: replace Pixels with ReadPixels
Now preparing a byte slice is the caller's responsibility.
This commit is contained in:
@@ -236,7 +236,7 @@ func (c *context) bindFramebufferImpl(f framebufferNative) {
|
||||
gl.bindFramebuffer.Invoke(gles.FRAMEBUFFER, js.Value(f))
|
||||
}
|
||||
|
||||
func (c *context) framebufferPixels(f *framebuffer, width, height int) []byte {
|
||||
func (c *context) framebufferPixels(buf []byte, f *framebuffer, width, height int) {
|
||||
gl := c.gl
|
||||
|
||||
c.bindFramebuffer(f.native)
|
||||
@@ -244,8 +244,7 @@ func (c *context) framebufferPixels(f *framebuffer, width, height int) []byte {
|
||||
l := 4 * width * height
|
||||
p := jsutil.TemporaryUint8ArrayFromUint8Slice(l, nil)
|
||||
gl.readPixels.Invoke(0, 0, width, height, gles.RGBA, gles.UNSIGNED_BYTE, p)
|
||||
|
||||
return uint8ArrayToSlice(p, l)
|
||||
copy(buf, uint8ArrayToSlice(p, l))
|
||||
}
|
||||
|
||||
func (c *context) framebufferPixelsToBuffer(f *framebuffer, buffer buffer, width, height int) {
|
||||
|
Reference in New Issue
Block a user