MCPcopy Create free account
hub / github.com/cogentcore/core / doUpdate

Method doUpdate

core/render.go:169–225  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

167// returns false if already updating.
168// This is the main update call made by the RenderWindow at FPS frequency.
169func (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

Callers

nothing calls this directly

Calls 10

renderContextMethod · 0.95
doRebuildMethod · 0.95
applyStyleSceneMethod · 0.95
layoutRenderSceneMethod · 0.95
StartFunction · 0.92
needsRestyleMethod · 0.80
saveRenderMethod · 0.80
doNeedsRenderMethod · 0.80
activateStartFocusMethod · 0.80
EndMethod · 0.45

Tested by

no test coverage detected