Skip to content

Commit

Permalink
vaev-driver: Added log output for rendering time.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Aug 22, 2024
1 parent c2c4332 commit ff8598e
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/web/vaev-driver/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ RenderResult render(Dom::Document const &dom, Style::Media const &media, Vec2Px
auto elapsed = Sys::now() - start;
logDebug("style collection time: {}", elapsed);

start = Sys::now();

Style::Computer computer{media, stylebook};
Layout::Tree tree = {
Layout::build(computer, dom),
Expand All @@ -67,9 +69,15 @@ RenderResult render(Dom::Document const &dom, Style::Media const &media, Vec2Px
}
};

elapsed = Sys::now() - start;

logDebug("layout tree build time: {}", elapsed);

start = Sys::now();

Layout::Viewport vp{.small = viewport};

auto height = Layout::computePreferredOuterSize(
auto height = Layout::computePreferredBorderSize(
tree,
tree.root,
{
Expand All @@ -79,6 +87,12 @@ RenderResult render(Dom::Document const &dom, Style::Media const &media, Vec2Px
Axis::VERTICAL
);

elapsed = Sys::now() - start;

logDebug("layout tree measure time: {}", elapsed);

start = Sys::now();

Layout::Box containingBox = {
.borderBox = {vp.small.width, height},
};
Expand All @@ -95,9 +109,17 @@ RenderResult render(Dom::Document const &dom, Style::Media const &media, Vec2Px

auto paintRoot = makeStrong<Paint::Stack>();

elapsed = Sys::now() - start;
logDebug("layout tree layout time: {}", elapsed);

auto paintStart = Sys::now();

Layout::paint(tree.root, *paintRoot);
paintRoot->prepare();

elapsed = Sys::now() - paintStart;
logDebug("layout tree paint time: {}", elapsed);

return {
makeStrong<Layout::Frag>(std::move(tree.root)),
paintRoot,
Expand Down Expand Up @@ -130,7 +152,7 @@ RenderResult render(Dom::Document &dom, Style::Media const &media, Print::PaperS
vp,
};

auto height = Layout::computePreferredOuterSize(
auto height = Layout::computePreferredBorderSize(
tree,
tree.root,
{
Expand Down

0 comments on commit ff8598e

Please sign in to comment.