Skip to content

Commit

Permalink
Ignore -Wmaybe-uninitialized warning in nanosvg
Browse files Browse the repository at this point in the history
  • Loading branch information
texus committed Nov 20, 2024
1 parent 7bac678 commit 4aab4c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions include/TGUI/extlibs/IncludeNanoSVG.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
# pragma GCC diagnostic ignored "-Wconversion"
# pragma GCC diagnostic ignored "-Wcast-align"
# pragma GCC diagnostic ignored "-Wshadow"
# if !defined(__clang__)
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
# endif
#elif defined (_MSC_VER)
# if defined(__clang__)
# pragma clang diagnostic push
Expand Down
9 changes: 5 additions & 4 deletions include/TGUI/extlibs/nanosvg/nanosvgrast.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ static float nsvg__normalize(float *x, float* y)
}

static float nsvg__absf(float x) { return x < 0 ? -x : x; }
static float nsvg__roundf(float x) { return (x >= 0) ? floorf(x + 0.5) : ceilf(x - 0.5); }

static void nsvg__flattenCubicBez(NSVGrasterizer* r,
float x1, float y1, float x2, float y2,
Expand Down Expand Up @@ -888,10 +889,10 @@ static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float sta
// STBTT_assert(e->y0 <= start_point);
// round dx down to avoid going too far
if (dxdy < 0)
z->dx = (int)(-floorf(NSVG__FIX * -dxdy));
z->dx = (int)(-nsvg__roundf(NSVG__FIX * -dxdy));
else
z->dx = (int)floorf(NSVG__FIX * dxdy);
z->x = (int)floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0)));
z->dx = (int)nsvg__roundf(NSVG__FIX * dxdy);
z->x = (int)nsvg__roundf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0)));
// z->x -= off_x * FIX;
z->ey = e->y1;
z->next = 0;
Expand Down Expand Up @@ -1298,7 +1299,7 @@ static void nsvg__initPaint(NSVGcachedPaint* cache, NSVGpaint* paint, float opac
if (grad->nstops == 0) {
for (i = 0; i < 256; i++)
cache->colors[i] = 0;
} if (grad->nstops == 1) {
} else if (grad->nstops == 1) {
for (i = 0; i < 256; i++)
cache->colors[i] = nsvg__applyOpacity(grad->stops[i].color, opacity);
} else {
Expand Down

0 comments on commit 4aab4c3

Please sign in to comment.