Skip to content

Commit e808d51

Browse files
reserve 4 elements in mux_polygon vector
1 parent 8c711d0 commit e808d51

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

vpr/src/draw/draw_basic.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,7 @@ void drawplace(ezgl::renderer* g) {
165165
if (draw_state->draw_block_text) {
166166
/* Draw text if the space has parts of the netlist */
167167
if (bnum) {
168-
std::string name = cluster_ctx.clb_nlist.block_name(
169-
bnum)
170-
+ vtr::string_fmt(" (#%zu)", size_t(bnum));
168+
std::string name = cluster_ctx.clb_nlist.block_name(bnum) + vtr::string_fmt(" (#%zu)", size_t(bnum));
171169

172170
g->draw_text(center, name.c_str(), abs_clb_bbox.width(),
173171
abs_clb_bbox.height());

vpr/src/draw/draw_mux.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,32 @@
1919
//Draws a mux, height/width define the bounding box, scale [0.,1.] controls the slope of the muxes sides
2020
ezgl::rectangle draw_mux(ezgl::point2d origin, e_side orientation, float height, float width, float scale, ezgl::renderer* g) {
2121
std::vector<ezgl::point2d> mux_polygon;
22+
mux_polygon.reserve(4);
2223

2324
switch (orientation) {
2425
case TOP:
25-
//Clock-wise from bottom left
26+
// Clock-wise from bottom left
2627
mux_polygon.emplace_back(origin.x - height / 2, origin.y - width / 2);
2728
mux_polygon.emplace_back(origin.x - (scale * height) / 2, origin.y + width / 2);
2829
mux_polygon.emplace_back(origin.x + (scale * height) / 2, origin.y + width / 2);
2930
mux_polygon.emplace_back(origin.x + height / 2, origin.y - width / 2);
3031
break;
3132
case BOTTOM:
32-
//Clock-wise from bottom left
33+
// Clock-wise from bottom left
3334
mux_polygon.emplace_back(origin.x - (scale * height) / 2, origin.y - width / 2);
3435
mux_polygon.emplace_back(origin.x - height / 2, origin.y + width / 2);
3536
mux_polygon.emplace_back(origin.x + height / 2, origin.y + width / 2);
3637
mux_polygon.emplace_back(origin.x + (scale * height) / 2, origin.y - width / 2);
3738
break;
3839
case LEFT:
39-
//Clock-wise from bottom left
40+
// Clock-wise from bottom left
4041
mux_polygon.emplace_back(origin.x - width / 2, origin.y - (scale * height) / 2);
4142
mux_polygon.emplace_back(origin.x - width / 2, origin.y + (scale * height) / 2);
4243
mux_polygon.emplace_back(origin.x + width / 2, origin.y + height / 2);
4344
mux_polygon.emplace_back(origin.x + width / 2, origin.y - height / 2);
4445
break;
4546
case RIGHT:
46-
//Clock-wise from bottom left
47+
// Clock-wise from bottom left
4748
mux_polygon.emplace_back(origin.x - width / 2, origin.y - height / 2);
4849
mux_polygon.emplace_back(origin.x - width / 2, origin.y + height / 2);
4950
mux_polygon.emplace_back(origin.x + width / 2, origin.y + (scale * height) / 2);
@@ -57,7 +58,7 @@ ezgl::rectangle draw_mux(ezgl::point2d origin, e_side orientation, float height,
5758

5859
ezgl::point2d min((float)mux_polygon[0].x, (float)mux_polygon[0].y);
5960
ezgl::point2d max((float)mux_polygon[0].x, (float)mux_polygon[0].y);
60-
for (const auto& point : mux_polygon) {
61+
for (const ezgl::point2d& point : mux_polygon) {
6162
min.x = std::min((float)min.x, (float)point.x);
6263
min.y = std::min((float)min.y, (float)point.y);
6364
max.x = std::max((float)max.x, (float)point.x);

0 commit comments

Comments
 (0)