Cleanup: nodeToView & nodeFromView usage #105469

Closed
Iliya Katushenock wants to merge 5 commits from mod_moder:cleanup_no_to_view_usage into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 9 additions and 24 deletions

View File

@ -45,19 +45,8 @@ static void create_transform_data_for_node(TransData &td,
const float dpi_fac) const float dpi_fac)
{ {
float locx, locy; float locx, locy;
/* Account for parents (nested nodes). */
/* account for parents (nested nodes) */ nodeToView(&node, roundf(node.offsetx), roundf(node.offsety), &locx, &locy);
if (node.parent) {
nodeToView(node.parent,
node.locx + roundf(node.offsetx),
node.locy + roundf(node.offsety),
&locx,
&locy);
}
else {
locx = node.locx + roundf(node.offsetx);
locy = node.locy + roundf(node.offsety);
}
/* use top-left corner as the transform origin for nodes */ /* use top-left corner as the transform origin for nodes */
/* Weirdo - but the node system is a mix of free 2d elements and DPI sensitive UI. */ /* Weirdo - but the node system is a mix of free 2d elements and DPI sensitive UI. */
@ -246,18 +235,14 @@ static void flushTransNodes(TransInfo *t)
loc[0] /= dpi_fac; loc[0] /= dpi_fac;
loc[1] /= dpi_fac; loc[1] /= dpi_fac;
/* account for parents (nested nodes) */ loc[0] -= roundf(node->offsetx);
if (node->parent) { loc[1] -= roundf(node->offsety);
nodeFromView(node->parent, if (const bNode *parent_space = node->parent) {
mod_moder marked this conversation as resolved Outdated

The second parent_space != nullptr is unnecessary here in C++ as far as I know

The second `parent_space != nullptr` is unnecessary here in C++ as far as I know

I do this for greater clarity, but yes, we can consider it redundant

I do this for greater clarity, but yes, we can consider it redundant
loc[0] - roundf(node->offsetx), nodeFromView(parent_space, loc[0], loc[1], &loc[0], &loc[1]);
loc[1] - roundf(node->offsety),
&node->locx,
&node->locy);
}
else {
node->locx = loc[0] - roundf(node->offsetx);
node->locy = loc[1] - roundf(node->offsety);
} }
node->locx = loc[0];
node->locy = loc[1];
} }
/* handle intersection with noodles */ /* handle intersection with noodles */