1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-22 18:28:53 -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;
// get units for level 0 and level 1 labels
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
const ImPlotDateTimeSpec fmt0 = GetDateTimeFmt(TimeFormatLevel0, unit0);
const ImPlotDateTimeSpec fmt1 = GetDateTimeFmt(TimeFormatLevel1, unit1);

View File

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