Skip to content

Commit

Permalink
Remove compute_layout_with_rounding method
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Oct 19, 2023
1 parent e259a8a commit dbb73f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
9 changes: 0 additions & 9 deletions src/compute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ pub fn compute_layout(tree: &mut impl PartialLayoutTree, root: NodeId, available
*tree.get_final_layout_mut(root) = layout;
}

/// Updates the stored layout of the provided `node` and its children and then rounds the result to an exact pixel grid
pub fn compute_layout_with_rounding(tree: &mut impl LayoutTree, root: NodeId, available_space: Size<AvailableSpace>) {
// Perform the layout
compute_layout(tree, root, available_space);

// Recursively round the layout's of this node and all children
round_layout(tree, root);
}

/// Updates the stored layout of the provided `node` and its children
pub(crate) fn compute_cached_layout<Tree: PartialLayoutTree + ?Sized>(
tree: &mut Tree,
Expand Down
12 changes: 5 additions & 7 deletions src/tree/taffy_tree/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
use slotmap::{DefaultKey, SlotMap, SparseSecondaryMap};

use crate::geometry::Size;
use crate::prelude::LayoutTree;
use crate::style::{AvailableSpace, Display, Style};
use crate::tree::{Cache, Layout, LayoutInput, LayoutOutput, NodeData, NodeId, PartialLayoutTree, RunMode};
use crate::tree::{Cache, Layout, LayoutInput, LayoutOutput, LayoutTree, NodeData, NodeId, PartialLayoutTree, RunMode};
use crate::util::debug::{debug_log, debug_log_node};
use crate::util::sys::{new_vec_with_capacity, ChildrenVec, Vec};

Expand All @@ -16,7 +15,7 @@ use crate::compute::compute_block_layout;
use crate::compute::compute_flexbox_layout;
#[cfg(feature = "grid")]
use crate::compute::compute_grid_layout;
use crate::compute::{compute_hidden_layout, compute_layout, compute_layout_with_rounding, compute_leaf_layout};
use crate::compute::{compute_hidden_layout, compute_layout, compute_leaf_layout, round_layout};

use super::{TaffyError, TaffyResult};

Expand Down Expand Up @@ -491,7 +490,7 @@ impl<NodeContext> Taffy<NodeContext> {
/// Updates the stored layout of the provided `node` and its children
pub fn compute_layout_with_measure<MeasureFunction>(
&mut self,
node: NodeId,
node_id: NodeId,
available_space: Size<AvailableSpace>,
measure_function: MeasureFunction,
) -> Result<(), TaffyError>
Expand All @@ -500,10 +499,9 @@ impl<NodeContext> Taffy<NodeContext> {
{
let use_rounding = self.config.use_rounding;
let mut taffy_view = TaffyView { taffy: self, measure_function };
compute_layout(&mut taffy_view, node_id, available_space);
if use_rounding {
compute_layout_with_rounding(&mut taffy_view, node, available_space);
} else {
compute_layout(&mut taffy_view, node, available_space);
round_layout(&mut taffy_view, node_id);
}
Ok(())
}
Expand Down

0 comments on commit dbb73f3

Please sign in to comment.