MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / nsvg__addPath

Function nsvg__addPath

rEFIt_UEFI/libeg/nanosvg.cpp:1092–1139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1090}
1091
1092static void nsvg__addPath(NSVGparser* p, char closed)
1093{
1094 // NSVGattrib* attr = nsvg__getAttr(p);
1095 NSVGpath* path = NULL;
1096 float bounds[4];
1097 float* curve;
1098 int i;
1099
1100 if (p->npts < 4)
1101 return;
1102
1103 if (closed)
1104 nsvg__lineTo(p, p->pts[0], p->pts[1]);
1105
1106 path = (NSVGpath*)AllocateZeroPool(sizeof(NSVGpath));
1107 if (path == NULL) {
1108 return;
1109 }
1110 path->pts = (float*)AllocateZeroPool(p->npts*2*sizeof(float));
1111 if (path->pts == NULL) {
1112 FreePool(path);
1113 return;
1114 }
1115 path->closed = closed;
1116 path->npts = p->npts;
1117
1118 memcpy(path->pts, p->pts, p->npts * 2 * sizeof(float));
1119
1120 // Find bounds
1121 for (i = 0; i < path->npts-1; i += 3) {
1122 curve = &path->pts[i*2];
1123 nsvg__curveBounds(bounds, curve);
1124 if (i == 0) {
1125 path->bounds[0] = bounds[0];
1126 path->bounds[1] = bounds[1];
1127 path->bounds[2] = bounds[2];
1128 path->bounds[3] = bounds[3];
1129 } else {
1130 path->bounds[0] = nsvg__minf(path->bounds[0], bounds[0]);
1131 path->bounds[1] = nsvg__minf(path->bounds[1], bounds[1]);
1132 path->bounds[2] = nsvg__maxf(path->bounds[2], bounds[2]);
1133 path->bounds[3] = nsvg__maxf(path->bounds[3], bounds[3]);
1134 }
1135 }
1136 path->next = p->plist;
1137 p->plist = path;
1138 return;
1139}
1140
1141//Slice - replace by own implementation
1142#ifdef USE_ATOF

Callers 6

nsvg__parsePathFunction · 0.85
nsvg__parseRectFunction · 0.85
nsvg__parseCircleFunction · 0.85
nsvg__parseEllipseFunction · 0.85
nsvg__parseLineFunction · 0.85
nsvg__parsePolyFunction · 0.85

Calls 7

nsvg__lineToFunction · 0.85
nsvg__curveBoundsFunction · 0.85
nsvg__minfFunction · 0.85
nsvg__maxfFunction · 0.85
AllocateZeroPoolFunction · 0.50
FreePoolFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected