|
|
Donner 0.5.1
Embeddable browser-grade SVG2 engine
|
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. | |
| ~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 ®istry) |
| 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. | |
Subsystem that publishes Mandatory CompositorHint entries for SVG features that force isolated compositing.
A RenderingInstanceComponent qualifies for a mandatory hint when any of the following is true (per the design doc § Mandatory hints):
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).
| 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.
| registry | Registry to inspect. |