Update nanosvg to GIT (2022.11)
This commit is contained in:
parent
5240609e67
commit
d0386660cb
3 changed files with 22 additions and 5 deletions
2
thirdparty/README.md
vendored
2
thirdparty/README.md
vendored
|
@ -399,7 +399,7 @@ Collection of single-file libraries used in Godot components.
|
||||||
## nanosvg
|
## nanosvg
|
||||||
|
|
||||||
- Upstream: https://github.com/memononen/nanosvg
|
- Upstream: https://github.com/memononen/nanosvg
|
||||||
- Version: git (bd16c4e6b2842e1f0286dc374d21f85c659862e5, 2022)
|
- Version: git (f0a3e1034dd22e2e87e5db22401e44998383124e, 2022)
|
||||||
- License: zlib
|
- License: zlib
|
||||||
|
|
||||||
Files extracted from the upstream source:
|
Files extracted from the upstream source:
|
||||||
|
|
21
thirdparty/nanosvg/nanosvg.h
vendored
21
thirdparty/nanosvg/nanosvg.h
vendored
|
@ -610,7 +610,7 @@ static void nsvg__curveBounds(float* bounds, float* curve)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSVGparser* nsvg__createParser()
|
static NSVGparser* nsvg__createParser(void)
|
||||||
{
|
{
|
||||||
NSVGparser* p;
|
NSVGparser* p;
|
||||||
p = (NSVGparser*)malloc(sizeof(NSVGparser));
|
p = (NSVGparser*)malloc(sizeof(NSVGparser));
|
||||||
|
@ -1194,6 +1194,19 @@ static const char* nsvg__parseNumber(const char* s, char* it, const int size)
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* nsvg__getNextPathItemWhenArcFlag(const char* s, char* it)
|
||||||
|
{
|
||||||
|
it[0] = '\0';
|
||||||
|
while (*s && (nsvg__isspace(*s) || *s == ',')) s++;
|
||||||
|
if (!*s) return s;
|
||||||
|
if (*s == '0' || *s == '1') {
|
||||||
|
it[0] = *s++;
|
||||||
|
it[1] = '\0';
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
static const char* nsvg__getNextPathItem(const char* s, char* it)
|
static const char* nsvg__getNextPathItem(const char* s, char* it)
|
||||||
{
|
{
|
||||||
it[0] = '\0';
|
it[0] = '\0';
|
||||||
|
@ -2279,7 +2292,11 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
|
||||||
nargs = 0;
|
nargs = 0;
|
||||||
|
|
||||||
while (*s) {
|
while (*s) {
|
||||||
s = nsvg__getNextPathItem(s, item);
|
item[0] = '\0';
|
||||||
|
if ((cmd == 'A' || cmd == 'a') && (nargs == 3 || nargs == 4))
|
||||||
|
s = nsvg__getNextPathItemWhenArcFlag(s, item);
|
||||||
|
if (!*item)
|
||||||
|
s = nsvg__getNextPathItem(s, item);
|
||||||
if (!*item) break;
|
if (!*item) break;
|
||||||
if (cmd != '\0' && nsvg__isCoordinate(item)) {
|
if (cmd != '\0' && nsvg__isCoordinate(item)) {
|
||||||
if (nargs < 10)
|
if (nargs < 10)
|
||||||
|
|
4
thirdparty/nanosvg/nanosvgrast.h
vendored
4
thirdparty/nanosvg/nanosvgrast.h
vendored
|
@ -49,7 +49,7 @@ typedef struct NSVGrasterizer NSVGrasterizer;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Allocated rasterizer context.
|
// Allocated rasterizer context.
|
||||||
NSVGrasterizer* nsvgCreateRasterizer();
|
NSVGrasterizer* nsvgCreateRasterizer(void);
|
||||||
|
|
||||||
// Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
|
// Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
|
||||||
// r - pointer to rasterizer context
|
// r - pointer to rasterizer context
|
||||||
|
@ -150,7 +150,7 @@ struct NSVGrasterizer
|
||||||
int width, height, stride;
|
int width, height, stride;
|
||||||
};
|
};
|
||||||
|
|
||||||
NSVGrasterizer* nsvgCreateRasterizer()
|
NSVGrasterizer* nsvgCreateRasterizer(void)
|
||||||
{
|
{
|
||||||
NSVGrasterizer* r = (NSVGrasterizer*)malloc(sizeof(NSVGrasterizer));
|
NSVGrasterizer* r = (NSVGrasterizer*)malloc(sizeof(NSVGrasterizer));
|
||||||
if (r == NULL) goto error;
|
if (r == NULL) goto error;
|
||||||
|
|
Loading…
Reference in a new issue