Skip to content

Commit

Permalink
chore: Simplify freya-renderer crate
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Feb 4, 2024
1 parent fe1d10a commit 5d6f3bb
Show file tree
Hide file tree
Showing 7 changed files with 377 additions and 422 deletions.
18 changes: 9 additions & 9 deletions crates/core/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ use freya_dom::prelude::FreyaDOM;
use freya_engine::prelude::*;
use torin::prelude::Area;

/// Render the layout
pub fn process_render<HookOptions>(
/// Call the render function for the nodes that should be rendered.
pub fn process_render<RenderOptions>(
viewports: &Viewports,
dom: &FreyaDOM,
fdom: &FreyaDOM,
font_collection: &mut FontCollection,
layers: &Layers,
hook_options: &mut HookOptions,
render_hook: impl Fn(&FreyaDOM, &NodeId, &Area, &mut FontCollection, &Viewports, &mut HookOptions),
render_options: &mut RenderOptions,
render_fn: impl Fn(&FreyaDOM, &NodeId, &Area, &mut FontCollection, &Viewports, &mut RenderOptions),
) {
// Render all the layers from the bottom to the top
for (_, layer) in layers.layers() {
'elements: for node_id in layer {
let node_viewports = viewports.get(node_id);
let layout = dom.layout();
let layout = fdom.layout();
let areas = layout.get(*node_id);

if let Some(areas) = areas {
Expand All @@ -34,13 +34,13 @@ pub fn process_render<HookOptions>(
}

// Render the element
render_hook(
dom,
render_fn(
fdom,
node_id,
&areas.visible_area(),
font_collection,
viewports,
hook_options,
render_options,
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/renderer/src/accessibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ impl AccessKitManager {
}
}

/// Process an Accessibility event
pub fn process_accessibility_event(&mut self, window: &Window, event: &WindowEvent) {
/// Process an accessibility event
pub fn process_accessibility_event(&mut self, event: &WindowEvent, window: &Window) {
self.accessibility_adapter.process_event(window, event)
}

Expand Down
Loading

0 comments on commit 5d6f3bb

Please sign in to comment.