From 196a0243c51de7cef1027fd09d596f483502df68 Mon Sep 17 00:00:00 2001 From: Max Schwarz Date: Thu, 21 Apr 2022 05:19:39 +0200 Subject: [PATCH] ImPlotAxis::WillRender(): return false if axis is disabled (#350) This saves a few CPU cycles in SetupFinish(), which otherwise formats tick labels & spacing for disabled axes. --- implot_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/implot_internal.h b/implot_internal.h index 7895afe..12b94be 100644 --- a/implot_internal.h +++ b/implot_internal.h @@ -796,7 +796,7 @@ struct ImPlotAxis inline bool HasGridLines() const { return !ImHasFlag(Flags, ImPlotAxisFlags_NoGridLines); } inline bool HasTickLabels() const { return !ImHasFlag(Flags, ImPlotAxisFlags_NoTickLabels); } inline bool HasTickMarks() const { return !ImHasFlag(Flags, ImPlotAxisFlags_NoTickMarks); } - inline bool WillRender() const { return HasGridLines() || HasTickLabels() || HasTickMarks(); } + inline bool WillRender() const { return Enabled && (HasGridLines() || HasTickLabels() || HasTickMarks()); } inline bool IsOpposite() const { return ImHasFlag(Flags, ImPlotAxisFlags_Opposite); } inline bool IsInverted() const { return ImHasFlag(Flags, ImPlotAxisFlags_Invert); } inline bool IsForeground() const { return ImHasFlag(Flags, ImPlotAxisFlags_Foreground); }