diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-06-07 15:36:35 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-06-07 15:55:29 +0200 |
commit | 3c25dfe0e44314cfb51df34a63abda6a1cc78cc1 (patch) | |
tree | 4f1fbc710284c4b9dfa7b00edcba0527acdda3d1 /thirdparty/msdfgen/core | |
parent | ea6a141ffffa6de8a27e2093145ececaaa9aa2f6 (diff) | |
download | redot-engine-3c25dfe0e44314cfb51df34a63abda6a1cc78cc1.tar.gz |
msdfgen: Sync with upstream 1.10
Diffstat (limited to 'thirdparty/msdfgen/core')
-rw-r--r-- | thirdparty/msdfgen/core/SignedDistance.cpp | 5 | ||||
-rw-r--r-- | thirdparty/msdfgen/core/SignedDistance.h | 2 | ||||
-rw-r--r-- | thirdparty/msdfgen/core/contour-combiners.cpp | 9 | ||||
-rw-r--r-- | thirdparty/msdfgen/core/edge-coloring.cpp | 3 | ||||
-rw-r--r-- | thirdparty/msdfgen/core/generator-config.h | 8 |
5 files changed, 15 insertions, 12 deletions
diff --git a/thirdparty/msdfgen/core/SignedDistance.cpp b/thirdparty/msdfgen/core/SignedDistance.cpp index 18c9d2c424..be956d953e 100644 --- a/thirdparty/msdfgen/core/SignedDistance.cpp +++ b/thirdparty/msdfgen/core/SignedDistance.cpp @@ -2,12 +2,11 @@ #include "SignedDistance.h" #include <cmath> +#include <cfloat> namespace msdfgen { -const SignedDistance SignedDistance::INFINITE(-1e240, 1); - -SignedDistance::SignedDistance() : distance(-1e240), dot(1) { } +SignedDistance::SignedDistance() : distance(-DBL_MAX), dot(1) { } SignedDistance::SignedDistance(double dist, double d) : distance(dist), dot(d) { } diff --git a/thirdparty/msdfgen/core/SignedDistance.h b/thirdparty/msdfgen/core/SignedDistance.h index 034210f751..91fee97600 100644 --- a/thirdparty/msdfgen/core/SignedDistance.h +++ b/thirdparty/msdfgen/core/SignedDistance.h @@ -7,8 +7,6 @@ namespace msdfgen { class SignedDistance { public: - static const SignedDistance INFINITE; - double distance; double dot; diff --git a/thirdparty/msdfgen/core/contour-combiners.cpp b/thirdparty/msdfgen/core/contour-combiners.cpp index d0c5b46d74..31f4c5da71 100644 --- a/thirdparty/msdfgen/core/contour-combiners.cpp +++ b/thirdparty/msdfgen/core/contour-combiners.cpp @@ -1,18 +1,19 @@ #include "contour-combiners.h" +#include <cfloat> #include "arithmetics.hpp" namespace msdfgen { static void initDistance(double &distance) { - distance = SignedDistance::INFINITE.distance; + distance = -DBL_MAX; } static void initDistance(MultiDistance &distance) { - distance.r = SignedDistance::INFINITE.distance; - distance.g = SignedDistance::INFINITE.distance; - distance.b = SignedDistance::INFINITE.distance; + distance.r = -DBL_MAX; + distance.g = -DBL_MAX; + distance.b = -DBL_MAX; } static double resolveDistance(double distance) { diff --git a/thirdparty/msdfgen/core/edge-coloring.cpp b/thirdparty/msdfgen/core/edge-coloring.cpp index 914f1769fd..6a87bba54d 100644 --- a/thirdparty/msdfgen/core/edge-coloring.cpp +++ b/thirdparty/msdfgen/core/edge-coloring.cpp @@ -4,6 +4,7 @@ #include <cstdlib> #include <cmath> #include <cstring> +#include <cfloat> #include <queue> #include "arithmetics.hpp" @@ -244,7 +245,7 @@ static double edgeToEdgeDistance(const EdgeSegment &a, const EdgeSegment &b, int } static double splineToSplineDistance(EdgeSegment * const *edgeSegments, int aStart, int aEnd, int bStart, int bEnd, int precision) { - double minDistance = fabs(SignedDistance::INFINITE.distance); + double minDistance = DBL_MAX; for (int ai = aStart; ai < aEnd; ++ai) for (int bi = bStart; bi < bEnd && minDistance; ++bi) { double d = edgeToEdgeDistance(*edgeSegments[ai], *edgeSegments[bi], precision); diff --git a/thirdparty/msdfgen/core/generator-config.h b/thirdparty/msdfgen/core/generator-config.h index ddcad961f2..b430d37f3c 100644 --- a/thirdparty/msdfgen/core/generator-config.h +++ b/thirdparty/msdfgen/core/generator-config.h @@ -4,14 +4,18 @@ #include <cstdlib> #include "BitmapRef.hpp" +#ifndef MSDFGEN_PUBLIC +#define MSDFGEN_PUBLIC // for DLL import/export +#endif + namespace msdfgen { /// The configuration of the MSDF error correction pass. struct ErrorCorrectionConfig { /// The default value of minDeviationRatio. - static const double defaultMinDeviationRatio; + static MSDFGEN_PUBLIC const double defaultMinDeviationRatio; /// The default value of minImproveRatio. - static const double defaultMinImproveRatio; + static MSDFGEN_PUBLIC const double defaultMinImproveRatio; /// Mode of operation. enum Mode { |