|
|
Donner 0.5.1
Embeddable browser-grade SVG2 engine
|
Phase 2.5 producer that pre-chunks a document into a small number of layers based on per-subtree rasterization cost. More...
#include "donner/svg/compositor/ComplexityBucketer.h"
Public Member Functions | |
| ComplexityBucketer (ComplexityBucketerConfig config={}) | |
| ComplexityBucketer (const ComplexityBucketer &)=delete | |
| ComplexityBucketer & | operator= (const ComplexityBucketer &)=delete |
| ComplexityBucketer (ComplexityBucketer &&) noexcept=default | |
| ComplexityBucketer & | operator= (ComplexityBucketer &&) noexcept=default |
| void | reconcile (Registry ®istry) |
| Recompute the bucket partition for the current document state. | |
| void | clear () |
| Drop all held bucket hints. Callers use this when the registry is being reset (e.g. CompositorController::resetAllLayers) so stale bucket assignments don't linger into the rebuilt document. | |
| void | releaseAllHintsNoClean () |
| Like clear(), but releases each hint's registry pointer first so the dtor becomes a no-op. Used from CompositorController::resetAll
Layers after setDocument has replaced the entity space โ the old CompositorHintComponents are already gone, and registry.valid() on the rebuilt registry would SIGSEGV against the stale entity IDs. | |
| void | rebuildForReplacedDocument (Registry &newRegistry) |
| Rebuild the bucket hint set against a new entity space after a structurally-identical setDocument. Mirror of MandatoryHint
Detector::rebuildForReplacedDocument โ release the stale hints without touching the old entity ids, then run reconcile on the new registry. Because the bucketer's decisions are a pure function of the render-tree shape + complexity costs, a structurally-equal document produces the identical bucket set keyed on the new ids. | |
| const ComplexityBucketerStats & | stats () const |
| const ComplexityBucketerConfig & | config () const |
Phase 2.5 producer that pre-chunks a document into a small number of layers based on per-subtree rasterization cost.
Runs at document load and on structural rebuild (both callers control when; this class is stateless between calls other than its held hints).
Algorithm (see 0025-composited_rendering.md ยง Complexity Bucketing):
Restricting candidates to top-level root children sidesteps the deferred-pop correctness concern: by construction, top-level children have no isolation / clip / filter / mask ancestor (other than the root itself), so bucketing them cannot split a group that must stay atomic.
v1 simplifications (tracked for Phase 2.5 followups):
Held hints map (bucketHints_) is non-copyable, movable. The RAII pattern ensures dropped entries clean up their CompositorHintComponent entries.
| void donner::svg::compositor::ComplexityBucketer::reconcile | ( | Registry & | registry | ) |
Recompute the bucket partition for the current document state.
Intended to be called on document load and when RenderTreeState::needsFullRebuild is true. Publishes new ComplexityBucket hints, drops stale ones, and updates stats. Idempotent on unchanged input.