Skip to content

Commit 946ff29

Browse files
draw nodes on top of edges
1 parent 21a57fd commit 946ff29

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

vpr/src/draw/draw_mux.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,10 @@ ezgl::rectangle draw_mux(ezgl::point2d origin, e_side orientation, float height,
7878
*/
7979
void draw_mux_with_size(ezgl::point2d origin, e_side orientation, float height, int size, int transparency_factor, ezgl::renderer* g) {
8080
g->set_color(ezgl::YELLOW, transparency_factor);
81-
auto bounds = draw_mux(origin, orientation, height, g);
81+
ezgl::rectangle bounds = draw_mux(origin, orientation, height, g);
8282

8383
g->set_color(ezgl::BLACK, transparency_factor);
84-
g->draw_text(bounds.center(), std::to_string(size), bounds.width(),
85-
bounds.height());
84+
g->draw_text(bounds.center(), std::to_string(size), bounds.width(), bounds.height());
8685
}
8786

8887
#endif

vpr/src/draw/draw_rr.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,32 @@ void draw_rr(ezgl::renderer* g) {
5151

5252
g->set_line_dash(ezgl::line_dash::none);
5353

54+
// Node colors by types
55+
// colors for Source, Sink, IPIN, OPIN, CHANX, CHANY, MUX, CHANZ
56+
constexpr vtr::array<e_rr_type, ezgl::color, (size_t)e_rr_type::NUM_RR_TYPES> node_colors{DEFAULT_RR_NODE_COLOR,
57+
DEFAULT_RR_NODE_COLOR,
58+
ezgl::PURPLE,
59+
ezgl::PINK,
60+
DEFAULT_RR_NODE_COLOR,
61+
DEFAULT_RR_NODE_COLOR,
62+
DEFAULT_RR_NODE_COLOR,
63+
DEFAULT_RR_NODE_COLOR};
64+
65+
// Draw edges first, then nodes, so that nodes (and their muxes) are rendered on top of edges.
5466
for (const RRNodeId inode : device_ctx.rr_graph.nodes()) {
67+
draw_rr_edges(inode, g);
68+
}
5569

70+
for (const RRNodeId inode : device_ctx.rr_graph.nodes()) {
5671
e_rr_type node_type = rr_graph.node_type(inode);
5772
bool inter_cluster_node = is_inter_cluster_node(rr_graph, inode);
5873
bool node_highlighted = draw_state->draw_rr_node[inode].node_highlighted;
5974

60-
// Node colors by types
61-
// colors for Source, Sink, IPIN, OPIN, CHANX, CHANY, MUX, CHANZ
62-
constexpr vtr::array<e_rr_type, ezgl::color, (size_t)e_rr_type::NUM_RR_TYPES> node_colors{DEFAULT_RR_NODE_COLOR, DEFAULT_RR_NODE_COLOR, ezgl::PURPLE, ezgl::PINK, DEFAULT_RR_NODE_COLOR, DEFAULT_RR_NODE_COLOR, DEFAULT_RR_NODE_COLOR, DEFAULT_RR_NODE_COLOR};
63-
6475
// Apply color to the node if it is not highlighted
6576
if (!node_highlighted) {
6677
draw_state->draw_rr_node[inode].color = node_colors.at(node_type);
6778
}
6879

69-
draw_rr_edges(inode, g);
70-
7180
if (!node_highlighted) {
7281
// Draw channel nodes if enabled
7382
if ((node_type == e_rr_type::CHANX || node_type == e_rr_type::CHANY) && !draw_state->draw_channel_nodes) {

0 commit comments

Comments
 (0)