Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::compositor::MandatoryHintDetector Class Reference

Subsystem that publishes Mandatory CompositorHint entries for SVG features that force isolated compositing. More...

#include "donner/svg/compositor/MandatoryHintDetector.h"

Public Member Functions

 MandatoryHintDetector ()=default
 Default constructor. Acts on every mandatory signal (MandatoryHintScope::All).
 MandatoryHintDetector (MandatoryHintScope scope)
 Construct with an explicit signal scope. See MandatoryHintScope.
 ~MandatoryHintDetector ()=default
 Destructor. Drops all outstanding hints via ScopedCompositorHint RAII.
 MandatoryHintDetector (const MandatoryHintDetector &)=delete
MandatoryHintDetector & operator= (const MandatoryHintDetector &)=delete
 MandatoryHintDetector (MandatoryHintDetector &&) noexcept=default
MandatoryHintDetector & operator= (MandatoryHintDetector &&) noexcept=default
void reconcile (Registry &registry)
 Walk all entities with RenderingInstanceComponent; publish a Mandatory hint on each entity whose instance exhibits a mandatory-compositing feature (opacity < 1, filter, mask, mix-blend-mode, isolation) and drop hints for entities that no longer qualify.
void clear ()
 Drop all held hints. Callers use this when the registry is being reset (e.g. CompositorController::resetAllLayers) so stale hints don't linger into the rebuilt document.
void releaseAllHintsNoClean ()
 Defuse every outstanding hint's registry pointer, then drop them. Used from CompositorController::resetAllLayers when the underlying document has been replaced in place - the old Registry was destroyed and a new one constructed at the same storage address, so the hints' cached Registry* now points at a live object that knows nothing about the old entity IDs. Running ~ScopedCompositorHint normally would call registry.valid(old_entity) and SIGSEGV inside entt's sparse-set lookup. The old CompositorHintComponents went down with the old entity space, so there's nothing to clean up; just stop the dtors from touching the rebuilt registry.
void rebuildForReplacedDocument (Registry &newRegistry)
 Rebuild the hint set against a new entity space after a structurally- identical setDocument. The detector's hints are derived from RenderingInstanceComponent features (opacity < 1, filter, mask, isolation...) - rather than surgical-remap the old hint set, we release the stale hints (they point into a destroyed entt sparse set) and run reconcile() against the new registry. The detector's reconcile is deterministic on the ECS state, so a structurally-identical re-parse yields the identical hint set, keyed on the new entity ids.
const MandatoryHintDetectorStats & stats () const
 Stats from the most recent reconcile() call. Zeroed on entry.

Detailed Description

Subsystem that publishes Mandatory CompositorHint entries for SVG features that force isolated compositing.

Under MandatoryHintScope::All (the default), a RenderingInstanceComponent qualifies for a mandatory hint when any of the following is true:

  • isolatedLayer == true (covers opacity < 1, mix-blend-mode, isolation: isolate).
  • resolvedFilter.has_value() (SVG filter).
  • mask.has_value() (SVG mask).

Under MandatoryHintScope::FilterOnly, only the filter signal qualifies; the other signals render through the driver's inline isolation path.

Other fallback-inducing features (clipPath, markers, external paint servers) intentionally do NOT force a mandatory promotion - that's the narrower classification handled by CompositorController::detectFallbackReasons.

The detector owns one ScopedCompositorHint per currently-qualifying entity. reconcile() diffs the current qualifying set against the held hints so that running it twice in a row on an unchanged registry is a no-op.

Non-copyable; movable. The internal hint map is movable and moves preserve the scoped hints (moved-from handles are inert per ScopedCompositorHint's RAII contract).

Member Function Documentation

◆ reconcile()

void donner::svg::compositor::MandatoryHintDetector::reconcile ( Registry & registry)

Walk all entities with RenderingInstanceComponent; publish a Mandatory hint on each entity whose instance exhibits a mandatory-compositing feature (opacity < 1, filter, mask, mix-blend-mode, isolation) and drop hints for entities that no longer qualify.

Idempotent: running reconcile twice in a row with no ECS changes produces no hint churn.

Parameters
registryRegistry to inspect.

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