// Stage present dispatcher.
//
// jlStagePresent walks the per-row dirty bands set by drawing primitives
// and asks the port HAL to flip just those rows to the display, then
// resets the dirty state.

#include <stddef.h>

#include "joey/debug.h"
#include "joey/present.h"
#include "port.h"
#include "surfaceInternal.h"


// ----- Public API (alphabetical) -----

void jlStagePresent(void) {
    jlSurfaceT *stage;

    // Direct extern read (finding #10/#17 convention): once per present,
    // so this is consistency rather than a hot-path win.
    stage = gStage;
    if (stage == NULL) {
        return;
    }
    jlpPresent(stage);
    stageDirtyClearAll();
}
