1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-26 12:18:52 -05:00

address a few static analysis warnings

This commit is contained in:
Evan Pezent 2022-09-17 13:17:07 -05:00
parent 57149164d5
commit 4ba42f200a
2 changed files with 23 additions and 11 deletions

View File

@ -1193,7 +1193,7 @@ void Locator_Time(ImPlotTicker& ticker, const ImPlotRange& range, float pixels,
(void)vertical; (void)vertical;
// get units for level 0 and level 1 labels // get units for level 0 and level 1 labels
const ImPlotTimeUnit unit0 = GetUnitForRange(range.Size() / (pixels / 100)); // level = 0 (top) const ImPlotTimeUnit unit0 = GetUnitForRange(range.Size() / (pixels / 100)); // level = 0 (top)
const ImPlotTimeUnit unit1 = unit0 + 1; // level = 1 (bottom) const ImPlotTimeUnit unit1 = ImClamp(unit0 + 1, 0, ImPlotTimeUnit_COUNT-1); // level = 1 (bottom)
// get time format specs // get time format specs
const ImPlotDateTimeSpec fmt0 = GetDateTimeFmt(TimeFormatLevel0, unit0); const ImPlotDateTimeSpec fmt0 = GetDateTimeFmt(TimeFormatLevel0, unit0);
const ImPlotDateTimeSpec fmt1 = GetDateTimeFmt(TimeFormatLevel1, unit1); const ImPlotDateTimeSpec fmt1 = GetDateTimeFmt(TimeFormatLevel1, unit1);

View File

@ -437,6 +437,11 @@ struct ImPlotAnnotation {
ImU32 ColorFg; ImU32 ColorFg;
int TextOffset; int TextOffset;
bool Clamp; bool Clamp;
ImPlotAnnotation() {
ColorBg = ColorFg = 0;
TextOffset = 0;
Clamp = false;
}
}; };
// Collection of plot labels // Collection of plot labels
@ -540,6 +545,7 @@ struct ImPlotTick
int Idx; int Idx;
ImPlotTick(double value, bool major, int level, bool show_label) { ImPlotTick(double value, bool major, int level, bool show_label) {
PixelPos = 0;
PlotPos = value; PlotPos = value;
Major = major; Major = major;
ShowLabel = show_label; ShowLabel = show_label;
@ -666,6 +672,7 @@ struct ImPlotAxis
bool Held; bool Held;
ImPlotAxis() { ImPlotAxis() {
ID = 0;
Flags = PreviousFlags = ImPlotAxisFlags_None; Flags = PreviousFlags = ImPlotAxisFlags_None;
Range.Min = 0; Range.Min = 0;
Range.Max = 1; Range.Max = 1;
@ -764,7 +771,7 @@ struct ImPlotAxis
inline void SetAspect(double unit_per_pix) { inline void SetAspect(double unit_per_pix) {
double new_size = unit_per_pix * PixelSize(); double new_size = unit_per_pix * PixelSize();
double delta = (new_size - Range.Size()) * 0.5f; double delta = (new_size - Range.Size()) * 0.5;
if (IsLocked()) if (IsLocked())
return; return;
else if (IsLockedMin() && !IsLockedMax()) else if (IsLockedMin() && !IsLockedMax())
@ -793,7 +800,7 @@ struct ImPlotAxis
Range.Max += delta; Range.Max += delta;
} }
if (z > ConstraintZoom.Max) { if (z > ConstraintZoom.Max) {
double delta = (z - ConstraintZoom.Max) * 0.5f; double delta = (z - ConstraintZoom.Max) * 0.5;
Range.Min += delta; Range.Min += delta;
Range.Max -= delta; Range.Max -= delta;
} }
@ -945,6 +952,7 @@ struct ImPlotItem
ImPlotItem() { ImPlotItem() {
ID = 0; ID = 0;
Color = IM_COL32_WHITE;
NameOffset = -1; NameOffset = -1;
Show = true; Show = true;
SeenThisFrame = false; SeenThisFrame = false;
@ -986,7 +994,7 @@ struct ImPlotItemGroup
ImPool<ImPlotItem> ItemPool; ImPool<ImPlotItem> ItemPool;
int ColormapIdx; int ColormapIdx;
ImPlotItemGroup() { ColormapIdx = 0; } ImPlotItemGroup() { ID = 0; ColormapIdx = 0; }
int GetItemCount() const { return ItemPool.GetBufSize(); } int GetItemCount() const { return ItemPool.GetBufSize(); }
ImGuiID GetItemID(const char* label_id) { return ImGui::GetID(label_id); /* GetIDWithSeed */ } ImGuiID GetItemID(const char* label_id) { return ImGui::GetID(label_id); /* GetIDWithSeed */ }
@ -1129,11 +1137,15 @@ struct ImPlotSubplot {
bool HasTitle; bool HasTitle;
ImPlotSubplot() { ImPlotSubplot() {
ID = 0;
Flags = PreviousFlags = ImPlotSubplotFlags_None;
Rows = Cols = CurrentIdx = 0; Rows = Cols = CurrentIdx = 0;
FrameHovered = false; FrameHovered = false;
Items.Legend.Location = ImPlotLocation_North; Items.Legend.Location = ImPlotLocation_North;
Items.Legend.Flags = ImPlotLegendFlags_Horizontal|ImPlotLegendFlags_Outside; Items.Legend.Flags = ImPlotLegendFlags_Horizontal|ImPlotLegendFlags_Outside;
Items.Legend.CanGoInside = false; Items.Legend.CanGoInside = false;
TempSizes[0] = TempSizes[1] = 0;
FrameHovered = false;
HasTitle = false; HasTitle = false;
} }
}; };