mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 01:15:35 +00:00
op: change Defer to only restore transformation state
It turns out restoring all operation state from the moment Defer is executed is too much; for example, a right-click pop-up needs the transformation, but not the current clip. Change Defer to only restore the transformation, and reset all other state. Other combinations may be needed in future; we'll deal with them then, possibly by exposing the load state mask. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+3
-3
@@ -72,11 +72,11 @@ func DecodeSave(data []byte) int {
|
||||
return int(bo.Uint32(data[1:]))
|
||||
}
|
||||
|
||||
// DecodeLoad decodes the state id of a restore op.
|
||||
func DecodeLoad(data []byte) int {
|
||||
// DecodeLoad decodes the state id and mask of a load op.
|
||||
func DecodeLoad(data []byte) (int, opconst.StateMask) {
|
||||
if opconst.OpType(data[0]) != opconst.TypeLoad {
|
||||
panic("invalid op")
|
||||
}
|
||||
bo := binary.LittleEndian
|
||||
return int(bo.Uint32(data[1:]))
|
||||
return int(bo.Uint32(data[2:])), opconst.StateMask(data[1])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user