Skip to content

Commit 1eb22d6

Browse files
CidolfasAlex Swaimbrenocq
authored
fix: missing IMPLOT_API in some functions (#549)
* Add IMPLOT_API to constructors and functions of ImPlotPoint, ImPlotRange, and ImPlotRect * fix: missing IMPLOT_API in locator functions --------- Co-authored-by: Alex Swaim <[email protected]> Co-authored-by: Breno Cunha Queiroz <[email protected]>
1 parent 42639bd commit 1eb22d6

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

implot.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,11 @@ enum ImPlotBin_ {
472472
IM_MSVC_RUNTIME_CHECKS_OFF
473473
struct ImPlotPoint {
474474
double x, y;
475-
constexpr ImPlotPoint() : x(0.0), y(0.0) { }
476-
constexpr ImPlotPoint(double _x, double _y) : x(_x), y(_y) { }
477-
constexpr ImPlotPoint(const ImVec2& p) : x((double)p.x), y((double)p.y) { }
478-
double& operator[] (size_t idx) { IM_ASSERT(idx == 0 || idx == 1); return ((double*)(void*)(char*)this)[idx]; }
479-
double operator[] (size_t idx) const { IM_ASSERT(idx == 0 || idx == 1); return ((const double*)(const void*)(const char*)this)[idx]; }
475+
IMPLOT_API constexpr ImPlotPoint() : x(0.0), y(0.0) { }
476+
IMPLOT_API constexpr ImPlotPoint(double _x, double _y) : x(_x), y(_y) { }
477+
IMPLOT_API constexpr ImPlotPoint(const ImVec2& p) : x((double)p.x), y((double)p.y) { }
478+
IMPLOT_API double& operator[] (size_t idx) { IM_ASSERT(idx == 0 || idx == 1); return ((double*)(void*)(char*)this)[idx]; }
479+
IMPLOT_API double operator[] (size_t idx) const { IM_ASSERT(idx == 0 || idx == 1); return ((const double*)(const void*)(const char*)this)[idx]; }
480480
#ifdef IMPLOT_POINT_CLASS_EXTRA
481481
IMPLOT_POINT_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h
482482
// to convert back and forth between your math types and ImPlotPoint.
@@ -487,25 +487,25 @@ IM_MSVC_RUNTIME_CHECKS_RESTORE
487487
// Range defined by a min/max value.
488488
struct ImPlotRange {
489489
double Min, Max;
490-
constexpr ImPlotRange() : Min(0.0), Max(0.0) { }
491-
constexpr ImPlotRange(double _min, double _max) : Min(_min), Max(_max) { }
492-
bool Contains(double value) const { return value >= Min && value <= Max; }
493-
double Size() const { return Max - Min; }
494-
double Clamp(double value) const { return (value < Min) ? Min : (value > Max) ? Max : value; }
490+
IMPLOT_API constexpr ImPlotRange() : Min(0.0), Max(0.0) { }
491+
IMPLOT_API constexpr ImPlotRange(double _min, double _max) : Min(_min), Max(_max) { }
492+
IMPLOT_API bool Contains(double value) const { return value >= Min && value <= Max; }
493+
IMPLOT_API double Size() const { return Max - Min; }
494+
IMPLOT_API double Clamp(double value) const { return (value < Min) ? Min : (value > Max) ? Max : value; }
495495
};
496496

497497
// Combination of two range limits for X and Y axes. Also an AABB defined by Min()/Max().
498498
struct ImPlotRect {
499499
ImPlotRange X, Y;
500-
constexpr ImPlotRect() : X(0.0,0.0), Y(0.0,0.0) { }
501-
constexpr ImPlotRect(double x_min, double x_max, double y_min, double y_max) : X(x_min, x_max), Y(y_min, y_max) { }
502-
bool Contains(const ImPlotPoint& p) const { return Contains(p.x, p.y); }
503-
bool Contains(double x, double y) const { return X.Contains(x) && Y.Contains(y); }
504-
ImPlotPoint Size() const { return ImPlotPoint(X.Size(), Y.Size()); }
505-
ImPlotPoint Clamp(const ImPlotPoint& p) { return Clamp(p.x, p.y); }
506-
ImPlotPoint Clamp(double x, double y) { return ImPlotPoint(X.Clamp(x),Y.Clamp(y)); }
507-
ImPlotPoint Min() const { return ImPlotPoint(X.Min, Y.Min); }
508-
ImPlotPoint Max() const { return ImPlotPoint(X.Max, Y.Max); }
500+
IMPLOT_API constexpr ImPlotRect() : X(0.0,0.0), Y(0.0,0.0) { }
501+
IMPLOT_API constexpr ImPlotRect(double x_min, double x_max, double y_min, double y_max) : X(x_min, x_max), Y(y_min, y_max) { }
502+
IMPLOT_API bool Contains(const ImPlotPoint& p) const { return Contains(p.x, p.y); }
503+
IMPLOT_API bool Contains(double x, double y) const { return X.Contains(x) && Y.Contains(y); }
504+
IMPLOT_API ImPlotPoint Size() const { return ImPlotPoint(X.Size(), Y.Size()); }
505+
IMPLOT_API ImPlotPoint Clamp(const ImPlotPoint& p) { return Clamp(p.x, p.y); }
506+
IMPLOT_API ImPlotPoint Clamp(double x, double y) { return ImPlotPoint(X.Clamp(x),Y.Clamp(y)); }
507+
IMPLOT_API ImPlotPoint Min() const { return ImPlotPoint(X.Min, Y.Min); }
508+
IMPLOT_API ImPlotPoint Max() const { return ImPlotPoint(X.Max, Y.Max); }
509509
};
510510

511511
// Plot style structure

implot_internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,10 +1700,10 @@ static inline int Formatter_Time(double, char* buff, int size, void* data) {
17001700
// [SECTION] Locator
17011701
//------------------------------------------------------------------------------
17021702

1703-
void Locator_Default(ImPlotTicker& ticker, const ImPlotRange& range, float pixels, bool vertical, ImPlotFormatter formatter, void* formatter_data);
1704-
void Locator_Time(ImPlotTicker& ticker, const ImPlotRange& range, float pixels, bool vertical, ImPlotFormatter formatter, void* formatter_data);
1705-
void Locator_Log10(ImPlotTicker& ticker, const ImPlotRange& range, float pixels, bool vertical, ImPlotFormatter formatter, void* formatter_data);
1706-
void Locator_SymLog(ImPlotTicker& ticker, const ImPlotRange& range, float pixels, bool vertical, ImPlotFormatter formatter, void* formatter_data);
1703+
IMPLOT_API void Locator_Default(ImPlotTicker& ticker, const ImPlotRange& range, float pixels, bool vertical, ImPlotFormatter formatter, void* formatter_data);
1704+
IMPLOT_API void Locator_Time(ImPlotTicker& ticker, const ImPlotRange& range, float pixels, bool vertical, ImPlotFormatter formatter, void* formatter_data);
1705+
IMPLOT_API void Locator_Log10(ImPlotTicker& ticker, const ImPlotRange& range, float pixels, bool vertical, ImPlotFormatter formatter, void* formatter_data);
1706+
IMPLOT_API void Locator_SymLog(ImPlotTicker& ticker, const ImPlotRange& range, float pixels, bool vertical, ImPlotFormatter formatter, void* formatter_data);
17071707

17081708
} // namespace ImPlot
17091709

0 commit comments

Comments
 (0)