forked from joejulian/gio
22cd88df9f
The "ui" is redundant and stutters. Signed-off-by: Elias Naur <mail@eliasnaur.com>
24 lines
455 B
Go
24 lines
455 B
Go
// SPDX-License-Identifier: Unlicense OR MIT
|
|
|
|
package ops
|
|
|
|
import (
|
|
"encoding/binary"
|
|
"math"
|
|
|
|
"gioui.org/ui"
|
|
"gioui.org/f32"
|
|
"gioui.org/internal/opconst"
|
|
)
|
|
|
|
func DecodeTransformOp(d []byte) ui.TransformOp {
|
|
bo := binary.LittleEndian
|
|
if opconst.OpType(d[0]) != opconst.TypeTransform {
|
|
panic("invalid op")
|
|
}
|
|
return ui.TransformOp{}.Offset(f32.Point{
|
|
X: math.Float32frombits(bo.Uint32(d[1:])),
|
|
Y: math.Float32frombits(bo.Uint32(d[5:])),
|
|
})
|
|
}
|