| 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 "fpp-json.h" | ||
| 16 | |||
| 17 | #include "../Sequence.h" // FPPD_OFF_CHANNEL | ||
| 18 | #include "../log.h" | ||
| 19 | |||
| 20 | #include "PixelOverlayModelFB.h" | ||
| 21 | |||
| 22 | 60 | PixelOverlayModelFB::PixelOverlayModelFB(const Json::Value& c) : | |
| 23 | 60 | PixelOverlayModel(c) { | |
| 24 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
|
60 | if (!isValid()) { |
| 25 | // The base class rejected the definition; don't claim a framebuffer | ||
| 26 | // for a model the manager is about to drop. | ||
| 27 | ✗ | return; | |
| 28 | } | ||
| 29 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | fb = FrameBuffer::createFrameBuffer(config); |
| 30 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 59 times.
|
60 | if (fb == nullptr) { |
| 31 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | LogErr(VB_CHANNELOUT, "Error initializing underlying FrameBuffer for Pixel Overlay Model '%s'\n", name.c_str()); |
| 32 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | delete fb; |
| 33 | 1 | fb = nullptr; | |
| 34 | } | ||
| 35 | ✗ | } | |
| 36 | |||
| 37 | 80 | PixelOverlayModelFB::~PixelOverlayModelFB() { | |
| 38 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
40 | if (fb) |
| 39 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
40 | delete fb; |
| 40 | 80 | } | |
| 41 | |||
| 42 | 3351 | void PixelOverlayModelFB::doOverlay(uint8_t* channels) { | |
| 43 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3351 times.
|
3351 | if (!fb) |
| 44 | ✗ | return; | |
| 45 | |||
| 46 | // Always enable display on first call, even if no dirty buffer | ||
| 47 |
2/2✓ Branch 0 taken 57 times.
✓ Branch 1 taken 3294 times.
|
3351 | if (!displayEnabled) { |
| 48 | 57 | fb->EnableDisplay(); | |
| 49 | 57 | displayEnabled = true; | |
| 50 | } | ||
| 51 | |||
| 52 |
5/6✓ Branch 0 taken 3351 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1038 times.
✓ Branch 3 taken 2313 times.
✓ Branch 4 taken 1038 times.
✓ Branch 5 taken 2313 times.
|
3351 | if (!hasChildren() && !dirtyBuffer) |
| 53 | 1038 | return; | |
| 54 | |||
| 55 | 2313 | fb->FBCopyData(channelData); | |
| 56 | 2313 | fb->FBStartDraw(); | |
| 57 | 2313 | dirtyBuffer = false; | |
| 58 | } | ||
| 59 | |||
| 60 | 2174 | void PixelOverlayModelFB::setData(const uint8_t* data) { | |
| 61 | 2174 | memcpy(channelData, data, width * height * bytesPerPixel); | |
| 62 | 2174 | dirtyBuffer = true; | |
| 63 | 2174 | } | |
| 64 | |||
| 65 | ✗ | uint32_t PixelOverlayModelFB::outputChannelForData(uint32_t dataOffset) const { | |
| 66 | ✗ | return FPPD_OFF_CHANNEL; | |
| 67 | } | ||
| 68 |