Skip to content

Commit 91ce2ca

Browse files
committed
Merge pull request godotengine#107160 from akien-mga/msdfgen-1.12.1
msdfgen: Update to 1.12.1
2 parents a542861 + ecd1d87 commit 91ce2ca

File tree

11 files changed

+32
-7
lines changed

11 files changed

+32
-7
lines changed

COPYRIGHT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ License: BSD-2-clause
517517

518518
Files: thirdparty/msdfgen/*
519519
Comment: Multi-channel signed distance field generator
520-
Copyright: 2014-2024, Viktor Chlumsky
520+
Copyright: 2014-2025, Viktor Chlumsky
521521
License: Expat
522522

523523
Files: thirdparty/openxr/*

thirdparty/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ Collection of single-file libraries used in Godot components.
833833
## msdfgen
834834

835835
- Upstream: https://github.com/Chlumsky/msdfgen
836-
- Version: 1.12 (85e8b3d47b3d1a42e4a5ebda0a24fb1cc2e669e0, 2024)
836+
- Version: 1.12.1 (6574da1310df433c97ca0fddcab7e463c31e58f8, 2025)
837837
- License: MIT
838838

839839
Files extracted from the upstream source:

thirdparty/msdfgen/LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2014 - 2024 Viktor Chlumsky
3+
Copyright (c) 2014 - 2025 Viktor Chlumsky
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

thirdparty/msdfgen/core/MSDFErrorCorrection.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ class ShapeDistanceChecker {
8989
bool protectedFlag;
9090
inline ShapeDistanceChecker(const BitmapConstRef<float, N> &sdf, const Shape &shape, const Projection &projection, DistanceMapping distanceMapping, double minImproveRatio) : distanceFinder(shape), sdf(sdf), distanceMapping(distanceMapping), minImproveRatio(minImproveRatio) {
9191
texelSize = projection.unprojectVector(Vector2(1));
92+
if (shape.inverseYAxis)
93+
texelSize.y = -texelSize.y;
9294
}
9395
inline ArtifactClassifier classifier(const Vector2 &direction, double span) {
9496
return ArtifactClassifier(this, direction, span);
@@ -127,10 +129,10 @@ void MSDFErrorCorrection::protectCorners(const Shape &shape) {
127129
if (!(commonColor&(commonColor-1))) {
128130
// Find the four texels that envelop the corner and mark them as protected.
129131
Point2 p = transformation.project((*edge)->point(0));
130-
if (shape.inverseYAxis)
131-
p.y = stencil.height-p.y;
132132
int l = (int) floor(p.x-.5);
133133
int b = (int) floor(p.y-.5);
134+
if (shape.inverseYAxis)
135+
b = stencil.height-b-2;
134136
int r = l+1;
135137
int t = b+1;
136138
// Check that the positions are within bounds.

thirdparty/msdfgen/core/msdf-error-correction.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, const Proje
8484
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio) {
8585
msdfErrorCorrectionShapeless(sdf, SDFTransformation(projection, range), minDeviationRatio, false);
8686
}
87+
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, Range pxRange, double minDeviationRatio) {
88+
msdfErrorCorrectionShapeless(sdf, SDFTransformation(Projection(), pxRange), minDeviationRatio, false);
89+
}
90+
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, Range pxRange, double minDeviationRatio) {
91+
msdfErrorCorrectionShapeless(sdf, SDFTransformation(Projection(), pxRange), minDeviationRatio, false);
92+
}
8793

8894
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const SDFTransformation &transformation, double minDeviationRatio) {
8995
msdfErrorCorrectionShapeless(sdf, transformation, minDeviationRatio, true);
@@ -97,6 +103,12 @@ void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const Projectio
97103
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio) {
98104
msdfErrorCorrectionShapeless(sdf, SDFTransformation(projection, range), minDeviationRatio, true);
99105
}
106+
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, Range pxRange, double minDeviationRatio) {
107+
msdfErrorCorrectionShapeless(sdf, SDFTransformation(Projection(), pxRange), minDeviationRatio, true);
108+
}
109+
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, Range pxRange, double minDeviationRatio) {
110+
msdfErrorCorrectionShapeless(sdf, SDFTransformation(Projection(), pxRange), minDeviationRatio, true);
111+
}
100112

101113

102114
// Legacy version

thirdparty/msdfgen/core/msdf-error-correction.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, const SDFTr
2222
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, const SDFTransformation &transformation, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
2323
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
2424
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
25+
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, Range pxRange, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
26+
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, Range pxRange, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
2527

2628
/// Applies the simplified error correction to edges only (EDGE_ONLY mode). Does not need shape or translation.
2729
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const SDFTransformation &transformation, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
2830
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, const SDFTransformation &transformation, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
2931
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
3032
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
33+
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, Range pxRange, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
34+
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, Range pxRange, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
3135

3236
/// The original version of the error correction algorithm.
3337
void msdfErrorCorrection_legacy(const BitmapRef<float, 3> &output, const Vector2 &threshold);

thirdparty/msdfgen/core/rasterization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void distanceSignCorrection(const BitmapRef<float, 1> &sdf, const Shape &shape,
3333
template <int N>
3434
static void multiDistanceSignCorrection(const BitmapRef<float, N> &sdf, const Shape &shape, const Projection &projection, FillRule fillRule) {
3535
int w = sdf.width, h = sdf.height;
36-
if (!(w*h))
36+
if (!(w && h))
3737
return;
3838
Scanline scanline;
3939
bool ambiguous = false;

thirdparty/msdfgen/core/save-bmp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2+
#ifndef _CRT_SECURE_NO_WARNINGS
23
#define _CRT_SECURE_NO_WARNINGS
4+
#endif
35

46
#include "save-bmp.h"
57

thirdparty/msdfgen/core/save-tiff.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2+
#ifndef _CRT_SECURE_NO_WARNINGS
23
#define _CRT_SECURE_NO_WARNINGS
4+
#endif
35

46
#include "save-tiff.h"
57

thirdparty/msdfgen/core/shape-description.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11

2+
#ifndef _CRT_SECURE_NO_WARNINGS
23
#define _CRT_SECURE_NO_WARNINGS
4+
#endif
5+
36
#include "shape-description.h"
47

58
#include <cstdlib>

0 commit comments

Comments
 (0)