diff --git a/tools/replay/lib/ui_helpers.py b/tools/replay/lib/ui_helpers.py index 242e5a0c25..1cf8ee99a8 100644 --- a/tools/replay/lib/ui_helpers.py +++ b/tools/replay/lib/ui_helpers.py @@ -173,8 +173,14 @@ def init_plots(arr, name_to_arr_idx, plot_xlims, plot_ylims, plot_names, plot_co fig.canvas.flush_events() raw_data = renderer.tostring_rgb() - #print fig.canvas.get_width_height() - plot_surface = pygame.image.frombuffer(raw_data, fig.canvas.get_width_height(), "RGB").convert() + x, y = fig.canvas.get_width_height() + + # Handle 2x scaling + if len(raw_data) == 4 * x * y * 3: + plot_surface = pygame.image.frombuffer(raw_data, (2*x, 2*y), "RGB").convert() + plot_surface = pygame.transform.scale(plot_surface, (x, y)) + else: + plot_surface = pygame.image.frombuffer(raw_data, fig.canvas.get_width_height(), "RGB").convert() return plot_surface return draw_plots