@@ -19,10 +19,6 @@ const (
1919 commandDraw
2020)
2121
22- type baseCommand struct {
23- typ int
24- }
25-
2622type clipCommand struct {
2723 rect image.Rectangle
2824}
@@ -50,25 +46,24 @@ type drawCommand struct {
5046
5147type command struct {
5248 typ int
53- base baseCommand // type 0 (TODO)
54- clip clipCommand // type 1
55- rect rectCommand // type 2
56- text textCommand // type 3
57- icon iconCommand // type 4
58- draw drawCommand // type 5
49+ clip clipCommand
50+ rect rectCommand
51+ text textCommand
52+ icon iconCommand
53+ draw drawCommand
5954}
6055
61- // appendCommand adds a new command with type cmd_type to the command list.
56+ // appendCommand adds a new command with type cmdType to the command list.
6257func (c * Context ) appendCommand (cmdType int ) * command {
6358 cmd := command {
6459 typ : cmdType ,
6560 }
66- cmd .base .typ = cmdType
6761 cnt := c .currentRootContainer ()
6862 cnt .commandList = append (cnt .commandList , & cmd )
6963 return & cmd
7064}
7165
66+ // commands returns a sequence of commands from all root containers.
7267func (c * Context ) commands () iter.Seq [* command ] {
7368 return func (yield func (command * command ) bool ) {
7469 for _ , cnt := range c .rootContainers {
@@ -78,24 +73,5 @@ func (c *Context) commands() iter.Seq[*command] {
7873 }
7974 }
8075 }
81- /*if len(c.commandList) == 0 {
82- return
83- }
84-
85- cmd := c.commandList[0]
86- for cmd.idx < len(c.commandList) {
87- if cmd.typ != commandJump {
88- if !yield(cmd) {
89- return
90- }
91- cmd = c.commandList[cmd.idx+1]
92- continue
93- }
94- idx := cmd.jump.dstIdx
95- if idx > len(c.commandList)-1 {
96- return
97- }
98- cmd = c.commandList[idx]
99- }*/
10076 }
10177}
0 commit comments