MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / deleteExtendedNSVGimage

Function deleteExtendedNSVGimage

src/custom/dep.cpp:1162–1199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1160}
1161
1162static inline
1163void deleteExtendedNSVGimage(ExtendedNSVGimage& ext)
1164{
1165 if (ext.shapesMOD != nullptr)
1166 {
1167 // delete duplicated resources
1168 for (NSVGshape *next, *shape = ext.shapesMOD;;)
1169 {
1170 next = shape->next;
1171
1172 nsvg__deletePaint(&shape->fill);
1173 nsvg__deletePaint(&shape->stroke);
1174 std::free(shape);
1175
1176 if (next == nullptr)
1177 break;
1178
1179 shape = next;
1180 }
1181
1182 // revert shapes back to original
1183 ext.handle->shapes = ext.shapesOrig;
1184 ext.shapesMOD = nullptr;
1185 }
1186
1187 if (ext.handleMOD != nullptr)
1188 {
1189 nsvgDelete(ext.handleMOD);
1190 ext.handleMOD = nullptr;
1191 }
1192
1193 if (ext.handleOrig != nullptr)
1194 {
1195 std::memcpy(ext.handle, ext.handleOrig, sizeof(NSVGimage));
1196 std::free(ext.handleOrig);
1197 ext.handleOrig = nullptr;
1198 }
1199}
1200#endif // HEADLESS
1201
1202NSVGimage* nsvgParseFromFileCardinal(const char* const filename, const char* const units, const float dpi)

Callers 2

nsvgDeleteCardinalFunction · 0.85
destroyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected