Skip to content

Commit b3627f5

Browse files
remove duplicate code
1 parent 2afc126 commit b3627f5

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

vpr/src/draw/draw.cpp

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,11 @@ void update_screen(ScreenUpdatePriority priority,
301301

302302
strcpy(draw_state->default_message, msg);
303303

304-
if (!draw_state->show_graphics)
304+
if (!draw_state->show_graphics) {
305305
ezgl::set_disable_event_loop(true);
306-
else
306+
} else {
307307
ezgl::set_disable_event_loop(false);
308+
}
308309

309310
bool state_change = false;
310311

@@ -508,18 +509,7 @@ void init_draw_coords(float clb_width, const BlkLocRegistry& blk_loc_registry) {
508509

509510
// Load coordinates of sub-blocks inside the clbs
510511
draw_internal_init_blk();
511-
// Margin beyond edge of the drawn device to extend the visible world
512-
// Setting this to > 0.0 means 'Zoom Fit' leave some fraction of white
513-
// space around the device edges
514-
constexpr float VISIBLE_MARGIN = 0.01;
515-
516-
float draw_width = draw_coords->tile_x[grid.width() - 1] + draw_coords->get_tile_width();
517-
float draw_height = draw_coords->tile_y[grid.height() - 1] + draw_coords->get_tile_height();
518-
519-
initial_world = ezgl::rectangle(
520-
{-VISIBLE_MARGIN * draw_width, -VISIBLE_MARGIN * draw_height},
521-
{(1. + VISIBLE_MARGIN) * draw_width, (1. + VISIBLE_MARGIN)
522-
* draw_height});
512+
523513
#else
524514
(void)clb_width;
525515
(void)blk_loc_registry;
@@ -529,12 +519,16 @@ void init_draw_coords(float clb_width, const BlkLocRegistry& blk_loc_registry) {
529519
#ifndef NO_GRAPHICS
530520

531521
void set_initial_world() {
532-
constexpr float VISIBLE_MARGIN = 0.01;
533522
t_draw_coords* draw_coords = get_draw_coords_vars();
534-
const DeviceContext& device_ctx = g_vpr_ctx.device();
523+
const DeviceGrid& grid = g_vpr_ctx.device().grid;
535524

536-
float draw_width = draw_coords->tile_x[device_ctx.grid.width() - 1] + draw_coords->get_tile_width();
537-
float draw_height = draw_coords->tile_y[device_ctx.grid.height() - 1] + draw_coords->get_tile_width();
525+
// Margin beyond edge of the drawn device to extend the visible world
526+
// Setting this to > 0.0 means 'Zoom Fit' leave some fraction of white
527+
// space around the device edges
528+
constexpr float VISIBLE_MARGIN = 0.01;
529+
530+
float draw_width = draw_coords->tile_x[grid.width() - 1] + draw_coords->get_tile_width();
531+
float draw_height = draw_coords->tile_y[grid.height() - 1] + draw_coords->get_tile_width();
538532

539533
initial_world = ezgl::rectangle(
540534
{-VISIBLE_MARGIN * draw_width, -VISIBLE_MARGIN * draw_height},

0 commit comments

Comments
 (0)