// Stage present.
//
// jlStagePresent flips the library-owned stage (back-buffer) to the
// display. On chunky platforms (IIgs, DOS) this is a direct copy; on
// planar platforms (Amiga, Atari ST) this is a chunky-to-planar
// conversion. Drawing primitives mark per-row dirty ranges on the
// stage as a side effect, so jlStagePresent only touches rows that
// actually changed since the last present. See docs/DESIGN.md.

#ifndef JOEYLIB_PRESENT_H
#define JOEYLIB_PRESENT_H

#include "platform.h"
#include "surface.h"
#include "types.h"

// Flip the dirty regions of the stage to the display, then clear the
// dirty state. Drawing primitives mark dirty as a side effect, so
// callers only need to call jlStagePresent at the end of a frame --
// everything they drew shows up. Rows that nothing touched since the
// last present are skipped by the per-port present using the per-row
// dirty bands.
//
// To present a region you didn't draw with the standard primitives
// (e.g. direct framebuffer poking), call surfaceMarkDirtyRect on
// the same rect first, then jlStagePresent.
void jlStagePresent(void);

#endif
