Merge pull request #77959 from akien-mga/msdfgen-1.10
msdfgen: Sync with upstream 1.10
This commit is contained in:
commit
285fbcc52f
10 changed files with 22 additions and 103 deletions
|
@ -394,7 +394,7 @@ License: BSD-2-clause
|
|||
|
||||
Files: ./thirdparty/msdfgen/
|
||||
Comment: Multi-channel signed distance field generator
|
||||
Copyright: 2016, Viktor Chlumsky
|
||||
Copyright: 2016-2022, Viktor Chlumsky
|
||||
License: MIT
|
||||
|
||||
Files: ./thirdparty/oidn/
|
||||
|
|
4
thirdparty/README.md
vendored
4
thirdparty/README.md
vendored
|
@ -529,14 +529,14 @@ Collection of single-file libraries used in Godot components.
|
|||
## msdfgen
|
||||
|
||||
- Upstream: https://github.com/Chlumsky/msdfgen
|
||||
- Version: 1.9.2 (64a91eec3ca3787e6f78b4c99fcd3052ad3e37c0, 2021)
|
||||
- Version: 1.10 (64a91eec3ca3787e6f78b4c99fcd3052ad3e37c0, 2021)
|
||||
- License: MIT
|
||||
|
||||
Files extracted from the upstream source:
|
||||
|
||||
- `msdfgen.h`
|
||||
- Files in `core/` folder.
|
||||
- `LICENSE.txt` and `CHANGELOG.md`
|
||||
- `LICENSE.txt`
|
||||
|
||||
|
||||
## oidn
|
||||
|
|
82
thirdparty/msdfgen/CHANGELOG.md
vendored
82
thirdparty/msdfgen/CHANGELOG.md
vendored
|
@ -1,82 +0,0 @@
|
|||
|
||||
## Version 1.9 (2021-05-28)
|
||||
|
||||
- Error correction of multi-channel distance fields has been completely reworked
|
||||
- Added new edge coloring strategy that optimizes colors based on distances between edges
|
||||
- Added some minor functions for the library API
|
||||
- Minor code refactor and optimizations
|
||||
|
||||
## Version 1.8 (2020-10-17)
|
||||
|
||||
- Integrated the Skia library into the project, which is used to preprocess the shape geometry and eliminate any self-intersections and other irregularities previously unsupported by the software
|
||||
- The scanline pass and overlapping contour mode is made obsolete by this step and has been disabled by default. The preprocess step can be disabled by the new `-nopreprocess` switch and the former enabled by `-scanline` and `-overlap` respectively.
|
||||
- The project can be built without the Skia library, forgoing the geometry preprocessing feature. This is controlled by the macro definition `MSDFGEN_USE_SKIA`
|
||||
- Significantly improved performance of the core algorithm by reusing results from previously computed pixels
|
||||
- Introduced an additional error correction routine which eliminates MSDF artifacts by analytically predicting results of bilinear interpolation
|
||||
- Added the possibility to load font glyphs by their index rather than a Unicode value (use the prefix `g` before the character code in `-font` argument)
|
||||
- Added `-distanceshift` argument that can be used to adjust the center of the distance range in the output distance field
|
||||
- Fixed several errors in the evaluation of curve distances
|
||||
- Fixed an issue with paths containing convergent corners (those whose inner angle is zero)
|
||||
- The algorithm for pseudo-distance computation slightly changed, fixing certain rare edge cases and improving consistency
|
||||
- Added the ability to supply own `FT_Face` handle to the msdfgen library
|
||||
- Minor refactor of the core algorithm
|
||||
|
||||
### Version 1.7.1 (2020-03-09)
|
||||
|
||||
- Fixed an edge case bug in scanline rasterization
|
||||
|
||||
## Version 1.7 (2020-03-07)
|
||||
|
||||
- Added `mtsdf` mode - a combination of `msdf` with `sdf` in the alpha channel
|
||||
- Distance fields can now be stored as uncompressed TIFF image files with floating point precision
|
||||
- Bitmap class refactor - template argument split into data type and number of channels, bitmap reference classes introduced
|
||||
- Added a secondary "ink trap" edge coloring heuristic, can be selected using `-coloringstrategy inktrap`
|
||||
- Added computation of estimated rendering error for a given SDF
|
||||
- Added computation of bounding box that includes sharp mitered corners
|
||||
- The API for bounds computation of the `Shape` class changed for clarity
|
||||
- Fixed several edge case bugs
|
||||
|
||||
## Version 1.6 (2019-04-08)
|
||||
|
||||
- Core algorithm rewritten to split up advanced edge selection logic into modular template arguments.
|
||||
- Pseudo-distance evaluation reworked to eliminate discontinuities at the midpoint between edges.
|
||||
- MSDF error correction reworked to also fix distances away from edges and consider diagonal pairs. Code simplified.
|
||||
- Added scanline rasterization support for `Shape`.
|
||||
- Added a scanline pass in the standalone version, which corrects the signs in the distance field according to the selected fill rule (`-fillrule`). Can be disabled using `-noscanline`.
|
||||
- Fixed autoframe scaling, which previously caused the output to have unnecessary empty border.
|
||||
- `-guessorder` switch no longer enabled by default, as the functionality is now provided by the scanline pass.
|
||||
- Updated FreeType and other libraries, changed to static linkage
|
||||
- Added 64-bit and static library builds to the Visual Studio solution
|
||||
|
||||
## Version 1.5 (2017-07-23)
|
||||
|
||||
- Fixed rounding error in cubic curve splitting.
|
||||
- SVG parser fixes and support for additional path commands.
|
||||
- Added CMake build script.
|
||||
|
||||
## Version 1.4 (2017-02-09)
|
||||
|
||||
- Reworked contour combining logic to support overlapping contours. Original algorithm preserved in functions with `_legacy` suffix, which are invoked by the new `-legacy` switch.
|
||||
- Fixed a severe bug in cubic curve distance computation, where a control point lies at the endpoint.
|
||||
- Standalone version now automatically detects if the input has the wrong orientation and adjusts the distance field accordingly. Can be disabled by `-keeporder` or `-reverseorder` switch.
|
||||
- SVG parser fixes and improvements.
|
||||
|
||||
## Version 1.3 (2016-12-07)
|
||||
|
||||
- Fixed `-reverseorder` switch.
|
||||
- Fixed glyph loading to use the proper method of acquiring outlines from FreeType.
|
||||
|
||||
## Version 1.2 (2016-07-20)
|
||||
|
||||
- Added option to specify that shape vertices are listed in reverse order (`-reverseorder`).
|
||||
- Added option to set a seed for the edge coloring heuristic (-seed \<n\>), which can be used to adjust the output.
|
||||
- Fixed parsing of glyph contours that start with a curve control point.
|
||||
|
||||
## Version 1.1 (2016-05-08)
|
||||
|
||||
- Switched to MIT license due to popular demand.
|
||||
- Fixed SDF rendering anti-aliasing when the output is smaller than the distance field.
|
||||
|
||||
## Version 1.0 (2016-04-28)
|
||||
|
||||
- Project published.
|
2
thirdparty/msdfgen/LICENSE.txt
vendored
2
thirdparty/msdfgen/LICENSE.txt
vendored
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2016 Viktor Chlumsky
|
||||
Copyright (c) 2016 - 2022 Viktor Chlumsky
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
5
thirdparty/msdfgen/core/SignedDistance.cpp
vendored
5
thirdparty/msdfgen/core/SignedDistance.cpp
vendored
|
@ -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) { }
|
||||
|
||||
|
|
2
thirdparty/msdfgen/core/SignedDistance.h
vendored
2
thirdparty/msdfgen/core/SignedDistance.h
vendored
|
@ -7,8 +7,6 @@ namespace msdfgen {
|
|||
class SignedDistance {
|
||||
|
||||
public:
|
||||
static const SignedDistance INFINITE;
|
||||
|
||||
double distance;
|
||||
double dot;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
3
thirdparty/msdfgen/core/edge-coloring.cpp
vendored
3
thirdparty/msdfgen/core/edge-coloring.cpp
vendored
|
@ -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);
|
||||
|
|
8
thirdparty/msdfgen/core/generator-config.h
vendored
8
thirdparty/msdfgen/core/generator-config.h
vendored
|
@ -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 {
|
||||
|
|
8
thirdparty/msdfgen/msdfgen.h
vendored
8
thirdparty/msdfgen/msdfgen.h
vendored
|
@ -2,9 +2,9 @@
|
|||
#pragma once
|
||||
|
||||
/*
|
||||
* MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR v1.9 (2021-05-28)
|
||||
* ---------------------------------------------------------------
|
||||
* A utility by Viktor Chlumsky, (c) 2014 - 2021
|
||||
* MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR
|
||||
* ---------------------------------------------
|
||||
* A utility by Viktor Chlumsky, (c) 2014 - 2022
|
||||
*
|
||||
* The technique used to generate multi-channel distance fields in this code
|
||||
* has been developed by Viktor Chlumsky in 2014 for his master's thesis,
|
||||
|
@ -34,8 +34,6 @@
|
|||
#include "core/save-tiff.h"
|
||||
#include "core/shape-description.h"
|
||||
|
||||
#define MSDFGEN_VERSION "1.9"
|
||||
|
||||
namespace msdfgen {
|
||||
|
||||
/// Generates a conventional single-channel signed distance field.
|
||||
|
|
Loading…
Reference in a new issue