mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 17:05:38 +00:00
ui: support Window.Draw(nil) in OpsReader
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -231,15 +231,22 @@ func (b BlockOp) Add(o *Ops) {
|
|||||||
|
|
||||||
// Reset start reading from the op list.
|
// Reset start reading from the op list.
|
||||||
func (r *OpsReader) Reset(ops *Ops) {
|
func (r *OpsReader) Reset(ops *Ops) {
|
||||||
|
r.stack = r.stack[:0]
|
||||||
|
r.pc = pc{}
|
||||||
|
r.ops = nil
|
||||||
|
if ops == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
if n := len(ops.stack); n > 0 {
|
if n := len(ops.stack); n > 0 {
|
||||||
panic(fmt.Errorf("%d Begin(s) not matched with End", n))
|
panic(fmt.Errorf("%d Begin(s) not matched with End", n))
|
||||||
}
|
}
|
||||||
r.ops = &ops.ops
|
r.ops = &ops.ops
|
||||||
r.stack = r.stack[:0]
|
|
||||||
r.pc = pc{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *OpsReader) Decode() (EncodedOp, bool) {
|
func (r *OpsReader) Decode() (EncodedOp, bool) {
|
||||||
|
if r.ops == nil {
|
||||||
|
return EncodedOp{}, false
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
if len(r.stack) > 0 {
|
if len(r.stack) > 0 {
|
||||||
b := r.stack[len(r.stack)-1]
|
b := r.stack[len(r.stack)-1]
|
||||||
|
|||||||
Reference in New Issue
Block a user