| 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 "PixelFadeStringTester.h" | ||
| 16 | #include "../PixelString.h" | ||
| 17 | |||
| 18 | 1 | uint8_t* PixelFadeStringTester::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 | memset(out, 0, ps->m_outputBytes - ps->m_preamble.size()); | |
| 23 | 1 | uint32_t inCh = 0; | |
| 24 | |||
| 25 | uint8_t fadeValue; | ||
| 26 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (percentOfCycle < 0.50) { |
| 27 | 1 | fadeValue = percentOfCycle * 508.0 + 1; | |
| 28 | } else { | ||
| 29 | ✗ | fadeValue = 255 - (percentOfCycle - 0.5) * 508.0; | |
| 30 | } | ||
| 31 | |||
| 32 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | for (auto& vs : ps->m_virtualStrings) { |
| 33 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (vs.receiverNum == -1) { |
| 34 | 1 | int offset = -1; | |
| 35 | 1 | uint8_t brightness = vs.brightnessMap[fadeValue]; | |
| 36 |
1/5✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | switch (fadeType) { |
| 37 | ✗ | case 0: | |
| 38 | ✗ | offset = vs.colorOrder.redOffset(); | |
| 39 | ✗ | break; | |
| 40 | ✗ | case 1: | |
| 41 | ✗ | offset = vs.colorOrder.greenOffset(); | |
| 42 | ✗ | break; | |
| 43 | ✗ | case 2: | |
| 44 | ✗ | offset = vs.colorOrder.blueOffset(); | |
| 45 | ✗ | break; | |
| 46 | 1 | case 3: | |
| 47 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | offset = vs.colorOrder.whiteOffset(); |
| 48 | 1 | break; | |
| 49 | } | ||
| 50 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | out += vs.startNulls * vs.channelsPerNode(); |
| 51 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 1 times.
|
11 | for (int x = 0; x < vs.pixelCount; ++x) { |
| 52 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | if (offset == -1) { |
| 53 |
3/4✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 10 times.
|
40 | for (int y = 0; y < vs.channelsPerNode(); ++y) { |
| 54 | 30 | *out = brightness; | |
| 55 | 30 | ++out; | |
| 56 | 30 | ++inCh; | |
| 57 | } | ||
| 58 | } else { | ||
| 59 | ✗ | out[offset] = brightness; | |
| 60 | ✗ | out += vs.channelsPerNode(); | |
| 61 | ✗ | inCh += vs.channelsPerNode(); | |
| 62 | } | ||
| 63 | } | ||
| 64 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | out += vs.endNulls * vs.channelsPerNode(); |
| 65 | } else { | ||
| 66 | ✗ | fillInSmartReceiver(ps, vs, inChannelData, inCh, out); | |
| 67 | } | ||
| 68 | } | ||
| 69 | 1 | return data; | |
| 70 | } | ||
| 71 | |||
| 72 | PixelFadeStringTester PixelFadeStringTester::INSTANCE_RED(0); | ||
| 73 | PixelFadeStringTester PixelFadeStringTester::INSTANCE_GREEN(1); | ||
| 74 | PixelFadeStringTester PixelFadeStringTester::INSTANCE_BLUE(2); | ||
| 75 | PixelFadeStringTester PixelFadeStringTester::INSTANCE_WHITE(3); | ||
| 76 |