diff --git a/implot.cpp b/implot.cpp index 7b7924c..d6d3fbf 100644 --- a/implot.cpp +++ b/implot.cpp @@ -83,11 +83,6 @@ You can read releases logs https://github.com/epezent/implot/releases for more d #define ImDrawFlags_RoundCornersAll ImDrawCornerFlags_All #endif -// Support for pre-1.84 versions. ImPool's GetSize() -> GetBufSize() -#if (IMGUI_VERSION_NUM < 18303) -#define GetBufSize GetSize // A little bit ugly since 'GetBufSize' could technically be used elsewhere (but currently isn't). Could use a proxy define if needed. -#endif - // Global plot context ImPlotContext* GImPlot = NULL; @@ -4483,7 +4478,7 @@ void ShowMetricsWindow(bool* p_popen) { if (ImHasFlag(plot->Flags, ImPlotFlags_YAxis2)) fg.AddRect(plot->YAxis[1].HoverRect.Min, plot->YAxis[1].HoverRect.Max, IM_COL32(0,255,0,255)); if (ImHasFlag(plot->Flags, ImPlotFlags_YAxis3)) - fg.AddRect(plot->YAxis[3].HoverRect.Min, plot->YAxis[2].HoverRect.Max, IM_COL32(0,255,0,255)); + fg.AddRect(plot->YAxis[2].HoverRect.Min, plot->YAxis[2].HoverRect.Max, IM_COL32(0,255,0,255)); } } for (int p = 0; p < n_subplots; ++p) { diff --git a/implot_demo.cpp b/implot_demo.cpp index 46e7269..a1ef3e2 100644 --- a/implot_demo.cpp +++ b/implot_demo.cpp @@ -2063,9 +2063,10 @@ struct BenchData { enum BenchMode { Line = 0, - Shaded = 1, - Scatter = 2, - Bars = 3 + LineG = 1, + Shaded = 2, + Scatter = 3, + Bars = 4 }; struct BenchRecord { @@ -2074,6 +2075,11 @@ struct BenchRecord { ImVector Data; }; +ImPlotPoint BenchmarkGetter(void* data, int idx) { + float* values = (float*)data; + return ImPlotPoint(idx, values[idx]); +} + void ShowBenchmarkTool() { static const int max_items = 500; static BenchData items[max_items]; @@ -2083,7 +2089,7 @@ void ShowBenchmarkTool() { static int F = 0; static double t1, t2; static int mode = BenchMode::Line; - const char* names[] = {"Line","Shaded","Scatter","Bars"}; + const char* names[] = {"Line","LineG","Shaded","Scatter","Bars"}; static ImVector records; @@ -2143,6 +2149,14 @@ void ShowBenchmarkTool() { ImGui::PopID(); } } + else if (mode == BenchMode::LineG) { + for (int i = 0; i < L; ++i) { + ImGui::PushID(i); + ImPlot::SetNextLineStyle(items[i].Col); + ImPlot::PlotLineG("##item",BenchmarkGetter,items[i].Data,1000); + ImGui::PopID(); + } + } else if (mode == BenchMode::Shaded) { for (int i = 0; i < L; ++i) { ImGui::PushID(i); diff --git a/implot_internal.h b/implot_internal.h index 2ea2e52..c7f40ea 100644 --- a/implot_internal.h +++ b/implot_internal.h @@ -42,6 +42,11 @@ #error Must include implot.h before implot_internal.h #endif +// Support for pre-1.84 versions. ImPool's GetSize() -> GetBufSize() +#if (IMGUI_VERSION_NUM < 18303) +#define GetBufSize GetSize +#endif + //----------------------------------------------------------------------------- // [SECTION] Constants //----------------------------------------------------------------------------- @@ -1264,8 +1269,8 @@ void FillRange(ImVector& buffer, int n, T vmin, T vmax) { // Offsets and strides a data buffer template -static inline T OffsetAndStride(const T* data, int idx, int count, int offset, int stride) { - idx = ImPosMod(offset + idx, count); +static inline T OffsetAndStride(const T* data, int idx, int , int , int stride) { + // idx = ImPosMod(offset + idx, count); return *(const T*)(const void*)((const unsigned char*)data + (size_t)idx * stride); } diff --git a/implot_items.cpp b/implot_items.cpp index dc9d6bd..4abbb64 100644 --- a/implot_items.cpp +++ b/implot_items.cpp @@ -47,12 +47,6 @@ #define ImDrawFlags_RoundCornersAll ImDrawCornerFlags_All #endif -// Support for pre-1.84 versions. ImPool's GetSize() -> GetBufSize() -#if (IMGUI_VERSION_NUM < 18303) -#define GetBufSize GetSize // A little bit ugly since 'GetBufSize' could technically be used elsewhere (but currently isn't). Could use a proxy define if needed. -#endif - - namespace ImPlot { //-----------------------------------------------------------------------------