Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
RenderCoordinator.h File Reference
#include <array>
#include <chrono>
#include <cstdint>
#include <functional>
#include <limits>
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "donner/base/Box.h"
#include "donner/base/Path.h"
#include "donner/editor/AsyncRenderer.h"
#include "donner/editor/AsyncSVGDocument.h"
#include "donner/editor/CompositedPresentation.h"
#include "donner/editor/DocumentPixelSampler.h"
#include "donner/editor/FrameCostBreakdown.h"
#include "donner/editor/FramePresentation.h"
#include "donner/editor/GlTextureCache.h"
#include "donner/editor/OverlayRenderer.h"
#include "donner/editor/PresentationRenderScheduler.h"
#include "donner/editor/SelectionAabb.h"
#include "donner/editor/ViewportInteractionController.h"
Include dependency graph for RenderCoordinator.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::DocumentPixelCaptureIdentity
 Identity shared by a worker pixel request and its accepted presentation. More...
struct  donner::editor::DocumentPixelCapture
 One immutable document-only pixel capture retained while the picker is armed. More...
struct  donner::editor::PresentationRepairIdentity
 Stable repair inputs, excluding allocation counters that cannot make a retry productive. More...
struct  donner::editor::RenderAttemptIdentity
 What a posted render request asked the worker for, as far as deciding whether a later request would repeat it. More...
class  donner::editor::NothingToPresentRetry
 Paces re-posting a render request whose worker result had nothing to present. More...
class  donner::editor::RenderCoordinator
 Owns the advanced editor's renderer-side orchestration: async rendering, overlay rasterization, composited drag presentation, and selection-bounds cache promotion. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Typedefs

using donner::editor::FramePresentationAdmission = std::function<bool(const FramePresentation&)>
 Prepare renderer-owned resources before publishing a sealed frame; false retains the old frame.

Functions

bool donner::editor::ShouldPresentCompositedPreviewForViewport (const RenderResult::CompositedPreview &preview, const Vector2i &viewportDesiredCanvas)
 Return true when a composited preview may be presented against the current viewport.
bool donner::editor::PresentationRepairNeedsCoverage (FramePresentationFailure buildFailure, FramePresentationFailure adoptionFailure)
 Return true when a frame repair must render more document coverage.
std::uint64_t donner::editor::PostReleaseSettleTargetVersion (std::uint64_t currentFrameVersion, bool hasPendingMutations)
 Return the document version a released drag must settle against.
bool donner::editor::ShouldDeferSelectedViewportRefresh (Entity selectedEntity, bool hasActiveDrag, std::uint64_t currentVersion, std::uint64_t displayedDocVersion, bool hasCachedPresentation, bool rasterViewportSettled, bool needsOverviewInfill, bool pendingSelectedLayerRasterization)
 Return true when selected-layer prewarm can wait for the viewport to settle.
bool donner::editor::ShouldUseSelectedPrewarmRasterViewport (Entity selectedEntity, bool requestOverviewInfill, bool rasterViewportBounded, bool selectionOnlyPrewarmMayTriggerRender, bool hasIndependentRenderReason, bool hasCompleteVisibleCachedCoverage, Vector2i visibleOutputSizePx, Vector2i prewarmOutputSizePx)
 Return true when selected-layer overdraw should replace the base raster viewport.
bool donner::editor::ShouldClearPendingSelectedLayerRasterization (const std::optional< RenderRequest::DragPreview > &representedDragPreview, Entity pendingEntity, std::uint64_t resultVersion, std::uint64_t pendingVersion)
 Return true when a render result satisfies a pending selected-layer rasterization.
bool donner::editor::CompositedPreviewClearsPendingSelectedLayerRasterization (const RenderResult::CompositedPreview &preview, Entity pendingEntity, std::uint64_t resultVersion, std::uint64_t pendingVersion)
 A complete forced render clears stale selected pixels whether they landed in a movable layer or in the selection's owning compositor tiles.
