mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 17:05:38 +00:00
ui/app: (wasm) replace TypedArrayOf with the CopyBytes* API
syscall/js.TypedArrayOf is going away in Go 1.13 and is replaced by the CopyBytesToGo, CopyBytesToJS. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -245,9 +245,7 @@ func (f *Functions) RenderbufferStorage(target, internalformat Enum, width, heig
|
||||
func (f *Functions) ReadPixels(x, y, width, height int, format, ty Enum, data []byte) {
|
||||
f.resizeByteBuffer(len(data))
|
||||
f.Ctx.Call("readPixels", x, y, width, height, int(format), int(ty), f.byteBuf)
|
||||
sub := f.byteBuf.Call("subarray", 0, len(data))
|
||||
d := js.TypedArrayOf(data)
|
||||
d.Call("set", sub)
|
||||
js.CopyBytesToGo(data, f.byteBuf)
|
||||
}
|
||||
func (f *Functions) Scissor(x, y, width, height int32) {
|
||||
f.Ctx.Call("scissor", x, y, width, height)
|
||||
@@ -294,9 +292,7 @@ func (f *Functions) byteArrayOf(data []byte) js.Value {
|
||||
return js.Null()
|
||||
}
|
||||
f.resizeByteBuffer(len(data))
|
||||
s := js.TypedArrayOf(data)
|
||||
f.byteBuf.Call("set", s)
|
||||
s.Release()
|
||||
js.CopyBytesToJS(f.byteBuf, data)
|
||||
return f.byteBuf
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user