GCC Code Coverage Report


Directory: ./
File: channeloutput/PanelMatrix.cpp
Date: 2026-12-01 12:27:28
Exec Total Coverage
Lines: 237 300 79.0%
Functions: 8 10 80.0%
Branches: 174 248 70.2%

Line Branch Exec Source
1 /*
2 * This file is part of the Falcon Player (FPP) and is Copyright (C)
3 * 2013-2022 by the Falcon Player Developers.
4 *
5 * The Falcon Player (FPP) is free software, and is covered under
6 * multiple Open Source licenses. Please see the included 'LICENSES'
7 * file for descriptions of what files are covered by each license.
8 *
9 * This source file is covered under the LGPL v2.1 as described in the
10 * included LICENSE.LGPL file.
11 */
12
13 #include "fpp-pch.h"
14
15 #include "../common.h"
16 #include "../log.h"
17
18 #include "../Sequence.h"
19 #include "PanelMatrix.h"
20
21 199 PanelMatrix::PanelMatrix(int panelWidth, int panelHeight, int invertedData) :
22 199 m_width(0),
23 199 m_height(0),
24 199 m_outputCount(0),
25 199 m_pixelCount(0),
26 199 m_panelCount(0),
27 199 m_panelWidth(panelWidth),
28 199 m_panelHeight(panelHeight),
29
2/2
✓ Branch 0 taken 114624 times.
✓ Branch 1 taken 199 times.
114823 m_invertedData(invertedData) {
30 199 }
31
32
3/6
✓ Branch 0 taken 199 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 199 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 199 times.
✗ Branch 5 not taken.
124773 PanelMatrix::~PanelMatrix() {
33
6/6
✓ Branch 0 taken 114624 times.
✓ Branch 1 taken 199 times.
✓ Branch 2 taken 4776 times.
✓ Branch 3 taken 199 times.
✓ Branch 4 taken 4776 times.
✓ Branch 5 taken 199 times.
124829 }
34
35 ✗ int PanelMatrix::ConfigurePanels(std::string layout) {
36 ✗ int result = 1;
37
38 ✗ LogDebug(VB_CHANNELOUT, "Parsing Config: '%s'\n", layout.c_str());
39
40 ✗ std::vector<std::string> panels = split(layout, '|');
41
42 ✗ for (int i = 0; i < panels.size(); i++) {
43 ✗ result &= AddPanel(panels[i]);
44 }
45
46 ✗ if (result)
47 ✗ CalculateMaps();
48
49 ✗ return result;
50 ✗ }
51
52 ✗ int PanelMatrix::AddPanel(std::string config) {
53 ✗ int output = 0;
54 ✗ int chain = 0;
55 ✗ int xOffset = 0;
56 ✗ int yOffset = 0;
57 ✗ char orientation = 'N';
58
59 ✗ std::vector<std::string> elems = split(config, ':');
60
61 ✗ if (elems.size() == 5) {
62 ✗ output = atoi(elems[0].c_str());
63 ✗ chain = atoi(elems[1].c_str());
64 ✗ xOffset = atoi(elems[3].c_str());
65 ✗ yOffset = atoi(elems[4].c_str());
66
67 ✗ if (elems[2].size())
68 ✗ orientation = elems[2].c_str()[0];
69 } else {
70 ✗ LogErr(VB_CHANNELOUT, "Invalid Panel Config: '%s'\n", config.c_str());
71 ✗ return 0;
72 }
73
74 ✗ return AddPanel(output, chain, orientation, xOffset, yOffset);
75 ✗ }
76
77 261 int PanelMatrix::AddPanel(int output, int chain, char orientation,
78 int xOffset, int yOffset, FPPColorOrder colorOrder) {
79 261 int pWidth = m_panelWidth;
80 261 int pHeight = m_panelHeight;
81
82 // These come straight from the config. The UI only produces valid ones,
83 // but out of range they index m_outputPanels and the drivers' per-output
84 // tables, and a negative offset puts pixels before the frame.
85
6/10
✓ Branch 0 taken 261 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 261 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 261 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 260 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 260 times.
✗ Branch 9 not taken.
261 if (output < 0 || output >= MAX_MATRIX_OUTPUTS || chain < 0 || chain >= MAX_PANELS_PER_OUTPUT ||
86
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
260 xOffset < 0 || yOffset < 0) {
87 1 LogErr(VB_CHANNELOUT, "Invalid panel: output %d, chain %d, offset %d,%d\n", output, chain, xOffset, yOffset);
88 1 return 0;
89 }
90
91 // Orientation, Left, Right, Normal, Upside down
92
4/4
✓ Branch 0 taken 259 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 258 times.
260 if ((orientation == 'L') || (orientation == 'R')) {
93 2 pWidth = m_panelHeight;
94 2 pHeight = m_panelWidth;
95
4/4
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 253 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
258 } else if ((orientation != 'N') && (orientation != 'U')) {
96 1 LogErr(VB_CHANNELOUT, "Invalid orientation '%c'\n",
97 orientation);
98 1 return 0;
99 }
100
101 // Nor may an offset grow the matrix past what the channel buffer holds:
102 // m_width * m_height * 3 is the outputs' channel count, and offsets in
103 // the millions overflowed it (and the pixel maps sized from it).
104 259 int64_t newWidth = std::max<int64_t>(m_width, (int64_t)xOffset + pWidth);
105 259 int64_t newHeight = std::max<int64_t>(m_height, (int64_t)yOffset + pHeight);
106
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 258 times.
259 if (newWidth * newHeight * 3 > (int64_t)FPPD_MAX_CHANNELS) {
107 1 LogErr(VB_CHANNELOUT, "Invalid panel: offset %d,%d makes the matrix %lldx%lld, more than %d channels\n",
108 xOffset, yOffset, (long long)newWidth, (long long)newHeight, FPPD_MAX_CHANNELS);
109 1 return 0;
110 }
111
112
2/2
✓ Branch 0 taken 244 times.
✓ Branch 1 taken 14 times.
258 if ((xOffset + pWidth) > m_width) {
113 244 m_width = xOffset + pWidth;
114 244 m_pixelCount = m_width * m_height;
115 }
116
117
2/2
✓ Branch 0 taken 213 times.
✓ Branch 1 taken 45 times.
258 if ((yOffset + pHeight) > m_height) {
118 213 m_height = yOffset + pHeight;
119 213 m_pixelCount = m_width * m_height;
120 }
121
122
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 242 times.
258 if (output > m_outputCount)
123 16 m_outputCount = output;
124
125
3/6
✓ Branch 0 taken 258 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 258 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 258 times.
✗ Branch 5 not taken.
516 if ((m_panelCount < MAX_MATRIX_PANELS) &&
126 258 (m_outputPanels[output].size() < MAX_PANELS_PER_OUTPUT)) {
127 258 m_panels[m_panelCount].output = output;
128 258 m_panels[m_panelCount].chain = chain;
129 258 m_panels[m_panelCount].width = pWidth;
130 258 m_panels[m_panelCount].height = pHeight;
131 258 m_panels[m_panelCount].orientation = orientation;
132 258 m_panels[m_panelCount].xOffset = xOffset;
133 258 m_panels[m_panelCount].yOffset = yOffset;
134 258 m_panels[m_panelCount].colorOrder = colorOrder;
135
136 258 m_panels[m_panelCount].pixelMap.resize(pWidth * pHeight * 3);
137
138 258 m_outputPanels[output].push_back(m_panelCount);
139
140
2/4
✓ Branch 0 taken 258 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 258 times.
✗ Branch 3 not taken.
258 LogDebug(VB_CHANNELOUT, "Added Panel %d of size %dx%d at %dx%d facing '%c'. Color Order: %s (%d). Matrix size now: %dx%d. Panel Count: %d, Output: %d, Chain: %d\n",
141 m_panelCount, pWidth, pHeight, xOffset, yOffset, orientation, ColorOrderToString(colorOrder).c_str(), (int)colorOrder, m_width, m_height, m_panelCount, output, chain);
142 258 m_panelCount++;
143 }
144
145 258 CalculateMaps();
146
147 258 return 1;
148 }
149
150 258 int PanelMatrix::CalculateMaps(void) {
151 258 LogDebug(VB_CHANNELOUT, "PanelMatrix::CalculateMaps(), %d panels\n",
152 m_panelCount);
153
154
2/2
✓ Branch 0 taken 618 times.
✓ Branch 1 taken 258 times.
876 for (int panel = 0; panel < m_panelCount; panel++) {
155 618 int mOffset = 0;
156 618 int pOffset = 0;
157 618 int xOffset = m_panels[panel].xOffset;
158 618 int yOffset = m_panels[panel].yOffset;
159 618 int pWidth = m_panels[panel].width;
160 618 int pHeight = m_panels[panel].height;
161
162 618 FPPColorOrder colorOrder = m_panels[panel].colorOrder;
163
164 // LogDebug(VB_CHANNELOUT, "P: %d, O: %c, Pos: %dx%d, w: %d, h: %d\n", panel, m_panels[panel].orientation, xOffset, yOffset, pWidth, pHeight);
165
1/2
✓ Branch 0 taken 618 times.
✗ Branch 1 not taken.
618 m_panels[panel].pixelMap.resize(pWidth * pHeight * 3);
166
167
2/2
✓ Branch 0 taken 11824 times.
✓ Branch 1 taken 618 times.
12442 for (int y = 0; y < pHeight; y++) {
168
2/2
✓ Branch 0 taken 499968 times.
✓ Branch 1 taken 11824 times.
511792 for (int x = 0; x < pWidth; x++) {
169
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 499968 times.
499968 if (m_invertedData)
170 ✗ mOffset = (((m_height - (yOffset + y) - 1) * m_width) + (xOffset + x));
171 else
172 499968 mOffset = (((yOffset + y) * m_width) + (xOffset + x));
173
174
4/5
✓ Branch 0 taken 495360 times.
✓ Branch 1 taken 3584 times.
✓ Branch 2 taken 512 times.
✓ Branch 3 taken 512 times.
✗ Branch 4 not taken.
499968 switch (m_panels[panel].orientation) {
175 495360 case 'N':
176 495360 pOffset = (y * pWidth) + x;
177 495360 break;
178 3584 case 'U':
179 3584 pOffset = (pWidth * pHeight) - ((y * pWidth) + x) - 1;
180 3584 break;
181 512 case 'L':
182 512 pOffset = (x * pHeight) + (pHeight - y - 1);
183 512 break;
184 512 case 'R':
185 512 pOffset = ((pWidth - x - 1) * pHeight) + y;
186 512 break;
187 }
188
189 499968 mOffset *= 3;
190 499968 pOffset *= 3;
191
192
2/2
✓ Branch 0 taken 496384 times.
✓ Branch 1 taken 3584 times.
499968 if (colorOrder == FPPColorOrder::kColorOrderRGB) {
193 496384 m_panels[panel].pixelMap[pOffset] = mOffset;
194 496384 m_panels[panel].pixelMap[pOffset + 1] = mOffset + 1;
195 496384 m_panels[panel].pixelMap[pOffset + 2] = mOffset + 2;
196
2/2
✓ Branch 0 taken 512 times.
✓ Branch 1 taken 3072 times.
3584 } else if (colorOrder == FPPColorOrder::kColorOrderRBG) {
197 512 m_panels[panel].pixelMap[pOffset] = mOffset;
198 512 m_panels[panel].pixelMap[pOffset + 2] = mOffset + 1;
199 512 m_panels[panel].pixelMap[pOffset + 1] = mOffset + 2;
200
2/2
✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 1536 times.
3072 } else if (colorOrder == FPPColorOrder::kColorOrderGRB) {
201 1536 m_panels[panel].pixelMap[pOffset + 1] = mOffset;
202 1536 m_panels[panel].pixelMap[pOffset] = mOffset + 1;
203 1536 m_panels[panel].pixelMap[pOffset + 2] = mOffset + 2;
204
2/2
✓ Branch 0 taken 512 times.
✓ Branch 1 taken 1024 times.
1536 } else if (colorOrder == FPPColorOrder::kColorOrderGBR) {
205 512 m_panels[panel].pixelMap[pOffset + 2] = mOffset;
206 512 m_panels[panel].pixelMap[pOffset] = mOffset + 1;
207 512 m_panels[panel].pixelMap[pOffset + 1] = mOffset + 2;
208
2/2
✓ Branch 0 taken 512 times.
✓ Branch 1 taken 512 times.
1024 } else if (colorOrder == FPPColorOrder::kColorOrderBRG) {
209 512 m_panels[panel].pixelMap[pOffset + 1] = mOffset;
210 512 m_panels[panel].pixelMap[pOffset + 2] = mOffset + 1;
211 512 m_panels[panel].pixelMap[pOffset] = mOffset + 2;
212
1/2
✓ Branch 0 taken 512 times.
✗ Branch 1 not taken.
512 } else if (colorOrder == FPPColorOrder::kColorOrderBGR) {
213 512 m_panels[panel].pixelMap[pOffset + 2] = mOffset;
214 512 m_panels[panel].pixelMap[pOffset + 1] = mOffset + 1;
215 512 m_panels[panel].pixelMap[pOffset] = mOffset + 2;
216 } else // Assume RGB if somehow invalid
217 {
218 ✗ m_panels[panel].pixelMap[pOffset] = mOffset;
219 ✗ m_panels[panel].pixelMap[pOffset + 1] = mOffset + 1;
220 ✗ m_panels[panel].pixelMap[pOffset + 2] = mOffset + 2;
221 }
222 }
223 }
224 }
225
226 258 return 1;
227 }
228
229 675 void LEDPanel::drawTestPattern(unsigned char* channelData, int cycleNum, float percentOfCycle, int testType) {
230 // Test types match the ids the pixel-string test dropdown uses so the UIs
231 // can present a consistent list: 1 = panel layout/ID pattern, 4-7 =
232 // red/green/blue/white fades. Anything else draws the layout pattern.
233
3/4
✓ Branch 0 taken 482 times.
✓ Branch 1 taken 193 times.
✓ Branch 2 taken 482 times.
✗ Branch 3 not taken.
675 if (testType >= 4 && testType <= 7) {
234
1/2
✓ Branch 0 taken 482 times.
✗ Branch 1 not taken.
482 drawFadePattern(channelData, percentOfCycle, testType);
235 482 return;
236 }
237 unsigned char clr[3];
238
3/3
✓ Branch 0 taken 170 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 10 times.
193 switch (cycleNum % 3) {
239 170 case 0:
240 170 clr[0] = clr[2] = 0;
241 170 clr[1] = 255;
242 170 break;
243 13 case 1:
244 13 clr[2] = clr[1] = 0;
245 13 clr[0] = 255;
246 13 break;
247 10 default:
248 10 clr[0] = clr[1] = 0;
249 10 clr[2] = 255;
250 10 break;
251 }
252
253 193 int actualHeight = height;
254 193 int actualWidth = width;
255
256
4/4
✓ Branch 0 taken 175 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 157 times.
193 if ((orientation == 'L') || (orientation == 'R')) {
257 36 actualHeight = width;
258 36 actualWidth = height;
259 }
260
261
2/2
✓ Branch 0 taken 1544 times.
✓ Branch 1 taken 193 times.
1737 for (int y = 0; y < (actualHeight / 2); y++) {
262 1544 int yw1 = y * actualWidth * 3;
263 1544 int yw2 = (y + (actualHeight / 2)) * actualWidth * 3;
264
265
2/2
✓ Branch 0 taken 49408 times.
✓ Branch 1 taken 1544 times.
50952 for (int x = 0; x < actualWidth; ++x) {
266 49408 int r = 0, g = 0, b = 0;
267 49408 int r2 = 0, g2 = 0, b2 = 0;
268 // Left Column
269
2/2
✓ Branch 0 taken 1544 times.
✓ Branch 1 taken 47864 times.
49408 if (x == 0) {
270 1544 r = r2 = clr[0];
271 1544 g = g2 = clr[1];
272 1544 b = b2 = clr[2];
273 }
274 // Right Column
275
2/2
✓ Branch 0 taken 1544 times.
✓ Branch 1 taken 47864 times.
49408 if (x == (actualWidth - 1)) {
276 1544 r = r2 = clr[1];
277 1544 g = g2 = clr[2];
278 1544 b = b2 = clr[0];
279 }
280 // Top Row (for yw1)
281
2/2
✓ Branch 0 taken 6176 times.
✓ Branch 1 taken 43232 times.
49408 if (y == 0) {
282 6176 r = clr[2];
283 6176 g = clr[0];
284 6176 b = clr[1];
285 }
286 // Bottom Row (for yw2)
287
2/2
✓ Branch 0 taken 6176 times.
✓ Branch 1 taken 43232 times.
49408 if (y == (actualHeight / 2 - 1)) {
288 6176 r2 = clr[2];
289 6176 g2 = clr[0];
290 6176 b2 = clr[1];
291 }
292 // Diagonal Top-Left to Middle
293
4/4
✓ Branch 0 taken 47864 times.
✓ Branch 1 taken 1544 times.
✓ Branch 2 taken 1544 times.
✓ Branch 3 taken 46320 times.
49408 if (x == (2 * y) || x == (2 * y + 1)) {
294 3088 r = g = 255;
295 }
296 // Diagonal Bottom-Left to Middle (part1)
297
2/2
✓ Branch 0 taken 1544 times.
✓ Branch 1 taken 47864 times.
49408 if (x == (2 * (actualHeight / 2 - 1 - y))) {
298 1544 b2 = g2 = 255;
299 }
300 // Diagonal Bottom-Left to Middle (part2)
301
2/2
✓ Branch 0 taken 1544 times.
✓ Branch 1 taken 47864 times.
49408 if (x == (2 * (actualHeight / 2 - 1 - y) + 1)) {
302 1544 b2 = g2 = 255;
303 }
304 // Square in middle
305
4/4
✓ Branch 0 taken 27792 times.
✓ Branch 1 taken 21616 times.
✓ Branch 2 taken 6176 times.
✓ Branch 3 taken 21616 times.
49408 if (x >= (actualWidth / 2 - 2) && x <= (actualWidth / 2 + 1)) {
306
2/2
✓ Branch 0 taken 1544 times.
✓ Branch 1 taken 4632 times.
6176 if (y <= 1) {
307 1544 r2 = g2 = b2 = 255;
308
2/2
✓ Branch 0 taken 1544 times.
✓ Branch 1 taken 3088 times.
4632 } else if (y >= (actualHeight / 2 - 2)) {
309 1544 r = g = b = 255;
310 }
311 }
312
313
1/2
✓ Branch 0 taken 49408 times.
✗ Branch 1 not taken.
49408 setPixel(channelData, yw1 + x * 3, r, g, b);
314
1/2
✓ Branch 0 taken 49408 times.
✗ Branch 1 not taken.
49408 setPixel(channelData, yw2 + x * 3, r2, g2, b2);
315 }
316 }
317
3/4
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 157 times.
✓ Branch 2 taken 193 times.
✗ Branch 3 not taken.
193 drawNumber(output + 1, width / 2 + 1, height > 16 ? 2 : 1, channelData);
318
3/4
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 157 times.
✓ Branch 2 taken 193 times.
✗ Branch 3 not taken.
193 drawNumber(chain + 1, width / 2 + 8, height > 16 ? 2 : 1, channelData);
319 }
320
321 // Write r,g,b to the pixel's own channels so the output applies the color order
322 345600 void LEDPanel::setPixel(unsigned char* channelData, int idx, int r, int g, int b) {
323 345600 int base = std::min(pixelMap[idx], std::min(pixelMap[idx + 1], pixelMap[idx + 2]));
324 345600 channelData[base] = r;
325 345600 channelData[base + 1] = g;
326 345600 channelData[base + 2] = b;
327 345600 }
328
329 482 void LEDPanel::drawFadePattern(unsigned char* channelData, float percentOfCycle, int testType) {
330 // Same triangle fade the pixel-string testers use (PixelFadeStringTester).
331 uint8_t fade;
332
2/2
✓ Branch 0 taken 283 times.
✓ Branch 1 taken 199 times.
482 if (percentOfCycle < 0.50f) {
333 283 fade = percentOfCycle * 508.0f + 1;
334 } else {
335 199 fade = 255 - (percentOfCycle - 0.5f) * 508.0f;
336 }
337 // 4 = red, 5 = green, 6 = blue, 7 = white.
338
4/4
✓ Branch 0 taken 351 times.
✓ Branch 1 taken 131 times.
✓ Branch 2 taken 101 times.
✓ Branch 3 taken 250 times.
482 uint8_t r = (testType == 4 || testType == 7) ? fade : 0;
339
4/4
✓ Branch 0 taken 357 times.
✓ Branch 1 taken 125 times.
✓ Branch 2 taken 101 times.
✓ Branch 3 taken 256 times.
482 uint8_t g = (testType == 5 || testType == 7) ? fade : 0;
340
4/4
✓ Branch 0 taken 357 times.
✓ Branch 1 taken 125 times.
✓ Branch 2 taken 101 times.
✓ Branch 3 taken 256 times.
482 uint8_t b = (testType == 6 || testType == 7) ? fade : 0;
341
342 482 int actualHeight = height;
343 482 int actualWidth = width;
344
2/4
✓ Branch 0 taken 482 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 482 times.
482 if ((orientation == 'L') || (orientation == 'R')) {
345 ✗ actualHeight = width;
346 ✗ actualWidth = height;
347 }
348
2/2
✓ Branch 0 taken 7712 times.
✓ Branch 1 taken 482 times.
8194 for (int y = 0; y < actualHeight; y++) {
349 7712 int yw = y * actualWidth * 3;
350
2/2
✓ Branch 0 taken 246784 times.
✓ Branch 1 taken 7712 times.
254496 for (int x = 0; x < actualWidth; ++x) {
351 246784 setPixel(channelData, yw + x * 3, r, g, b);
352 }
353 }
354 482 }
355
356 395 void LEDPanel::drawNumber(int v, int x, int y, unsigned char* channelData) {
357
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 395 times.
395 if (v >= 20) {
358 ✗ drawNumber(2, x, y, channelData);
359 ✗ x += 4;
360 ✗ v -= 20;
361 }
362
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 386 times.
395 if (v >= 10) {
363 9 drawNumber(1, x, y, channelData);
364 9 x += 2;
365 9 v -= 10;
366 }
367
368 int yw1;
369 395 int actualWidth = width;
370
371
4/4
✓ Branch 0 taken 359 times.
✓ Branch 1 taken 36 times.
✓ Branch 2 taken 36 times.
✓ Branch 3 taken 323 times.
395 if ((orientation == 'L') || (orientation == 'R')) {
372 72 actualWidth = height;
373 }
374
375
2/2
✓ Branch 0 taken 359 times.
✓ Branch 1 taken 36 times.
395 if (v == 1) {
376
2/2
✓ Branch 0 taken 1795 times.
✓ Branch 1 taken 359 times.
2154 for (int yo = 0; yo < 5; yo++) {
377 1795 int yw1 = (y + yo) * actualWidth * 3;
378 1795 channelData[pixelMap[yw1 + x * 3]] = 255;
379 1795 channelData[pixelMap[yw1 + x * 3 + 1]] = 255;
380 1795 channelData[pixelMap[yw1 + x * 3 + 2]] = 255;
381 }
382 359 return;
383 }
384
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
36 if (v == 4) {
385 ✗ for (int yo = 0; yo < 5; yo++) {
386 ✗ int yw1 = (y + yo) * actualWidth * 3;
387 ✗ channelData[pixelMap[yw1 + (x + 2) * 3]] = 255;
388 ✗ channelData[pixelMap[yw1 + (x + 2) * 3 + 1]] = 255;
389 ✗ channelData[pixelMap[yw1 + (x + 2) * 3 + 2]] = 255;
390 ✗ if (yo < 3) {
391 ✗ channelData[pixelMap[yw1 + x * 3]] = 255;
392 ✗ channelData[pixelMap[yw1 + x * 3 + 1]] = 255;
393 ✗ channelData[pixelMap[yw1 + x * 3 + 2]] = 255;
394 }
395 }
396 ✗ yw1 = (y + 2) * actualWidth * 3;
397 ✗ for (int x2 = 0; x2 < 3; x2++) {
398 ✗ channelData[pixelMap[yw1 + (x + x2) * 3]] = 255;
399 ✗ channelData[pixelMap[yw1 + (x + x2) * 3 + 1]] = 255;
400 ✗ channelData[pixelMap[yw1 + (x + x2) * 3 + 2]] = 255;
401 }
402 ✗ return;
403 }
404
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
36 if (v == 7) {
405 ✗ for (int yo = 0; yo < 5; yo++) {
406 ✗ int yw1 = (y + yo) * actualWidth * 3;
407 ✗ channelData[pixelMap[yw1 + (x + 2) * 3]] = 255;
408 ✗ channelData[pixelMap[yw1 + (x + 2) * 3 + 1]] = 255;
409 ✗ channelData[pixelMap[yw1 + (x + 2) * 3 + 2]] = 255;
410 }
411 ✗ yw1 = y * actualWidth * 3;
412 ✗ for (int x2 = 0; x2 < 3; x2++) {
413 ✗ channelData[pixelMap[yw1 + (x + x2) * 3]] = 255;
414 ✗ channelData[pixelMap[yw1 + (x + x2) * 3 + 1]] = 255;
415 ✗ channelData[pixelMap[yw1 + (x + x2) * 3 + 2]] = 255;
416 }
417 ✗ return;
418 }
419 36 yw1 = y * actualWidth * 3;
420
2/2
✓ Branch 0 taken 108 times.
✓ Branch 1 taken 36 times.
144 for (int x2 = 0; x2 < 3; x2++) {
421 108 channelData[pixelMap[yw1 + (x + x2) * 3]] = 255;
422 108 channelData[pixelMap[yw1 + (x + x2) * 3 + 1]] = 255;
423 108 channelData[pixelMap[yw1 + (x + x2) * 3 + 2]] = 255;
424
425
4/4
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 72 times.
✓ Branch 2 taken 27 times.
✓ Branch 3 taken 9 times.
108 if (x2 != 1 || v != 0) {
426 99 channelData[pixelMap[yw1 + (x + x2) * 3 + actualWidth * 6]] = 255;
427 99 channelData[pixelMap[yw1 + (x + x2) * 3 + 1 + actualWidth * 6]] = 255;
428 99 channelData[pixelMap[yw1 + (x + x2) * 3 + 2 + actualWidth * 6]] = 255;
429 }
430
431 108 channelData[pixelMap[yw1 + (x + x2) * 3 + actualWidth * 12]] = 255;
432 108 channelData[pixelMap[yw1 + (x + x2) * 3 + 1 + actualWidth * 12]] = 255;
433 108 channelData[pixelMap[yw1 + (x + x2) * 3 + 2 + actualWidth * 12]] = 255;
434 }
435 36 yw1 = (y + 1) * actualWidth * 3;
436
6/10
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 36 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 36 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 9 times.
✓ Branch 9 taken 27 times.
36 if (v == 5 || v == 6 || v == 9 || v == 8 || v == 0) {
437 9 channelData[pixelMap[yw1 + x * 3]] = 255;
438 9 channelData[pixelMap[yw1 + x * 3 + 1]] = 255;
439 9 channelData[pixelMap[yw1 + x * 3 + 2]] = 255;
440 }
441
7/10
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 9 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 9 times.
✗ Branch 9 not taken.
36 if (v == 2 || v == 3 || v == 9 || v == 8 || v == 0) {
442 36 channelData[pixelMap[yw1 + (x + 2) * 3]] = 255;
443 36 channelData[pixelMap[yw1 + (x + 2) * 3 + 1]] = 255;
444 36 channelData[pixelMap[yw1 + (x + 2) * 3 + 2]] = 255;
445 }
446 36 yw1 = (y + 3) * actualWidth * 3;
447
6/8
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 9 times.
✓ Branch 7 taken 9 times.
36 if (v == 2 || v == 6 || v == 8 || v == 0) {
448 27 channelData[pixelMap[yw1 + x * 3]] = 255;
449 27 channelData[pixelMap[yw1 + x * 3 + 1]] = 255;
450 27 channelData[pixelMap[yw1 + x * 3 + 2]] = 255;
451 }
452
7/10
✓ Branch 0 taken 27 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 27 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 27 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 9 times.
✓ Branch 9 taken 18 times.
36 if (v == 3 || v == 5 || v == 6 || v == 8 | v == 9 || v == 0) {
453 18 channelData[pixelMap[yw1 + (x + 2) * 3]] = 255;
454 18 channelData[pixelMap[yw1 + (x + 2) * 3 + 1]] = 255;
455 18 channelData[pixelMap[yw1 + (x + 2) * 3 + 2]] = 255;
456 }
457 }
458