std::optional< SelectTool::ActiveDragPreview > donner::editor::OverlayRepresentedDragPreviewForPresentation (const std::optional< SelectTool::ActiveDragPreview > &activeDragPreview, const std::optional< SelectTool::ActiveDragPreview > &displayedDragPreview, bool hasPresentableActiveDragTarget)
 Return the drag transform that overlay chrome should represent in the current presentation frame.
Transform2d donner::editor::OverlayDocumentFromSourceDragPreview (const std::optional< SelectTool::ActiveDragPreview > &sourceDragPreview, const std::optional< SelectTool::ActiveDragPreview > &targetDragPreview)
 Return the document transform that projects geometry from one drag frame onto another.
std::optional< SelectTool::ActiveGesturePreview > donner::editor::OverlayGesturePreviewForPresentation (const std::optional< SelectTool::ActiveGesturePreview > &activeGesturePreview, const std::optional< SelectTool::ActiveDragPreview > &liveDragPreview, const std::optional< SelectTool::ActiveDragPreview > &representedDragPreview)
 Project live gesture chrome, including the selection size/angle chip, to the overlay state.

Function Documentation

◆ OverlayDocumentFromSourceDragPreview()

Transform2d donner::editor::OverlayDocumentFromSourceDragPreview ( const std::optional< SelectTool::ActiveDragPreview > & sourceDragPreview,
const std::optional< SelectTool::ActiveDragPreview > & targetDragPreview )
nodiscard

Return the document transform that projects geometry from one drag frame onto another.

Parameters
sourceDragPreviewDrag transform represented by the source geometry.
targetDragPreviewDrag transform the presented content represents.

◆ OverlayGesturePreviewForPresentation()

std::optional< SelectTool::ActiveGesturePreview > donner::editor::OverlayGesturePreviewForPresentation ( const std::optional< SelectTool::ActiveGesturePreview > & activeGesturePreview,
const std::optional< SelectTool::ActiveDragPreview > & liveDragPreview,
const std::optional< SelectTool::ActiveDragPreview > & representedDragPreview )
nodiscard

Project live gesture chrome, including the selection size/angle chip, to the overlay state.

Parameters
activeGesturePreviewLive gesture preview from the select tool.
liveDragPreviewLive drag transform currently applied to the DOM.
representedDragPreviewDrag transform the overlay/content presentation represents.

◆ OverlayRepresentedDragPreviewForPresentation()

std::optional< SelectTool::ActiveDragPreview > donner::editor::OverlayRepresentedDragPreviewForPresentation ( const std::optional< SelectTool::ActiveDragPreview > & activeDragPreview,
const std::optional< SelectTool::ActiveDragPreview > & displayedDragPreview,
bool hasPresentableActiveDragTarget )
nodiscard

Return the drag transform that overlay chrome should represent in the current presentation frame.

Parameters
activeDragPreviewActive drag transform used by the presenter when a drag target tile is available.
displayedDragPreviewDrag transform represented by the currently cached content.
hasPresentableActiveDragTargetTrue when the presenter can draw a matching drag target tile this frame.

◆ PostReleaseSettleTargetVersion()

std::uint64_t donner::editor::PostReleaseSettleTargetVersion ( std::uint64_t currentFrameVersion,
bool hasPendingMutations )
nodiscard

Return the document version a released drag must settle against.

Parameters
currentFrameVersionLast flushed document frame version at mouse-up.
hasPendingMutationsTrue when the release left DOM mutations queued for the next flush.

◆ PresentationRepairNeedsCoverage()

bool donner::editor::PresentationRepairNeedsCoverage ( FramePresentationFailure buildFailure,
FramePresentationFailure adoptionFailure )
nodiscard

Return true when a frame repair must render more document coverage.

A frame can lack more than one proof at once. A result rejected for a missing overview still needs that coverage when the frame build reports another failure first, such as selection geometry that is not yet captured; otherwise an active drag never requests the overview.

Parameters
buildFailureMissing proof reported by the frame build, or None.
adoptionFailureMissing proof that rejected the latest worker result, or None.

◆ ShouldClearPendingSelectedLayerRasterization()

bool donner::editor::ShouldClearPendingSelectedLayerRasterization ( const std::optional< RenderRequest::DragPreview > & representedDragPreview,
Entity pendingEntity,
std::uint64_t resultVersion,
std::uint64_t pendingVersion )
nodiscard

Return true when a render result satisfies a pending selected-layer rasterization.

Parameters
representedDragPreviewDrag-preview metadata carried by the completed render result.
pendingEntitySelected entity whose stale layer pixels must be refreshed.
resultVersionDocument frame version represented by the completed render result.
pendingVersionDocument frame version at which the pending refresh was requested.

◆ ShouldDeferSelectedViewportRefresh()

bool donner::editor::ShouldDeferSelectedViewportRefresh ( Entity selectedEntity,
bool hasActiveDrag,
std::uint64_t currentVersion,
std::uint64_t displayedDocVersion,
bool hasCachedPresentation,
bool rasterViewportSettled,
bool needsOverviewInfill,
bool pendingSelectedLayerRasterization )
nodiscard

Return true when selected-layer prewarm can wait for the viewport to settle.

Parameters
selectedEntitySelected compositable entity, or entt::null.
hasActiveDragTrue while a drag preview is active.
currentVersionCurrent document frame version.
displayedDocVersionDocument frame version currently presented.
hasCachedPresentationTrue when any current presentation texture is already cached. The selected layer may still be warming; the existing full presentation is sufficient to keep zoom responsive while that stale prewarm is cancelled.
rasterViewportSettledTrue when the viewport has passed the commit delay.
needsOverviewInfillTrue when a bounded viewport still needs overview coverage.
pendingSelectedLayerRasterizationTrue when selected-layer pixels are known stale.

◆ ShouldPresentCompositedPreviewForViewport()

bool donner::editor::ShouldPresentCompositedPreviewForViewport ( const RenderResult::CompositedPreview & preview,
const Vector2i & viewportDesiredCanvas )
nodiscard

Return true when a composited preview may be presented against the current viewport.

Full-canvas previews may stretch across transient canvas-size changes. Split composited previews carry per-tile raster bounds, so presenting them against a different canvas epoch can flash stale high-resolution tiles in the wrong place during zoom/drag races.

Parameters
previewWorker-produced composited preview.
viewportDesiredCanvasCanvas size implied by the current UI-frame viewport.

◆ ShouldUseSelectedPrewarmRasterViewport()

bool donner::editor::ShouldUseSelectedPrewarmRasterViewport ( Entity selectedEntity,
bool requestOverviewInfill,
bool rasterViewportBounded,
bool selectionOnlyPrewarmMayTriggerRender,
bool hasIndependentRenderReason,
bool hasCompleteVisibleCachedCoverage,
Vector2i visibleOutputSizePx,
Vector2i prewarmOutputSizePx )
nodiscard

Return true when selected-layer overdraw should replace the base raster viewport.

Direct worker surfaces disable selection-only prewarming because the UI thread cannot consume a promoted texture. They still use overdraw when a drag or another real invalidation needs a worker render.

Parameters
selectedEntitySelected compositable entity, or entt::null.
requestOverviewInfillTrue when the request is reserved for full-document overview fill.
rasterViewportBoundedTrue when the base raster only covers the visible viewport.
selectionOnlyPrewarmMayTriggerRenderBackend policy for idle selection cache misses.
hasIndependentRenderReasonTrue when drag, document invalidation, forced rasterization, or retry already requires a worker request.
hasCompleteVisibleCachedCoverageTrue when the currently presented tiles already cover the visible raster at its requested pixel scale. Enlarging the raster in this state would invalidate every cached static segment before the first pointer move.
visibleOutputSizePxSize of the visible raster.
prewarmOutputSizePxSize of the proposed enlarged selection raster.