25#define FONTSTASH_IMPLEMENTATION
29#define STB_IMAGE_IMPLEMENTATION
33#ifdef NVG_DISABLE_SKIPPING_WHITESPACE
34#define NVG_SKIPPED_CHAR NVG_SPACE
36#define NVG_SKIPPED_CHAR NVG_CHAR
39#ifndef NVG_FONT_TEXTURE_FLAGS
40#define NVG_FONT_TEXTURE_FLAGS 0
44#pragma warning(disable: 4100)
45#pragma warning(disable: 4127)
46#pragma warning(disable: 4204)
47#pragma warning(disable: 4706)
50#define NVG_INIT_FONTIMAGE_SIZE 512
51#define NVG_MAX_FONTIMAGE_SIZE 2048
52#define NVG_MAX_FONTIMAGES 4
54#define NVG_INIT_COMMANDS_SIZE 256
55#define NVG_INIT_POINTS_SIZE 128
56#define NVG_INIT_PATHS_SIZE 16
57#define NVG_INIT_VERTS_SIZE 256
58#define NVG_MAX_STATES 32
60#define NVG_KAPPA90 0.5522847493f
62#define NVG_COUNTOF(arr) (sizeof(arr) / sizeof(0[arr]))
163static int nvg__clampi(
int a,
int mn,
int mx) {
return a < mn ? mn : (
a > mx ? mx :
a); }
168static float nvg__clampf(
float a,
float mn,
float mx) {
return a < mn ? mn : (
a > mx ? mx :
a); }
169static float nvg__cross(
float dx0,
float dy0,
float dx1,
float dy1) {
return dx1*dy0 - dx0*dy1; }
185 if (
c ==
NULL)
return;
186 if (
c->points !=
NULL) free(
c->points);
187 if (
c->paths !=
NULL) free(
c->paths);
188 if (
c->verts !=
NULL) free(
c->verts);
199 if (!
c->points)
goto error;
204 if (!
c->paths)
goto error;
209 if (!
c->verts)
goto error;
229 int sfactor, dfactor;
342 memset(&fontParams, 0,
sizeof(fontParams));
380 if (ctx ==
NULL)
return;
443 if (nw < iw || nh < ih)
473 color.
r =
r / 255.0f;
474 color.
g =
g / 255.0f;
475 color.
b =
b / 255.0f;
476 color.
a =
a / 255.0f;
511 for(
i = 0;
i <4;
i++ )
529 return m1 + (m2 - m1) *
h * 6.0f;
530 else if (
h < 3.0f/6.0f)
532 else if (
h < 4.0f/6.0f)
533 return m1 + (m2 - m1) * (2.0f/3.0f -
h) * 6.0f;
542 if (
h < 0.0f)
h += 1.0f;
545 m2 =
l <= 0.5f ? (
l * (1 +
s)) : (
l +
s -
l *
s);
556 t[0] = 1.0f;
t[1] = 0.0f;
557 t[2] = 0.0f;
t[3] = 1.0f;
558 t[4] = 0.0f;
t[5] = 0.0f;
563 t[0] = 1.0f;
t[1] = 0.0f;
564 t[2] = 0.0f;
t[3] = 1.0f;
565 t[4] = tx;
t[5] = ty;
570 t[0] = sx;
t[1] = 0.0f;
571 t[2] = 0.0f;
t[3] = sy;
572 t[4] = 0.0f;
t[5] = 0.0f;
578 t[0] = cs;
t[1] = sn;
579 t[2] = -sn;
t[3] = cs;
580 t[4] = 0.0f;
t[5] = 0.0f;
585 t[0] = 1.0f;
t[1] = 0.0f;
587 t[4] = 0.0f;
t[5] = 0.0f;
593 t[2] = 0.0f;
t[3] = 1.0f;
594 t[4] = 0.0f;
t[5] = 0.0f;
599 float t0 =
t[0] *
s[0] +
t[1] *
s[2];
600 float t2 =
t[2] *
s[0] +
t[3] *
s[2];
601 float t4 =
t[4] *
s[0] +
t[5] *
s[2] +
s[4];
602 t[1] =
t[0] *
s[1] +
t[1] *
s[3];
603 t[3] =
t[2] *
s[1] +
t[3] *
s[3];
604 t[5] =
t[4] *
s[1] +
t[5] *
s[3] +
s[5];
613 memcpy(s2,
s,
sizeof(
float)*6);
615 memcpy(
t, s2,
sizeof(
float)*6);
620 double invdet, det = (double)
t[0] *
t[3] - (
double)
t[2] *
t[1];
621 if (det > -1
e-6 && det < 1
e-6) {
626 inv[0] = (float)(
t[3] * invdet);
627 inv[2] = (float)(-
t[2] * invdet);
628 inv[4] = (float)(((
double)
t[2] *
t[5] - (
double)
t[3] *
t[4]) * invdet);
629 inv[1] = (float)(-
t[1] * invdet);
630 inv[3] = (float)(
t[0] * invdet);
631 inv[5] = (float)(((
double)
t[1] *
t[4] - (
double)
t[0] *
t[5]) * invdet);
637 *dx = sx*
t[0] + sy*
t[2] +
t[4];
638 *
dy = sx*
t[1] + sy*
t[3] +
t[5];
643 return deg / 180.0f *
NVG_PI;
648 return rad /
NVG_PI * 180.0f;
653 memset(
p, 0,
sizeof(*
p));
657 p->innerColor = color;
658 p->outerColor = color;
682 memset(state, 0,
sizeof(*state));
740 state->
tint.
a = alpha;
758 state->
tint.
a *= alpha;
765 for (
i = 0;
i < 4;
i++)
772 float t[6] = {
a,
b,
c,
d,
e,
f };
825 if (xform ==
NULL)
return;
914 float sx,
float sy,
float ex,
float ey,
919 const float large = 1e5;
921 memset(&
p, 0,
sizeof(
p));
926 d = sqrtf(dx*dx +
dy*
dy);
935 p.xform[0] =
dy;
p.xform[1] = -dx;
936 p.xform[2] = dx;
p.xform[3] =
dy;
937 p.xform[4] = sx - dx*large;
p.xform[5] = sy -
dy*large;
940 p.extent[1] = large +
d*0.5f;
953 float cx,
float cy,
float inr,
float outr,
957 float r = (inr+outr)*0.5f;
958 float f = (outr-inr);
960 memset(&
p, 0,
sizeof(
p));
980 float x,
float y,
float w,
float h,
float r,
float f,
985 memset(&
p, 0,
sizeof(
p));
988 p.xform[4] =
x+
w*0.5f;
989 p.xform[5] =
y+
h*0.5f;
991 p.extent[0] =
w*0.5f;
992 p.extent[1] =
h*0.5f;
1006 float cx,
float cy,
float w,
float h,
float angle,
1007 int image,
float alpha)
1011 memset(&
p, 0,
sizeof(
p));
1022 p.innerColor =
p.outerColor =
nvgRGBAf(1,1,1,alpha);
1045 float ax,
float ay,
float aw,
float ah,
1046 float bx,
float by,
float bw,
float bh)
1061 float pxform[6], invxorm[6];
1063 float ex, ey, tex, tey;
1084 nvgScissor(ctx, rect[0], rect[1], rect[2], rect[3]);
1123 return dx*dx +
dy*
dy < tol*tol;
1128 float pqx, pqy, dx,
dy,
d,
t;
1133 d = pqx*pqx + pqy*pqy;
1134 t = pqx*dx + pqy*
dy;
1137 else if (
t > 1)
t = 1;
1138 dx = px +
t*pqx -
x;
1139 dy = py +
t*pqy -
y;
1140 return dx*dx +
dy*
dy;
1151 commands = (
float*)realloc(ctx->
commands,
sizeof(
float)*ccommands);
1152 if (commands ==
NULL)
return;
1165 int cmd = (
int)vals[
i];
1218 if (paths ==
NULL)
return;
1223 memset(path, 0,
sizeof(*path));
1241 if (path ==
NULL)
return;
1255 if (points ==
NULL)
return;
1261 memset(pt, 0,
sizeof(*pt));
1264 pt->
flags = (
unsigned char)flags;
1273 if (path ==
NULL)
return;
1280 if (path ==
NULL)
return;
1286 float sx = sqrtf(
t[0]*
t[0] +
t[2]*
t[2]);
1287 float sy = sqrtf(
t[1]*
t[1] +
t[3]*
t[3]);
1288 return (sx + sy) * 0.5f;
1295 int cverts = (nverts + 0xff) & ~0xff;
1305static float nvg__triarea2(
float ax,
float ay,
float bx,
float by,
float cx,
float cy)
1307 float abx = bx - ax;
1308 float aby = by - ay;
1309 float acx = cx - ax;
1310 float acy = cy - ay;
1311 return acx*aby - abx*acy;
1318 for (
i = 2;
i < npts;
i++) {
1330 int i = 0,
j = npts-1;
1350 float x1,
float y1,
float x2,
float y2,
1351 float x3,
float y3,
float x4,
float y4,
1352 int level,
int type)
1354 float x12,y12,x23,y23,x34,y34,x123,y123,x234,y234,x1234,y1234;
1357 if (level > 10)
return;
1365 x123 = (x12+x23)*0.5f;
1366 y123 = (y12+y23)*0.5f;
1370 d2 =
nvg__absf(((x2 - x4) *
dy - (y2 - y4) * dx));
1371 d3 =
nvg__absf(((x3 - x4) *
dy - (y3 - y4) * dx));
1373 if ((d2 + d3)*(d2 + d3) < ctx->
tessTol * (dx*dx +
dy*
dy)) {
1383 x234 = (x23+x34)*0.5f;
1384 y234 = (y23+y34)*0.5f;
1385 x1234 = (x123+x234)*0.5f;
1386 y1234 = (y123+y234)*0.5f;
1388 nvg__tesselateBezier(ctx, x1,y1, x12,y12, x123,y123, x1234,y1234, level+1, 0);
1389 nvg__tesselateBezier(ctx, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1,
type);
1432 nvg__tesselateBezier(ctx, last->
x,last->
y, cp1[0],cp1[1], cp2[0],cp2[1],
p[0],
p[1], 0,
NVG_PT_CORNER);
1458 p0 = &pts[path->
count-1];
1462 p0 = &pts[path->
count-1];
1467 if (path->
count > 2) {
1477 p0->
dx = p1->
x - p0->
x;
1478 p0->
dy = p1->
y - p0->
y;
1493 float da = acosf(
r / (
r + tol)) * 2.0f;
1494 return nvg__maxi(2, (
int)ceilf(arc / da));
1498 float* x0,
float* y0,
float* x1,
float* y1)
1501 *x0 = p1->
x + p0->
dy *
w;
1502 *y0 = p1->
y - p0->
dx *
w;
1503 *x1 = p1->
x + p1->
dy *
w;
1504 *y1 = p1->
y - p1->
dx *
w;
1506 *x0 = p1->
x + p1->
dmx *
w;
1507 *y0 = p1->
y + p1->
dmy *
w;
1508 *x1 = p1->
x + p1->
dmx *
w;
1509 *y1 = p1->
y + p1->
dmy *
w;
1514 float lw,
float rw,
float lu,
float ru,
int ncap,
1518 float dlx0 = p0->
dy;
1519 float dly0 = -p0->
dx;
1520 float dlx1 = p1->
dy;
1521 float dly1 = -p1->
dx;
1525 float lx0,ly0,lx1,ly1,a0,a1;
1527 a0 = atan2f(-dly0, -dlx0);
1528 a1 = atan2f(-dly1, -dlx1);
1529 if (a1 > a0) a1 -=
NVG_PI*2;
1532 nvg__vset(dst, p1->
x - dlx0*rw, p1->
y - dly0*rw, ru,1); dst++;
1535 for (
i = 0;
i <
n;
i++) {
1536 float u =
i/(float)(
n-1);
1537 float a = a0 +
u*(a1-a0);
1538 float rx = p1->
x + cosf(
a) * rw;
1539 float ry = p1->
y + sinf(
a) * rw;
1545 nvg__vset(dst, p1->
x - dlx1*rw, p1->
y - dly1*rw, ru,1); dst++;
1548 float rx0,ry0,rx1,ry1,a0,a1;
1550 a0 = atan2f(dly0, dlx0);
1551 a1 = atan2f(dly1, dlx1);
1552 if (a1 < a0) a1 +=
NVG_PI*2;
1554 nvg__vset(dst, p1->
x + dlx0*rw, p1->
y + dly0*rw, lu,1); dst++;
1558 for (
i = 0;
i <
n;
i++) {
1559 float u =
i/(float)(
n-1);
1560 float a = a0 +
u*(a1-a0);
1561 float lx = p1->
x + cosf(
a) * lw;
1562 float ly = p1->
y + sinf(
a) * lw;
1567 nvg__vset(dst, p1->
x + dlx1*rw, p1->
y + dly1*rw, lu,1); dst++;
1575 float lw,
float rw,
float lu,
float ru,
float fringe)
1577 float rx0,ry0,rx1,ry1;
1578 float lx0,ly0,lx1,ly1;
1579 float dlx0 = p0->
dy;
1580 float dly0 = -p0->
dx;
1581 float dlx1 = p1->
dy;
1582 float dly1 = -p1->
dx;
1589 nvg__vset(dst, p1->
x - dlx0*rw, p1->
y - dly0*rw, ru,1); dst++;
1593 nvg__vset(dst, p1->
x - dlx0*rw, p1->
y - dly0*rw, ru,1); dst++;
1596 nvg__vset(dst, p1->
x - dlx1*rw, p1->
y - dly1*rw, ru,1); dst++;
1598 rx0 = p1->
x - p1->
dmx * rw;
1599 ry0 = p1->
y - p1->
dmy * rw;
1602 nvg__vset(dst, p1->
x - dlx0*rw, p1->
y - dly0*rw, ru,1); dst++;
1608 nvg__vset(dst, p1->
x - dlx1*rw, p1->
y - dly1*rw, ru,1); dst++;
1612 nvg__vset(dst, p1->
x - dlx1*rw, p1->
y - dly1*rw, ru,1); dst++;
1617 nvg__vset(dst, p1->
x + dlx0*lw, p1->
y + dly0*lw, lu,1); dst++;
1621 nvg__vset(dst, p1->
x + dlx0*lw, p1->
y + dly0*lw, lu,1); dst++;
1624 nvg__vset(dst, p1->
x + dlx1*lw, p1->
y + dly1*lw, lu,1); dst++;
1627 lx0 = p1->
x + p1->
dmx * lw;
1628 ly0 = p1->
y + p1->
dmy * lw;
1630 nvg__vset(dst, p1->
x + dlx0*lw, p1->
y + dly0*lw, lu,1); dst++;
1636 nvg__vset(dst, p1->
x + dlx1*lw, p1->
y + dly1*lw, lu,1); dst++;
1640 nvg__vset(dst, p1->
x + dlx1*lw, p1->
y + dly1*lw, lu,1); dst++;
1648 float dx,
float dy,
float w,
float d,
1649 float aa,
float u0,
float u1)
1651 float px =
p->x - dx*
d;
1652 float py =
p->y -
dy*
d;
1655 nvg__vset(dst, px + dlx*
w - dx*aa, py + dly*
w -
dy*aa, u0,0); dst++;
1656 nvg__vset(dst, px - dlx*
w - dx*aa, py - dly*
w -
dy*aa, u1,0); dst++;
1657 nvg__vset(dst, px + dlx*
w, py + dly*
w, u0,1); dst++;
1658 nvg__vset(dst, px - dlx*
w, py - dly*
w, u1,1); dst++;
1663 float dx,
float dy,
float w,
float d,
1664 float aa,
float u0,
float u1)
1666 float px =
p->x + dx*
d;
1667 float py =
p->y +
dy*
d;
1670 nvg__vset(dst, px + dlx*
w, py + dly*
w, u0,1); dst++;
1671 nvg__vset(dst, px - dlx*
w, py - dly*
w, u1,1); dst++;
1672 nvg__vset(dst, px + dlx*
w + dx*aa, py + dly*
w +
dy*aa, u0,0); dst++;
1673 nvg__vset(dst, px - dlx*
w + dx*aa, py - dly*
w +
dy*aa, u1,0); dst++;
1679 float dx,
float dy,
float w,
int ncap,
1680 float aa,
float u0,
float u1)
1688 for (
i = 0;
i < ncap;
i++) {
1689 float a =
i/(float)(ncap-1)*
NVG_PI;
1690 float ax = cosf(
a) *
w, ay = sinf(
a) *
w;
1691 nvg__vset(dst, px - dlx*ax - dx*ay, py - dly*ax -
dy*ay, u0,1); dst++;
1694 nvg__vset(dst, px + dlx*
w, py + dly*
w, u0,1); dst++;
1695 nvg__vset(dst, px - dlx*
w, py - dly*
w, u1,1); dst++;
1700 float dx,
float dy,
float w,
int ncap,
1701 float aa,
float u0,
float u1)
1709 nvg__vset(dst, px + dlx*
w, py + dly*
w, u0,1); dst++;
1710 nvg__vset(dst, px - dlx*
w, py - dly*
w, u1,1); dst++;
1711 for (
i = 0;
i < ncap;
i++) {
1712 float a =
i/(float)(ncap-1)*
NVG_PI;
1713 float ax = cosf(
a) *
w, ay = sinf(
a) *
w;
1715 nvg__vset(dst, px - dlx*ax + dx*ay, py - dly*ax +
dy*ay, u0,1); dst++;
1727 if (
w > 0.0f) iw = 1.0f /
w;
1739 for (
j = 0;
j < path->
count;
j++) {
1740 float dlx0, dly0, dlx1, dly1, dmr2, cross,
limit;
1746 p1->
dmx = (dlx0 + dlx1) * 0.5f;
1747 p1->
dmy = (dly0 + dly1) * 0.5f;
1749 if (dmr2 > 0.000001f) {
1750 float scale = 1.0f / dmr2;
1751 if (scale > 600.0f) {
1762 cross = p1->
dx * p0->
dy - p0->
dx * p1->
dy;
1775 if ((dmr2 * miterLimit*miterLimit) < 1.0f || lineJoin ==
NVG_BEVEL || lineJoin ==
NVG_ROUND) {
1798 float u0 = 0.0f, u1 = 1.0f;
1817 cverts += (path->
count + path->
nbevel*(ncap+2) + 1) * 2;
1823 cverts += (ncap*2 + 2)*2;
1831 if (verts ==
NULL)
return 0;
1851 p0 = &pts[path->
count-1];
1876 for (
j =
s;
j <
e; ++
j) {
1892 nvg__vset(dst, verts[0].
x, verts[0].
y, u0,1); dst++;
1893 nvg__vset(dst, verts[1].
x, verts[1].
y, u1,1); dst++;
1920 int cverts, convex,
i,
j;
1922 int fringe =
w > 0.0f;
1936 if (verts ==
NULL)
return 0;
1955 p0 = &pts[path->
count-1];
1957 for (
j = 0;
j < path->
count; ++
j) {
1959 float dlx0 = p0->
dy;
1960 float dly0 = -p0->
dx;
1961 float dlx1 = p1->
dy;
1962 float dly1 = -p1->
dx;
1964 float lx = p1->
x + p1->
dmx * woff;
1965 float ly = p1->
y + p1->
dmy * woff;
1968 float lx0 = p1->
x + dlx0 * woff;
1969 float ly0 = p1->
y + dly0 * woff;
1970 float lx1 = p1->
x + dlx1 * woff;
1971 float ly1 = p1->
y + dly1 * woff;
1972 nvg__vset(dst, lx0, ly0, 0.5f,1); dst++;
1973 nvg__vset(dst, lx1, ly1, 0.5f,1); dst++;
1976 nvg__vset(dst, p1->
x + (p1->
dmx * woff), p1->
y + (p1->
dmy * woff), 0.5f,1); dst++;
1981 for (
j = 0;
j < path->
count; ++
j) {
2007 p0 = &pts[path->
count-1];
2010 for (
j = 0;
j < path->
count; ++
j) {
2021 nvg__vset(dst, verts[0].
x, verts[0].
y, lu,1); dst++;
2022 nvg__vset(dst, verts[1].
x, verts[1].
y, ru,1); dst++;
2066 x0 + 2.0f/3.0f*(cx - x0), y0 + 2.0f/3.0f*(cy - y0),
2067 x + 2.0f/3.0f*(cx -
x),
y + 2.0f/3.0f*(cy -
y),
2076 float dx0,dy0, dx1,dy1,
a,
d, cx,cy, a0,a1;
2087 radius < ctx->distTol) {
2110 cx = x1 + dx0*
d + dy0*radius;
2111 cy = y1 + dy0*
d + -dx0*radius;
2117 cx = x1 + dx0*
d + -dy0*radius;
2118 cy = y1 + dy0*
d + dx0*radius;
2125 nvgArc(ctx, cx, cy, radius, a0, a1, dir);
2142 float a = 0, da = 0, hda = 0, kappa = 0;
2143 float dx = 0,
dy = 0,
x = 0,
y = 0, tanx = 0, tany = 0;
2144 float px = 0, py = 0, ptanx = 0, ptany = 0;
2145 float vals[3 + 5*7 + 100];
2146 int i, ndivs, nvals;
2155 while (da < 0.0f) da +=
NVG_PI*2;
2161 while (da > 0.0f) da -=
NVG_PI*2;
2167 hda = (da / (float)ndivs) / 2.0f;
2174 for (
i = 0;
i <= ndivs;
i++) {
2175 a = a0 + da * (
i/(float)ndivs);
2184 vals[nvals++] = (float)move;
2189 vals[nvals++] = px+ptanx;
2190 vals[nvals++] = py+ptany;
2191 vals[nvals++] =
x-tanx;
2192 vals[nvals++] =
y-tany;
2224 if(radTopLeft < 0.1f && radTopRight < 0.1f && radBottomRight < 0.1f && radBottomLeft < 0.1f) {
2273 printf(
"Dumping %d cached paths\n", ctx->
cache->
npaths);
2276 printf(
" - Path %d\n",
i);
2278 printf(
" - fill: %d\n", path->
nfill);
2283 printf(
" - stroke: %d\n", path->
nstroke);
2304 for (
i = 0;
i < 4;
i++) {
2331 if (strokeWidth < ctx->fringeWidth) {
2341 for (
i = 0;
i < 4;
i++) {
2394 if(baseFont == -1 || fallbackFont == -1)
return 0;
2395 return fonsAddFallbackFont(ctx->
fontContext->
fs, baseFont, fallbackFont);
2458 return ((
int)(
a /
d + 0.5f)) *
d;
2473 if (fontImage != 0) {
2478 int w = dirty[2] - dirty[0];
2479 int h = dirty[3] - dirty[1];
2521 for (
i = 0;
i < 4;
i++) {
2534 float det = xform[0] * xform[3] - xform[2] * xform[1];
2545 float invscale = 1.0f / scale;
2551 end =
string + strlen(
string);
2561 cverts =
nvg__maxi(2, (
int)(end -
string)) * 6;
2563 if (verts ==
NULL)
return x;
2585 tmp =
q.y0;
q.y0 =
q.y1;
q.y1 = tmp;
2586 tmp =
q.t0;
q.t0 =
q.t1;
q.t1 = tmp;
2594 if (nverts+6 <= cverts) {
2595 nvg__vset(&verts[nverts],
c[0],
c[1],
q.s0,
q.t0); nverts++;
2596 nvg__vset(&verts[nverts],
c[4],
c[5],
q.s1,
q.t1); nverts++;
2597 nvg__vset(&verts[nverts],
c[2],
c[3],
q.s1,
q.t0); nverts++;
2598 nvg__vset(&verts[nverts],
c[0],
c[1],
q.s0,
q.t0); nverts++;
2599 nvg__vset(&verts[nverts],
c[6],
c[7],
q.s0,
q.t1); nverts++;
2600 nvg__vset(&verts[nverts],
c[4],
c[5],
q.s1,
q.t1); nverts++;
2609 return iter.
nextx / scale;
2629 for (
i = 0;
i < nrows;
i++) {
2632 nvgText(ctx,
x,
y, row->start, row->end);
2634 nvgText(ctx,
x + breakRowWidth*0.5f - row->width*0.5f,
y, row->start, row->end);
2636 nvgText(ctx,
x + breakRowWidth - row->width,
y, row->start, row->end);
2639 string = rows[nrows-1].
next;
2649 float invscale = 1.0f / scale;
2657 end =
string + strlen(
string);
2676 positions[npos].
str = iter.
str;
2677 positions[npos].
x = iter.
x * invscale;
2681 if (npos >= maxPositions)
2699 float invscale = 1.0f / scale;
2703 float rowStartX = 0;
2707 const char* rowStart =
NULL;
2708 const char* rowEnd =
NULL;
2709 const char* wordStart =
NULL;
2710 float wordStartX = 0;
2712 const char* breakEnd =
NULL;
2713 float breakWidth = 0;
2714 float breakMaxX = 0;
2716 unsigned int pcodepoint = 0;
2718 if (maxRows == 0)
return 0;
2722 end =
string + strlen(
string);
2724 if (
string == end)
return 0;
2732 breakRowWidth *= scale;
2774 rows[nrows].
start = rowStart !=
NULL ? rowStart : iter.
str;
2775 rows[nrows].
end = rowEnd !=
NULL ? rowEnd : iter.
str;
2776 rows[nrows].
width = rowWidth * invscale;
2777 rows[nrows].
minx = rowMinX * invscale;
2778 rows[nrows].
maxx = rowMaxX * invscale;
2781 if (nrows >= maxRows)
2784 breakEnd = rowStart;
2791 rowMinX = rowMaxX = 0;
2793 if (rowStart ==
NULL) {
2798 rowStart = iter.
str;
2800 rowWidth = iter.
nextx - rowStartX;
2801 rowMinX =
q.x0 - rowStartX;
2802 rowMaxX =
q.x1 - rowStartX;
2803 wordStart = iter.
str;
2804 wordStartX = iter.
x;
2805 wordMinX =
q.x0 - rowStartX;
2807 breakEnd = rowStart;
2812 float nextWidth = iter.
nextx - rowStartX;
2817 rowWidth = iter.
nextx - rowStartX;
2818 rowMaxX =
q.x1 - rowStartX;
2822 breakEnd = iter.
str;
2823 breakWidth = rowWidth;
2824 breakMaxX = rowMaxX;
2828 wordStart = iter.
str;
2829 wordStartX = iter.
x;
2836 if (breakEnd == rowStart) {
2838 rows[nrows].
start = rowStart;
2839 rows[nrows].
end = iter.
str;
2840 rows[nrows].
width = rowWidth * invscale;
2841 rows[nrows].
minx = rowMinX * invscale;
2842 rows[nrows].
maxx = rowMaxX * invscale;
2845 if (nrows >= maxRows)
2848 rowStart = iter.
str;
2850 rowWidth = iter.
nextx - rowStartX;
2851 rowMinX =
q.x0 - rowStartX;
2852 rowMaxX =
q.x1 - rowStartX;
2853 wordStart = iter.
str;
2854 wordStartX = iter.
x;
2855 wordMinX =
q.x0 - rowStartX;
2858 rows[nrows].
start = rowStart;
2859 rows[nrows].
end = breakEnd;
2860 rows[nrows].
width = breakWidth * invscale;
2861 rows[nrows].
minx = rowMinX * invscale;
2862 rows[nrows].
maxx = breakMaxX * invscale;
2863 rows[nrows].
next = wordStart;
2865 if (nrows >= maxRows)
2868 rowStartX = wordStartX;
2869 rowStart = wordStart;
2871 rowWidth = iter.
nextx - rowStartX;
2872 rowMinX = wordMinX - rowStartX;
2873 rowMaxX =
q.x1 - rowStartX;
2876 breakEnd = rowStart;
2888 if (rowStart !=
NULL) {
2889 rows[nrows].
start = rowStart;
2890 rows[nrows].
end = rowEnd;
2891 rows[nrows].
width = rowWidth * invscale;
2892 rows[nrows].
minx = rowMinX * invscale;
2893 rows[nrows].
maxx = rowMaxX * invscale;
2894 rows[nrows].
next = end;
2905 float invscale = 1.0f / scale;
2917 if (bounds !=
NULL) {
2920 bounds[0] *= invscale;
2921 bounds[1] *= invscale;
2922 bounds[2] *= invscale;
2923 bounds[3] *= invscale;
2925 return width * invscale;
2933 float invscale = 1.0f / scale;
2938 float lineh = 0, rminy = 0, rmaxy = 0;
2939 float minx, miny, maxx, maxy;
2943 bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0f;
2964 for (
i = 0;
i < nrows;
i++) {
2966 float rminx, rmaxx, dx = 0;
2971 dx = breakRowWidth*0.5f - row->width*0.5f;
2973 dx = breakRowWidth - row->width;
2974 rminx =
x + row->minx + dx;
2975 rmaxx =
x + row->maxx + dx;
2984 string = rows[nrows-1].
next;
2989 if (bounds !=
NULL) {
3001 float invscale = 1.0f / scale;
3012 if (ascender !=
NULL)
3013 *ascender *= invscale;
3014 if (descender !=
NULL)
3015 *descender *= invscale;
uint8_t a
Definition Spc_Cpu.h:141
goto loop
Definition Spc_Cpu.h:155
T limit(T val, T min, T max)
Definition Util.h:78
CAdPlugDatabase::CRecord::RecordType type
Definition adplugdb.cpp:93
* e
Definition inflate.c:1404
UINT_D64 w
Definition inflate.c:942
int * l
Definition inflate.c:1579
struct huft * t
Definition inflate.c:943
register unsigned j
Definition inflate.c:1576
int y
Definition inflate.c:1588
unsigned v[N_MAX]
Definition inflate.c:1584
unsigned d
Definition inflate.c:940
int g
Definition inflate.c:1573
struct huft * u[BMAX]
Definition inflate.c:1583
int lx[BMAX+1]
Definition inflate.c:1578
register unsigned i
Definition inflate.c:1575
unsigned s
Definition inflate.c:1555
unsigned x[BMAX+1]
Definition inflate.c:1586
unsigned f
Definition inflate.c:1572
STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert)
STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply)
STBIDEF stbi_uc * stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)
STBIDEF stbi_uc * stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
STBIDEF void stbi_image_free(void *retval_from_stbi_load)
static char filename[]
Definition features.c:5
int fonsGetFontByName(FONScontext *s, const char *name)
@ FONS_ZERO_TOPLEFT
Definition fontstash.h:25
int fonsValidateTexture(FONScontext *s, int *dirty)
void fonsLineBounds(FONScontext *s, float y, float *miny, float *maxy)
void fonsSetAlign(FONScontext *s, int align)
void fonsSetSpacing(FONScontext *s, float spacing)
int fonsAddFontMem(FONScontext *s, const char *name, unsigned char *data, int ndata, int freeData, int fontIndex)
int fonsTextIterInit(FONScontext *stash, FONStextIter *iter, float x, float y, const char *str, const char *end, int bitmapOption)
int fonsTextIterNext(FONScontext *stash, FONStextIter *iter, struct FONSquad *quad)
void fonsVertMetrics(FONScontext *s, float *ascender, float *descender, float *lineh)
void fonsSetBlur(FONScontext *s, float blur)
float fonsTextBounds(FONScontext *s, float x, float y, const char *string, const char *end, float *bounds)
@ FONS_GLYPH_BITMAP_REQUIRED
Definition fontstash.h:43
@ FONS_GLYPH_BITMAP_OPTIONAL
Definition fontstash.h:42
const unsigned char * fonsGetTextureData(FONScontext *stash, int *width, int *height)
FONScontext * fonsCreateInternal(FONSparams *params)
int fonsResetAtlas(FONScontext *stash, int width, int height)
void fonsSetSize(FONScontext *s, float size)
#define FONS_INVALID
Definition fontstash.h:22
void fonsDeleteInternal(FONScontext *s)
struct FONScontext FONScontext
Definition fontstash.h:90
int fonsAddFont(FONScontext *s, const char *name, const char *path, int fontIndex)
void fonsSetFont(FONScontext *s, int font)
static const char * name
Definition pugl.h:1582
static int width
Definition pugl.h:1593
JSAMPIMAGE data
Definition jpeglib.h:945
void nvgRoundedRect(NVGcontext *ctx, float x, float y, float w, float h, float r)
Definition nanovg.c:2217
static float nvg__sqrtf(float a)
Definition nanovg.c:153
static NVGvertex * nvg__buttCapEnd(NVGvertex *dst, NVGpoint *p, float dx, float dy, float w, float d, float aa, float u0, float u1)
Definition nanovg.c:1662
NVGpointFlags
Definition nanovg.c:74
@ NVG_PT_LEFT
Definition nanovg.c:76
@ NVG_PT_CORNER
Definition nanovg.c:75
@ NVG_PT_BEVEL
Definition nanovg.c:77
@ NVG_PR_INNERBEVEL
Definition nanovg.c:78
void nvgRotate(NVGcontext *ctx, float angle)
Definition nanovg.c:790
static void nvg__pathWinding(NVGcontext *ctx, int winding)
Definition nanovg.c:1277
NVGcodepointType
Definition nanovg.c:2688
@ NVG_NEWLINE
Definition nanovg.c:2690
@ NVG_CHAR
Definition nanovg.c:2691
@ NVG_SPACE
Definition nanovg.c:2689
@ NVG_CJK_CHAR
Definition nanovg.c:2692
static float nvg__clampf(float a, float mn, float mx)
Definition nanovg.c:168
static float nvg__acosf(float a)
Definition nanovg.c:159
#define NVG_MAX_FONTIMAGES
Definition nanovg.c:52
#define NVG_INIT_COMMANDS_SIZE
Definition nanovg.c:54
NVGpaint nvgImagePattern(NVGcontext *ctx, float cx, float cy, float w, float h, float angle, int image, float alpha)
Definition nanovg.c:1005
static void nvg__setPaintColor(NVGpaint *p, NVGcolor color)
Definition nanovg.c:651
static void nvg__setDevicePixelRatio(NVGcontext *ctx, float ratio)
Definition nanovg.c:219
void nvgTextBox(NVGcontext *ctx, float x, float y, float breakRowWidth, const char *string, const char *end)
Definition nanovg.c:2612
void nvgTint(NVGcontext *ctx, NVGcolor tint)
Definition nanovg.c:761
static void nvg__calculateJoins(NVGcontext *ctx, float w, int lineJoin, float miterLimit)
Definition nanovg.c:1721
NVGcolor nvgTransRGBAf(NVGcolor c, float a)
Definition nanovg.c:497
static float nvg__signf(float a)
Definition nanovg.c:167
static void nvg__renderText(NVGcontext *ctx, NVGvertex *verts, int nverts)
Definition nanovg.c:2511
NVGpaint nvgRadialGradient(NVGcontext *ctx, float cx, float cy, float inr, float outr, NVGcolor icol, NVGcolor ocol)
Definition nanovg.c:952
static int nvg__isTransformFlipped(const float *xform)
Definition nanovg.c:2532
void nvgBeginFrame(NVGcontext *ctx, float windowWidth, float windowHeight, float devicePixelRatio)
Definition nanovg.c:404
int nvgCreateImageRGBA(NVGcontext *ctx, int w, int h, int imageFlags, const unsigned char *data)
Definition nanovg.c:891
#define NVG_INIT_VERTS_SIZE
Definition nanovg.c:57
int nvgCreateFontAtIndex(NVGcontext *ctx, const char *name, const char *filename, const int fontIndex)
Definition nanovg.c:2370
void nvgAlpha(NVGcontext *ctx, float alpha)
Definition nanovg.c:755
void nvgArcTo(NVGcontext *ctx, float x1, float y1, float x2, float y2, float radius)
Definition nanovg.c:2072
void nvgShapeAntiAlias(NVGcontext *ctx, int enabled)
Definition nanovg.c:707
void nvgGlobalCompositeOperation(NVGcontext *ctx, int op)
Definition nanovg.c:1096
static float nvg__minf(float a, float b)
Definition nanovg.c:164
static void nvg__tesselateBezier(NVGcontext *ctx, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, int level, int type)
Definition nanovg.c:1349
static float nvg__maxf(float a, float b)
Definition nanovg.c:165
int nvgCreateFont(NVGcontext *ctx, const char *name, const char *filename)
Definition nanovg.c:2365
void nvgEllipse(NVGcontext *ctx, float cx, float cy, float rx, float ry)
Definition nanovg.c:2250
void nvgGlobalAlpha(NVGcontext *ctx, float alpha)
Definition nanovg.c:737
NVGcommands
Definition nanovg.c:65
@ NVG_LINETO
Definition nanovg.c:67
@ NVG_MOVETO
Definition nanovg.c:66
@ NVG_BEZIERTO
Definition nanovg.c:68
@ NVG_WINDING
Definition nanovg.c:70
@ NVG_CLOSE
Definition nanovg.c:69
static float nvg__triarea2(float ax, float ay, float bx, float by, float cx, float cy)
Definition nanovg.c:1305
float nvgTextBounds(NVGcontext *ctx, float x, float y, const char *string, const char *end, float *bounds)
Definition nanovg.c:2901
static int nvg__expandFill(NVGcontext *ctx, float w, int lineJoin, float miterLimit)
Definition nanovg.c:1915
static NVGpoint * nvg__lastPoint(NVGcontext *ctx)
Definition nanovg.c:1230
static void nvg__vset(NVGvertex *vtx, float x, float y, float u, float v)
Definition nanovg.c:1341
static void nvg__appendCommands(NVGcontext *ctx, float *vals, int nvals)
Definition nanovg.c:1143
void nvgScissor(NVGcontext *ctx, float x, float y, float w, float h)
Definition nanovg.c:1028
void nvgTransformPoint(float *dx, float *dy, const float *t, float sx, float sy)
Definition nanovg.c:635
static int nvg__mini(int a, int b)
Definition nanovg.c:161
void nvgStrokeWidth(NVGcontext *ctx, float width)
Definition nanovg.c:713
void nvgQuadTo(NVGcontext *ctx, float cx, float cy, float x, float y)
Definition nanovg.c:2061
void nvgTransformMultiply(float *t, const float *s)
Definition nanovg.c:597
void nvgTransformPremultiply(float *t, const float *s)
Definition nanovg.c:610
NVGcolor nvgTransRGBA(NVGcolor c, unsigned char a)
Definition nanovg.c:491
void nvgGlobalCompositeBlendFuncSeparate(NVGcontext *ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha)
Definition nanovg.c:1107
int nvgFindFont(NVGcontext *ctx, const char *name)
Definition nanovg.c:2385
void nvgResetFallbackFonts(NVGcontext *ctx, const char *baseFont)
Definition nanovg.c:2408
static NVGvertex * nvg__roundJoin(NVGvertex *dst, NVGpoint *p0, NVGpoint *p1, float lw, float rw, float lu, float ru, int ncap, float fringe)
Definition nanovg.c:1513
NVGpaint nvgLinearGradient(NVGcontext *ctx, float sx, float sy, float ex, float ey, NVGcolor icol, NVGcolor ocol)
Definition nanovg.c:913
NVGcolor nvgRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Definition nanovg.c:469
void nvgResetScissor(NVGcontext *ctx)
Definition nanovg.c:1087
void nvgTransformRotate(float *t, float a)
Definition nanovg.c:575
static NVGvertex * nvg__buttCapStart(NVGvertex *dst, NVGpoint *p, float dx, float dy, float w, float d, float aa, float u0, float u1)
Definition nanovg.c:1647
NVGcolor nvgRGBAf(float r, float g, float b, float a)
Definition nanovg.c:480
int nvgTextGlyphPositions(NVGcontext *ctx, float x, float y, const char *string, const char *end, NVGglyphPosition *positions, int maxPositions)
Definition nanovg.c:2645
static float nvg__tanf(float a)
Definition nanovg.c:157
void nvgTransformIdentity(float *t)
Definition nanovg.c:554
#define NVG_INIT_FONTIMAGE_SIZE
Definition nanovg.c:50
void nvgTransformScale(float *t, float sx, float sy)
Definition nanovg.c:568
static float nvg__quantize(float a, float d)
Definition nanovg.c:2456
#define NVG_INIT_PATHS_SIZE
Definition nanovg.c:56
void nvgCurrentTransform(NVGcontext *ctx, float *xform)
Definition nanovg.c:822
NVGcontext * nvgCreateInternal(NVGparams *params, NVGcontext *other)
Definition nanovg.c:305
static void nvg__addPoint(NVGcontext *ctx, float x, float y, int flags)
Definition nanovg.c:1237
static float nvg__getFontScale(NVGstate *state)
Definition nanovg.c:2461
static void nvg__flattenPaths(NVGcontext *ctx)
Definition nanovg.c:1392
int nvgCreateImage(NVGcontext *ctx, const char *filename, int imageFlags)
Definition nanovg.c:856
void nvgMiterLimit(NVGcontext *ctx, float limit)
Definition nanovg.c:719
float nvgText(NVGcontext *ctx, float x, float y, const char *string, const char *end)
Definition nanovg.c:2538
int nvgCreateFontMem(NVGcontext *ctx, const char *name, unsigned char *data, int ndata, int freeData)
Definition nanovg.c:2375
static NVGcompositeOperationState nvg__compositeOperationState(int op)
Definition nanovg.c:227
void nvgTransformSkewY(float *t, float a)
Definition nanovg.c:590
void nvgRect(NVGcontext *ctx, float x, float y, float w, float h)
Definition nanovg.c:2205
void nvgImageSize(NVGcontext *ctx, int image, int *w, int *h)
Definition nanovg.c:903
void nvgBeginPath(NVGcontext *ctx)
Definition nanovg.c:2037
void nvgFill(NVGcontext *ctx)
Definition nanovg.c:2290
static int nvg__ptEquals(float x1, float y1, float x2, float y2, float tol)
Definition nanovg.c:1119
void nvgTransformTranslate(float *t, float tx, float ty)
Definition nanovg.c:561
static NVGvertex * nvg__roundCapStart(NVGvertex *dst, NVGpoint *p, float dx, float dy, float w, int ncap, float aa, float u0, float u1)
Definition nanovg.c:1678
NVGcolor nvgRGB(unsigned char r, unsigned char g, unsigned char b)
Definition nanovg.c:459
int nvgAddFallbackFontId(NVGcontext *ctx, int baseFont, int fallbackFont)
Definition nanovg.c:2392
void nvgFontSize(NVGcontext *ctx, float size)
Definition nanovg.c:2414
void nvgClosePath(NVGcontext *ctx)
Definition nanovg.c:2128
void nvgCircle(NVGcontext *ctx, float cx, float cy, float r)
Definition nanovg.c:2263
#define NVG_SKIPPED_CHAR
Definition nanovg.c:36
void nvgTextAlign(NVGcontext *ctx, int align)
Definition nanovg.c:2438
static void nvg__flushTextTexture(NVGcontext *ctx)
Definition nanovg.c:2466
void nvgPathWinding(NVGcontext *ctx, int dir)
Definition nanovg.c:2134
static float nvg__absf(float a)
Definition nanovg.c:166
static NVGvertex * nvg__roundCapEnd(NVGvertex *dst, NVGpoint *p, float dx, float dy, float w, int ncap, float aa, float u0, float u1)
Definition nanovg.c:1699
void nvgTextLineHeight(NVGcontext *ctx, float lineHeight)
Definition nanovg.c:2432
#define NVG_MAX_STATES
Definition nanovg.c:58
static float nvg__polyArea(NVGpoint *pts, int npts)
Definition nanovg.c:1314
int nvgTextBreakLines(NVGcontext *ctx, const char *string, const char *end, float breakRowWidth, NVGtextRow *rows, int maxRows)
Definition nanovg.c:2695
static void nvg__chooseBevel(int bevel, NVGpoint *p0, NVGpoint *p1, float w, float *x0, float *y0, float *x1, float *y1)
Definition nanovg.c:1497
void nvgSkewY(NVGcontext *ctx, float angle)
Definition nanovg.c:806
void nvgEndFrame(NVGcontext *ctx)
Definition nanovg.c:429
NVGcolor nvgRGBf(float r, float g, float b)
Definition nanovg.c:464
void nvgLineTo(NVGcontext *ctx, float x, float y)
Definition nanovg.c:2049
static int nvg__clampi(int a, int mn, int mx)
Definition nanovg.c:163
void nvgFontFaceId(NVGcontext *ctx, int font)
Definition nanovg.c:2444
void nvgTextLetterSpacing(NVGcontext *ctx, float spacing)
Definition nanovg.c:2426
void nvgDeleteImage(NVGcontext *ctx, int image)
Definition nanovg.c:908
static int nvg__expandStroke(NVGcontext *ctx, float w, float fringe, int lineCap, int lineJoin, float miterLimit)
Definition nanovg.c:1791
static int nvg__maxi(int a, int b)
Definition nanovg.c:162
static int nvg__allocTextAtlas(NVGcontext *ctx)
Definition nanovg.c:2485
void nvgBezierTo(NVGcontext *ctx, float c1x, float c1y, float c2x, float c2y, float x, float y)
Definition nanovg.c:2055
int nvgAddFallbackFont(NVGcontext *ctx, const char *baseFont, const char *fallbackFont)
Definition nanovg.c:2398
static NVGpath * nvg__lastPath(NVGcontext *ctx)
Definition nanovg.c:1204
static float nvg__distPtSeg(float x, float y, float px, float py, float qx, float qy)
Definition nanovg.c:1126
void nvgTextBoxBounds(NVGcontext *ctx, float x, float y, float breakRowWidth, const char *string, const char *end, float *bounds)
Definition nanovg.c:2928
void nvgLineJoin(NVGcontext *ctx, int join)
Definition nanovg.c:731
void nvgStrokePaint(NVGcontext *ctx, NVGpaint paint)
Definition nanovg.c:835
void nvgTranslate(NVGcontext *ctx, float x, float y)
Definition nanovg.c:782
int nvgTransformInverse(float *inv, const float *t)
Definition nanovg.c:618
static float nvg__modf(float a, float b)
Definition nanovg.c:154
static NVGstate * nvg__getState(NVGcontext *ctx)
Definition nanovg.c:300
float nvgDegToRad(float deg)
Definition nanovg.c:641
int nvgCreateImageMem(NVGcontext *ctx, int imageFlags, unsigned char *data, int ndata)
Definition nanovg.c:872
int nvgCreateFontMemAtIndex(NVGcontext *ctx, const char *name, unsigned char *data, int ndata, int freeData, const int fontIndex)
Definition nanovg.c:2380
float nvgRadToDeg(float rad)
Definition nanovg.c:646
#define NVG_MAX_FONTIMAGE_SIZE
Definition nanovg.c:51
void nvgTransformSkewX(float *t, float a)
Definition nanovg.c:583
static void nvg__isectRects(float *dst, float ax, float ay, float aw, float ah, float bx, float by, float bw, float bh)
Definition nanovg.c:1044
static int nvg__curveDivs(float r, float arc, float tol)
Definition nanovg.c:1491
#define NVG_COUNTOF(arr)
Definition nanovg.c:62
void nvgDeleteInternal(NVGcontext *ctx)
Definition nanovg.c:377
void nvgStroke(NVGcontext *ctx)
Definition nanovg.c:2321
void nvgGlobalCompositeBlendFunc(NVGcontext *ctx, int sfactor, int dfactor)
Definition nanovg.c:1102
void nvgIntersectScissor(NVGcontext *ctx, float x, float y, float w, float h)
Definition nanovg.c:1058
void nvgTransform(NVGcontext *ctx, float a, float b, float c, float d, float e, float f)
Definition nanovg.c:769
void nvgFontFace(NVGcontext *ctx, const char *font)
Definition nanovg.c:2450
void nvgLineCap(NVGcontext *ctx, int cap)
Definition nanovg.c:725
static float nvg__cosf(float a)
Definition nanovg.c:156
void nvgScale(NVGcontext *ctx, float x, float y)
Definition nanovg.c:814
static void nvg__deletePathCache(NVGpathCache *c)
Definition nanovg.c:183
void nvgStrokeColor(NVGcontext *ctx, NVGcolor color)
Definition nanovg.c:829
static float nvg__hue(float h, float m1, float m2)
Definition nanovg.c:524
void nvgGlobalTint(NVGcontext *ctx, NVGcolor tint)
Definition nanovg.c:743
void nvgRoundedRectVarying(NVGcontext *ctx, float x, float y, float w, float h, float radTopLeft, float radTopRight, float radBottomRight, float radBottomLeft)
Definition nanovg.c:2222
static void nvg__addPath(NVGcontext *ctx)
Definition nanovg.c:1211
static float nvg__atan2f(float a, float b)
Definition nanovg.c:158
void nvgCancelFrame(NVGcontext *ctx)
Definition nanovg.c:424
NVGparams * nvgInternalParams(NVGcontext *ctx)
Definition nanovg.c:372
NVGcolor nvgLerpRGBA(NVGcolor c0, NVGcolor c1, float u)
Definition nanovg.c:503
void nvgUpdateImage(NVGcontext *ctx, int image, const unsigned char *data)
Definition nanovg.c:896
static float nvg__normalize(float *x, float *y)
Definition nanovg.c:171
void nvgSkewX(NVGcontext *ctx, float angle)
Definition nanovg.c:798
void nvgFontBlur(NVGcontext *ctx, float blur)
Definition nanovg.c:2420
void nvgMoveTo(NVGcontext *ctx, float x, float y)
Definition nanovg.c:2043
void nvgTextMetrics(NVGcontext *ctx, float *ascender, float *descender, float *lineh)
Definition nanovg.c:2997
NVGcolor nvgGetGlobalTint(NVGcontext *ctx)
Definition nanovg.c:749
NVGpaint nvgBoxGradient(NVGcontext *ctx, float x, float y, float w, float h, float r, float f, NVGcolor icol, NVGcolor ocol)
Definition nanovg.c:979
void nvgArc(NVGcontext *ctx, float cx, float cy, float r, float a0, float a1, int dir)
Definition nanovg.c:2140
NVGcolor nvgHSLA(float h, float s, float l, unsigned char a)
Definition nanovg.c:537
void nvgReset(NVGcontext *ctx)
Definition nanovg.c:679
void nvgResetFallbackFontsId(NVGcontext *ctx, int baseFont)
Definition nanovg.c:2403
static float nvg__getAverageScale(float *t)
Definition nanovg.c:1284
void nvgSave(NVGcontext *ctx)
Definition nanovg.c:663
static NVGpathCache * nvg__allocPathCache(void)
Definition nanovg.c:192
NVGcolor nvgHSL(float h, float s, float l)
Definition nanovg.c:519
static float nvg__sinf(float a)
Definition nanovg.c:155
static NVGvertex * nvg__bevelJoin(NVGvertex *dst, NVGpoint *p0, NVGpoint *p1, float lw, float rw, float lu, float ru, float fringe)
Definition nanovg.c:1574
#define NVG_INIT_POINTS_SIZE
Definition nanovg.c:55
void nvgFillPaint(NVGcontext *ctx, NVGpaint paint)
Definition nanovg.c:848
static void nvg__clearPathCache(NVGcontext *ctx)
Definition nanovg.c:1198
void nvgResetTransform(NVGcontext *ctx)
Definition nanovg.c:776
void nvgRestore(NVGcontext *ctx)
Definition nanovg.c:672
#define NVG_FONT_TEXTURE_FLAGS
Definition nanovg.c:40
#define NVG_KAPPA90
Definition nanovg.c:60
static float nvg__cross(float dx0, float dy0, float dx1, float dy1)
Definition nanovg.c:169
static void nvg__polyReverse(NVGpoint *pts, int npts)
Definition nanovg.c:1327
int nvgCreateImageRaw(NVGcontext *ctx, int w, int h, int imageFlags, NVGtexture format, const unsigned char *data)
Definition nanovg.c:886
static void nvg__closePath(NVGcontext *ctx)
Definition nanovg.c:1270
void nvgFillColor(NVGcontext *ctx, NVGcolor color)
Definition nanovg.c:842
static NVGvertex * nvg__allocTempVerts(NVGcontext *ctx, int nverts)
Definition nanovg.c:1291
void nvgDebugDumpPathCache(NVGcontext *ctx)
Definition nanovg.c:2268
@ NVG_ALIGN_MIDDLE
Definition nanovg.h:81
@ NVG_ALIGN_CENTER
Definition nanovg.h:77
@ NVG_ALIGN_LEFT
Definition nanovg.h:76
@ NVG_ALIGN_BOTTOM
Definition nanovg.h:82
@ NVG_ALIGN_BASELINE
Definition nanovg.h:83
@ NVG_ALIGN_TOP
Definition nanovg.h:80
@ NVG_ALIGN_RIGHT
Definition nanovg.h:78
@ NVG_ATOP
Definition nanovg.h:104
@ NVG_SOURCE_OVER
Definition nanovg.h:101
@ NVG_SOURCE_IN
Definition nanovg.h:102
@ NVG_DESTINATION_ATOP
Definition nanovg.h:108
@ NVG_DESTINATION_IN
Definition nanovg.h:106
@ NVG_SOURCE_OUT
Definition nanovg.h:103
@ NVG_XOR
Definition nanovg.h:111
@ NVG_DESTINATION_OVER
Definition nanovg.h:105
@ NVG_LIGHTER
Definition nanovg.h:109
@ NVG_COPY
Definition nanovg.h:110
@ NVG_DESTINATION_OUT
Definition nanovg.h:107
@ NVG_SRC_ALPHA
Definition nanovg.h:93
@ NVG_ONE_MINUS_SRC_ALPHA
Definition nanovg.h:94
@ NVG_ONE
Definition nanovg.h:88
@ NVG_ZERO
Definition nanovg.h:87
@ NVG_DST_ALPHA
Definition nanovg.h:95
@ NVG_ONE_MINUS_DST_ALPHA
Definition nanovg.h:96
@ NVG_CW
Definition nanovg.h:58
@ NVG_CCW
Definition nanovg.h:57
@ NVG_SQUARE
Definition nanovg.h:69
@ NVG_BUTT
Definition nanovg.h:67
@ NVG_MITER
Definition nanovg.h:71
@ NVG_BEVEL
Definition nanovg.h:70
@ NVG_ROUND
Definition nanovg.h:68
#define NVG_NOTUSED(v)
Definition nanovg.h:702
NVGtexture
Definition nanovg.h:147
@ NVG_TEXTURE_ALPHA
Definition nanovg.h:148
@ NVG_TEXTURE_RGBA
Definition nanovg.h:152
#define NVG_PI
Definition nanovg.h:26
Definition fontstash.h:57
int(* renderCreate)(void *uptr, int width, int height)
Definition fontstash.h:61
unsigned char flags
Definition fontstash.h:59
void(* renderDelete)(void *uptr)
Definition fontstash.h:65
void * userPtr
Definition fontstash.h:60
int height
Definition fontstash.h:58
void(* renderUpdate)(void *uptr, int *rect, const unsigned char *data)
Definition fontstash.h:63
int width
Definition fontstash.h:58
void(* renderDraw)(void *uptr, const float *verts, const float *tcoords, const unsigned int *colors, int nverts)
Definition fontstash.h:64
Definition fontstash.h:70
Definition fontstash.h:76
const char * next
Definition fontstash.h:83
float nextx
Definition fontstash.h:77
float x
Definition fontstash.h:77
unsigned int codepoint
Definition fontstash.h:78
int prevGlyphIndex
Definition fontstash.h:81
const char * str
Definition fontstash.h:82
float g
Definition nanovg.h:39
float a
Definition nanovg.h:39
float r
Definition nanovg.h:39
float b
Definition nanovg.h:39
float rgba[4]
Definition nanovg.h:37
int srcAlpha
Definition nanovg.h:117
int dstRGB
Definition nanovg.h:116
int srcRGB
Definition nanovg.h:115
int dstAlpha
Definition nanovg.h:118
int fillTriCount
Definition nanovg.c:148
float tessTol
Definition nanovg.c:142
NVGpathCache * cache
Definition nanovg.c:141
float distTol
Definition nanovg.c:143
float * commands
Definition nanovg.c:135
int drawCallCount
Definition nanovg.c:147
float fringeWidth
Definition nanovg.c:144
NVGparams params
Definition nanovg.c:134
int strokeTriCount
Definition nanovg.c:149
NVGfontContext * fontContext
Definition nanovg.c:146
float commandy
Definition nanovg.c:138
int ccommands
Definition nanovg.c:136
float commandx
Definition nanovg.c:138
float devicePxRatio
Definition nanovg.c:145
int nstates
Definition nanovg.c:140
int textTriCount
Definition nanovg.c:150
NVGstate states[NVG_MAX_STATES]
Definition nanovg.c:139
int ncommands
Definition nanovg.c:137
int fontImages[NVG_MAX_FONTIMAGES]
Definition nanovg.c:128
struct FONScontext * fs
Definition nanovg.c:127
int refCount
Definition nanovg.c:126
int fontImageIdx
Definition nanovg.c:129
float minx
Definition nanovg.h:125
float x
Definition nanovg.h:124
const char * str
Definition nanovg.h:123
float maxx
Definition nanovg.h:125
float xform[6]
Definition nanovg.h:46
NVGcolor innerColor
Definition nanovg.h:50
int image
Definition nanovg.h:52
NVGcolor outerColor
Definition nanovg.h:51
int(* renderUpdateTexture)(void *uptr, int image, int x, int y, int w, int h, const unsigned char *data)
Definition nanovg.h:677
int(* renderGetTextureSize)(void *uptr, int image, int *w, int *h)
Definition nanovg.h:678
int edgeAntiAlias
Definition nanovg.h:673
void(* renderFlush)(void *uptr)
Definition nanovg.h:681
int(* renderCreate)(void *uptr, void *otherUptr)
Definition nanovg.h:674
int(* renderCreateTexture)(void *uptr, int type, int w, int h, int imageFlags, const unsigned char *data)
Definition nanovg.h:675
void * userPtr
Definition nanovg.h:672
void(* renderTriangles)(void *uptr, NVGpaint *paint, NVGcompositeOperationState compositeOperation, NVGscissor *scissor, const NVGvertex *verts, int nverts, float fringe)
Definition nanovg.h:684
void(* renderDelete)(void *uptr)
Definition nanovg.h:685
void(* renderStroke)(void *uptr, NVGpaint *paint, NVGcompositeOperationState compositeOperation, NVGscissor *scissor, float fringe, float strokeWidth, const NVGpath *paths, int npaths)
Definition nanovg.h:683
int(* renderDeleteTexture)(void *uptr, int image)
Definition nanovg.h:676
void(* renderFill)(void *uptr, NVGpaint *paint, NVGcompositeOperationState compositeOperation, NVGscissor *scissor, float fringe, const float *bounds, const NVGpath *paths, int npaths)
Definition nanovg.h:682
void(* renderCancel)(void *uptr)
Definition nanovg.h:680
void(* renderViewport)(void *uptr, float width, float height, float devicePixelRatio)
Definition nanovg.h:679
NVGpath * paths
Definition nanovg.c:115
NVGpoint * points
Definition nanovg.c:112
int cverts
Definition nanovg.c:120
int nverts
Definition nanovg.c:119
int cpoints
Definition nanovg.c:114
int cpaths
Definition nanovg.c:117
int npoints
Definition nanovg.c:113
float bounds[4]
Definition nanovg.c:121
NVGvertex * verts
Definition nanovg.c:118
int npaths
Definition nanovg.c:116
int nfill
Definition nanovg.h:663
NVGvertex * stroke
Definition nanovg.h:664
int count
Definition nanovg.h:659
int first
Definition nanovg.h:658
int convex
Definition nanovg.h:667
unsigned char closed
Definition nanovg.h:660
NVGvertex * fill
Definition nanovg.h:662
int nstroke
Definition nanovg.h:665
int nbevel
Definition nanovg.h:661
int winding
Definition nanovg.h:666
float dx
Definition nanovg.c:104
unsigned char flags
Definition nanovg.c:107
float x
Definition nanovg.c:103
float dy
Definition nanovg.c:104
float y
Definition nanovg.c:103
float len
Definition nanovg.c:105
float dmy
Definition nanovg.c:106
float dmx
Definition nanovg.c:106
float xform[6]
Definition nanovg.h:647
float extent[2]
Definition nanovg.h:648
float strokeWidth
Definition nanovg.c:86
NVGpaint stroke
Definition nanovg.c:85
float miterLimit
Definition nanovg.c:87
float lineHeight
Definition nanovg.c:95
float letterSpacing
Definition nanovg.c:94
NVGpaint fill
Definition nanovg.c:84
float fontSize
Definition nanovg.c:93
int lineJoin
Definition nanovg.c:88
NVGcompositeOperationState compositeOperation
Definition nanovg.c:82
int fontId
Definition nanovg.c:98
NVGscissor scissor
Definition nanovg.c:92
int textAlign
Definition nanovg.c:97
NVGcolor tint
Definition nanovg.c:90
int lineCap
Definition nanovg.c:89
float fontBlur
Definition nanovg.c:96
float xform[6]
Definition nanovg.c:91
int shapeAntiAlias
Definition nanovg.c:83
float maxx
Definition nanovg.h:134
const char * end
Definition nanovg.h:131
const char * next
Definition nanovg.h:132
float width
Definition nanovg.h:133
float minx
Definition nanovg.h:134
const char * start
Definition nanovg.h:130
float u
Definition nanovg.h:653
float y
Definition nanovg.h:653
float v
Definition nanovg.h:653
float x
Definition nanovg.h:653
int n
Definition crypt.c:458
uch * p
Definition crypt.c:594
return c
Definition crypt.c:175
memcpy(hh, h, RAND_HEAD_LEN)
int r
Definition crypt.c:458
uch h[RAND_HEAD_LEN]
Definition crypt.c:459
register uch * q
Definition fileio.c:817
typedef int(UZ_EXP MsgFn)()
dy
Definition zipinfo.c:2288
_WDL_CSTRING_PREFIX void INT_PTR const char * format
Definition wdlcstring.h:263