Repository navigation
web: DRC markers in saved images - #11946
jorge-ferreira-pii wants to merge 10 commits into
Conversation
gui.i and gui.tcl now build without Qt too, so a script can call the gui:: commands in any build; with no window they still log GUI-0001. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
With no Qt window, the display controls act on a copy of the Qt display-control tree kept by the web viewer, with the same paths and defaults. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
save_image -web draws what the gui:: display controls chose, and a path that does not end in .png gets .png added. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
… groups Overlays and labels are drawn over the finished image at its own scale, and select and the highlight groups work with no window. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
gui::select_marker_category works with no window, and save_image -web draws the markers as the DRC viewer does. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
There was a problem hiding this comment.
Code Review
This pull request introduces a headless ScriptView backend for the web viewer, enabling GUI-related Tcl commands to function and drive save_image -web when OpenROAD is compiled without Qt support or running without a window. This ensures parity in display controls, selections, and DRC markers between the Qt GUI and the web tile renderer. The feedback suggests simplifying a SWIG typemap in gui.i, optimizing a nested loop in display_control_tree.cpp to avoid O(N^2) complexity, and correcting a loop in script_view.cpp to ensure renderer controls are not silently ignored when setting display control colors.
|
|
||
| %typemap(out) std::vector<std::string> { | ||
| Tcl_Obj* list = Tcl_NewListObj(0, nullptr); | ||
| for (const std::string& item : *(&$1)) { |
| for (odb::dbLib* lib : db->getLibs()) { | ||
| for (odb::dbSite* site : lib->getSites()) { | ||
| const std::string path = std::string(kRows) + "/" + site->getName(); | ||
| if (leaves_.contains(path)) { | ||
| continue; | ||
| } | ||
| bool on = true; | ||
| if (const Leaf* rows = find(kRows)) { | ||
| on = rows->visible.value_or(false); | ||
| } else { | ||
| for (const auto& [other, leaf] : leaves_) { | ||
| if (other.starts_with(std::string(kRows) + "/")) { | ||
| on = on && leaf.visible.value_or(false); | ||
| } | ||
| } | ||
| } | ||
| leaves_.erase(kRows); | ||
| addLeaf(path, {.visible = on, .selectable = on}); | ||
| } | ||
| } |
There was a problem hiding this comment.
Computing the default visibility on and erasing kRows inside the nested loops is inefficient and leads to quadratic complexity
bool on = true;\n if (const Leaf* rows = find(kRows)) {\n on = rows->visible.value_or(false);\n } else {\n for (const auto& [other, leaf] : leaves_) {\n if (other.starts_with(std::string(kRows) + \"/\")) {\n on = on && leaf.visible.value_or(false);\n }\n }\n }\n leaves_.erase(kRows);\n\n for (odb::dbLib* lib : db->getLibs()) {\n for (odb::dbSite* site : lib->getSites()) {\n const std::string path = std::string(kRows) + \"/\" + site->getName();\n if (leaves_.contains(path)) {\n continue;\n }\n addLeaf(path, {.visible = on, .selectable = on});\n }\n }| bool found = !matchLocked(tree_, name, /*selectable=*/false).empty(); | ||
| bool ignored = false; | ||
| for (const auto& [path, leaf] : tree_.leaves()) { | ||
| if (!DisplayControlTree::matches(name, path)) { | ||
| continue; | ||
| } | ||
| found = true; | ||
| if (path == kBackground) { | ||
| background_ = color; | ||
| } else { | ||
| ignored = true; | ||
| } | ||
| } |
There was a problem hiding this comment.
When setting the display control color, matchLocked is used to find matching controls (including renderer controls). However, the subsequent loop only iterates over tree_.leaves(). If the matched control is a renderer control, it won't be in tree_.leaves(), meaning ignored remains false and the color change is silently ignored without any warning. We can fix this by iterating over the matches returned by matchLocked directly.
const std::vector<Match> matches = matchLocked(tree_, name, /*selectable=*/false);\n bool found = !matches.empty();\n bool ignored = false;\n for (const Match& match : matches) {\n if (match.path == kBackground) {\n background_ = color;\n } else {\n ignored = true;\n }\n }Rows' default for new sites is worked out once, a renderer control's color is reported as ignored, and RendererControls::check takes the default for a path it has no value for. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
…age-script-view Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
A renderer's control is shared with the browser, so save_image -display_option cannot set it for one image; say so instead of ignoring it. Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
…save-image-overlays Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
…e-image-drc Signed-off-by: Jorge Ferreira <jorge.ferreira@precisioninno.com>
Part 5 of 9 for #11488. On top of PR #11945.
gui::select_marker_category now works without a window, and saved images draw the markers as Qt's DRC viewer does: a white outline with a crosshatch, and an X for a marker too small to see. Qt and the web now share that drawing code.