-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClipComponent.cpp
More file actions
32 lines (29 loc) · 1.16 KB
/
ClipComponent.cpp
File metadata and controls
32 lines (29 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "ClipComponent.h"
#include "ComponentInterfaceAdapters.h"
#include "IClipProvider.h"
#include "ISortableProvider.h"
// Explicit registration function — called from Deki2D_RegisterComponents()
// to ensure interface adapters are registered even when the linker strips
// object files with only static initializers (e.g., ESP-IDF static libs).
void Deki2D_RegisterClipAdapters()
{
static bool s_registered = false;
if (s_registered) return;
s_registered = true;
ComponentInterfaceAdapters::Register(
IClipProvider::InterfaceID,
ClipComponent::StaticType,
[](DekiComponent* c) -> void* {
return static_cast<IClipProvider*>(static_cast<ClipComponent*>(c));
});
ComponentInterfaceAdapters::Register(
ISortableProvider::InterfaceID,
ClipComponent::StaticType,
[](DekiComponent* c) -> void* {
return static_cast<ISortableProvider*>(static_cast<ClipComponent*>(c));
});
}
// Static init — works for DLL builds where all objects are loaded
static struct ClipInterfaceRegistrar {
ClipInterfaceRegistrar() { Deki2D_RegisterClipAdapters(); }
} s_clipInterfaceRegistrar;