summaryrefslogtreecommitdiff
path: root/src/stage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stage.c')
-rw-r--r--src/stage.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/stage.c b/src/stage.c
index a714f1f..63afbcb 100644
--- a/src/stage.c
+++ b/src/stage.c
@@ -302,19 +302,33 @@ static void _prepare_stage(stage_t *stage, float alpha, void *render_ctxt)
}
-static void _render_stage(const stage_t *stage, float alpha, void *render_ctxt)
+static void _render_stage(stage_t *stage, float alpha, void *render_ctxt)
{
- float a = alpha * stage->alpha;
+ stage_render_func_ret_t r = STAGE_RENDER_FUNC_RET_CONTINUE;
+ float a;
assert(stage);
+ a = alpha * stage->alpha;
+
if (stage->ops->render_func)
- stage->ops->render_func(stage, stage->object, a, render_ctxt);
+ r = stage->ops->render_func(stage, stage->object, a, render_ctxt);
+
+ switch (r) {
+ case STAGE_RENDER_FUNC_RET_FREE:
+ stage_free(stage);
+ case STAGE_RENDER_FUNC_RET_SKIP:
+ return;
+ case STAGE_RENDER_FUNC_RET_CONTINUE:
+ break;
+ default:
+ assert(0);
+ }
for (int i = 0; i < STAGE_LAYERS_MAX; i++) {
- stage_t *s;
+ stage_t *s, *_s;
- DLL_FOR_EACH_ENTRY(&stage->layers[i], s, stage_t, layer) {
+ DLL_FOR_EACH_ENTRY_SAFE(&stage->layers[i], s, _s, stage_t, layer) {
if (!s->active)
continue;
@@ -342,11 +356,11 @@ int stage_render(stage_t *stage, void *render_ctxt)
_prepare_stage(stage, 1.f, render_ctxt);
if (stage->dirty) {
+ stage->dirty = 0;
+
if (stage->active)
_render_stage(stage, 1.f, render_ctxt);
- stage->dirty = 0;
-
return 1;
}
© All Rights Reserved