| 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 GPL v2 as described in the | ||
| 10 | * included LICENSE.GPL file. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include "fpp-pch.h" | ||
| 14 | |||
| 15 | #include "PortNumberStringTester.h" | ||
| 16 | #include "../PixelString.h" | ||
| 17 | |||
| 18 | 1 | uint8_t* OutputPortNumberPixelStringTester::createTestData(PixelString* ps, int cycleCount, float percentOfCycle, uint8_t* inChannelData, uint32_t& newLen) { | |
| 19 | 1 | newLen = ps->m_outputBytes; | |
| 20 | 1 | uint8_t* data = ps->m_outputBuffer; | |
| 21 | 1 | uint8_t* out = ps->pixelDataStart(); | |
| 22 | 1 | uint32_t inCh = 0; | |
| 23 | unsigned char clr[3]; | ||
| 24 |
1/3✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
1 | switch (cycleCount % 3) { |
| 25 | 1 | case 0: | |
| 26 | 1 | clr[2] = clr[1] = 0; | |
| 27 | 1 | clr[0] = 255; | |
| 28 | 1 | break; | |
| 29 | ✗ | case 1: | |
| 30 | ✗ | clr[0] = clr[2] = 0; | |
| 31 | ✗ | clr[1] = 255; | |
| 32 | ✗ | break; | |
| 33 | ✗ | default: | |
| 34 | ✗ | clr[0] = clr[1] = 0; | |
| 35 | ✗ | clr[2] = 255; | |
| 36 | ✗ | break; | |
| 37 | } | ||
| 38 | 1 | int curPixel = 0; | |
| 39 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | for (auto& vs : ps->m_virtualStrings) { |
| 40 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (vs.receiverNum == -1) { |
| 41 |
3/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 1 times.
|
7 | for (int x = 0; x < vs.startNulls * vs.channelsPerNode(); ++x) { |
| 42 | 6 | *out++ = 0; | |
| 43 | } | ||
| 44 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 1 times.
|
11 | for (int x = 0; x < vs.pixelCount; ++x) { |
| 45 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9 times.
|
10 | if (curPixel <= ps->m_portNumber) { |
| 46 | 1 | uint8_t brightness = vs.brightnessMap[255]; | |
| 47 |
3/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1 times.
|
4 | for (int y = 0; y < vs.channelsPerNode(); ++y) { |
| 48 | 3 | *out = brightness; | |
| 49 | 3 | ++out; | |
| 50 | 3 | ++inCh; | |
| 51 | } | ||
| 52 | } else { | ||
| 53 |
2/4✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
|
9 | if (vs.colorOrder.whiteOffset() == 0) { |
| 54 | ✗ | ++out; | |
| 55 | } | ||
| 56 |
3/4✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✓ Branch 3 taken 9 times.
|
36 | for (int y = 0; y < std::min(vs.channelsPerNode(), 3); ++y) { |
| 57 | 27 | *out = vs.brightnessMap[clr[y]]; | |
| 58 | 27 | out++; | |
| 59 | } | ||
| 60 |
2/4✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
|
9 | if (vs.colorOrder.whiteOffset() == 3) { |
| 61 | ✗ | ++out; | |
| 62 | } | ||
| 63 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | inCh += vs.channelsPerNode(); |
| 64 | } | ||
| 65 | 10 | ++curPixel; | |
| 66 | } | ||
| 67 |
3/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1 times.
|
4 | for (int x = 0; x < vs.endNulls * vs.channelsPerNode(); ++x) { |
| 68 | 3 | *out++ = 0; | |
| 69 | } | ||
| 70 | } else { | ||
| 71 | ✗ | fillInSmartReceiver(ps, vs, inChannelData, inCh, out); | |
| 72 | } | ||
| 73 | } | ||
| 74 | 1 | return data; | |
| 75 | } | ||
| 76 | |||
| 77 | OutputPortNumberPixelStringTester OutputPortNumberPixelStringTester::INSTANCE; | ||
| 78 |