Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::PendingDamage Class Reference

Accumulated repaint damage for one frame, in root/window coordinates. More...

#include <pending_damage.hpp>

Classes

class  Snapshot
 One frame's damage, taken atomically out of a PendingDamage. More...

Public Member Functions

void mark_full ()
 Whole-surface repaint. Any structural change uses this.
void mark (const Rect &root_rect)
 Union a bounded region (root coords) into this frame's damage.
bool is_full () const
bool has_bounds () const
Rect bounds () const
void clear ()
 Called by the host once it has painted and submitted the frame.
Snapshot take ()
 Read this frame's damage AND clear it, in one step.
void restore (const Snapshot &s)
 Put a taken snapshot back after a frame failed to reach its output.

Detailed Description

Accumulated repaint damage for one frame, in root/window coordinates.

Extracted so the WINDOW host and the PLUG-IN host can share one definition of "what changed this frame". Before this existed the state lived only on WindowHost, so View::request_repaint(Rect) had nowhere to put a bounded rect on the plug-in path and discarded it — which meant partial repaint was unreachable for every plug-in editor on every platform, however the host was wired.

The invariants are what make bounded damage safe to ignore or honour:

  • full is STICKY within a frame. A bounded mark after a full one leaves the repaint full. Damage therefore only ever SHRINKS a repaint, never widens one, so a host that never consults bounds() is always correct.
  • An empty/degenerate rect escalates to full rather than being dropped.
  • full starts true: the first frame of any surface is a full repaint.

A frame CONSUMES damage with take(), which reads and clears in one step. Reading the three accessors and then calling clear() separately is how a host ends up clearing a different logical state than the one it painted — most importantly when the frame never reached the screen. A frame that failed puts its snapshot back with restore(), so the damage survives the retry.

Member Function Documentation

◆ bounds()

Rect pulp::view::PendingDamage::bounds ( ) const
inline

◆ clear()

void pulp::view::PendingDamage::clear ( )
inline

Called by the host once it has painted and submitted the frame.

◆ has_bounds()

bool pulp::view::PendingDamage::has_bounds ( ) const
inline

◆ is_full()

bool pulp::view::PendingDamage::is_full ( ) const
inline

◆ mark()

void pulp::view::PendingDamage::mark ( const Rect & root_rect)
inline

Union a bounded region (root coords) into this frame's damage.

◆ mark_full()

void pulp::view::PendingDamage::mark_full ( )
inline

Whole-surface repaint. Any structural change uses this.

◆ restore()

void pulp::view::PendingDamage::restore ( const Snapshot & s)
inline

Put a taken snapshot back after a frame failed to reach its output.

Unions rather than overwrites, so damage marked while the failed frame was in flight is preserved too, and the sticky-full rule still holds: restoring a full snapshot leaves the repaint full regardless of what arrived in the meantime.

◆ take()

Snapshot pulp::view::PendingDamage::take ( )
inline

Read this frame's damage AND clear it, in one step.

The host paints against the returned snapshot. If the frame reaches its intended output, the snapshot is simply dropped. If it does not, the host calls restore() so the next attempt repaints at least as much.


The documentation for this class was generated from the following file: