MCPcopy Create free account
hub / github.com/MyGUI/mygui / parseColoring

Function parseColoring

MyGUIEngine/src/msdfgen/main.cpp:113–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113static void parseColoring(Shape &shape, const char *edgeAssignment) {
114 unsigned c = 0, e = 0;
115 if (shape.contours.size() < c) return;
116 Contour *contour = &shape.contours[c];
117 bool change = false;
118 bool clear = true;
119 for (const char *in = edgeAssignment; *in; ++in) {
120 switch (*in) {
121 case ',':
122 if (change)
123 ++e;
124 if (clear)
125 while (e < contour->edges.size()) {
126 contour->edges[e]->color = WHITE;
127 ++e;
128 }
129 ++c, e = 0;
130 if (shape.contours.size() <= c) return;
131 contour = &shape.contours[c];
132 change = false;
133 clear = true;
134 break;
135 case '?':
136 clear = false;
137 break;
138 case 'C': case 'M': case 'W': case 'Y': case 'c': case 'm': case 'w': case 'y':
139 if (change) {
140 ++e;
141 change = false;
142 }
143 if (e < contour->edges.size()) {
144 contour->edges[e]->color = EdgeColor(
145 (*in == 'C' || *in == 'c')*CYAN|
146 (*in == 'M' || *in == 'm')*MAGENTA|
147 (*in == 'Y' || *in == 'y')*YELLOW|
148 (*in == 'W' || *in == 'w')*WHITE);
149 change = true;
150 }
151 break;
152 }
153 }
154}
155
156#ifdef MSDFGEN_EXTENSIONS
157static bool parseUnicode(unicode_t &unicode, const char *arg) {

Callers 1

mainFunction · 0.85

Calls 2

EdgeColorEnum · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected