doUpdate checks scene Needs flags to do whatever updating is required. returns false if already updating. This is the main update call made by the RenderWindow at FPS frequency.
()
| 167 | // returns false if already updating. |
| 168 | // This is the main update call made by the RenderWindow at FPS frequency. |
| 169 | func (sc *Scene) doUpdate() bool { |
| 170 | if sc.updating { |
| 171 | return false |
| 172 | } |
| 173 | sc.updating = true // prevent rendering |
| 174 | defer func() { sc.updating = false }() |
| 175 | |
| 176 | rc := sc.renderContext() |
| 177 | |
| 178 | if sc.showIter < sceneShowIters { |
| 179 | sc.needsLayout = true |
| 180 | sc.showIter++ |
| 181 | } |
| 182 | |
| 183 | switch { |
| 184 | case rc.rebuild: |
| 185 | pr := profile.Start("rebuild") |
| 186 | sc.doRebuild() |
| 187 | sc.needsLayout = false |
| 188 | sc.sceneNeedsRender = false |
| 189 | sc.imageUpdated = true |
| 190 | pr.End() |
| 191 | case sc.lastRender.needsRestyle(rc): |
| 192 | pr := profile.Start("restyle") |
| 193 | sc.applyStyleScene() |
| 194 | sc.layoutRenderScene() |
| 195 | sc.needsLayout = false |
| 196 | sc.sceneNeedsRender = false |
| 197 | sc.imageUpdated = true |
| 198 | sc.lastRender.saveRender(rc) |
| 199 | pr.End() |
| 200 | case sc.needsLayout: |
| 201 | pr := profile.Start("layout") |
| 202 | sc.layoutRenderScene() |
| 203 | sc.needsLayout = false |
| 204 | sc.sceneNeedsRender = false |
| 205 | sc.imageUpdated = true |
| 206 | pr.End() |
| 207 | case sc.sceneNeedsRender: |
| 208 | pr := profile.Start("render") |
| 209 | sc.doNeedsRender() |
| 210 | sc.sceneNeedsRender = false |
| 211 | sc.imageUpdated = true |
| 212 | pr.End() |
| 213 | default: |
| 214 | return false |
| 215 | } |
| 216 | |
| 217 | if sc.showIter == sceneShowIters { // end of first pass |
| 218 | sc.showIter++ |
| 219 | if !sc.prefSizing { |
| 220 | sc.Events.activateStartFocus() |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | return true |
| 225 | } |
| 226 |
nothing calls this directly
no test coverage detected