web: add Implant/Other layer categories and per-layer fill patterns#10795
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for per-layer fill patterns (such as diagonal, cross, and dots) in the web frontend, mirroring the Qt GUI's rendering behavior. It updates both the JavaScript frontend to manage and persist these pattern choices via cookies and the C++ tile generator backend to parse and apply the patterns when rendering polygons and rectangles. The review feedback focuses on performance and code quality improvements, specifically suggesting to refactor a local lambda into a free function, optimize a modulo operation, and add early returns in the rendering functions when the fill pattern is set to none.
| auto wrap = [](const int v, const int period) { | ||
| return ((v % period) + period) % period; | ||
| }; |
There was a problem hiding this comment.
Helper logic should be defined as a free function in a namespace rather than as a local lambda within a function. Additionally, since period is always positive, we can optimize the modulo operation to avoid a second modulo by using a simple conditional check.
References
- Helper logic should be defined as a free function in a namespace rather than as a local lambda within a function.
| { | ||
| // Tile origin in absolute pixel space, anchoring non-solid patterns. |
There was a problem hiding this comment.
If the fill pattern is set to FillPattern::kNone, we can return early immediately. This avoids performing any polygon scanline setup, edge intersections, sorting, or pixel loops entirely, which is a significant performance win.
| { | |
| // Tile origin in absolute pixel space, anchoring non-solid patterns. | |
| { | |
| if (pattern == FillPattern::kNone) { | |
| return; | |
| } | |
| // Tile origin in absolute pixel space, anchoring non-solid patterns. |
| { | ||
| for (int iy = rect.yMin(); iy < rect.yMax(); ++iy) { |
6f827e1 to
f6b066f
Compare
2.2 Display controls — layers ✅
The whole 2.2 — Display controls — layers area is now ✅. |
|
What was implemented and tested
|
gadfort
left a comment
There was a problem hiding this comment.
I would suggest leaving the Implant and Other categories collapsed when opening.
Also I found it strange that the layer selection was saved between sessions (so when I opened a new design in a new session the fact that only one metal was visible was a little jarring (this behavior differs from the QtGUI where the layer options are not saved between sessions).
Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
…Project#10795) - collapse the Implant and Other layer categories by default - store per-layer visibility/selectability in sessionStorage instead of cookies, so layer options survive the reload that opening a database triggers but reset in a new session (matching the Qt GUI, which does not persist layer options between sessions) - update the GetLayers test golden: getLayers() now returns every tech layer type (22 for Nangate45: +poly/active/OVERLAP) to back the Implant/Other categories and the saveReport prerender Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
f6b066f to
4e74cdb
Compare
Thanks, Peter! Good catch, those details totally flew under my radar. I've just pushed the fixes for the category collapsing and the session saving, and I also fixed the merge conflict. |
Addresses a portion of #10619