Repository navigation
Conversation
Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
…/writer Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
…pData graph Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
…++ verifier Metadata is serialized last but its strings must be present in the string table, which is written first. Intern them up front, then freeze the table so a missed interning site throws instead of handing out an out of range index. Also store marker durations as a proportion of the animation and carry the composition width and height through to the metadata. Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
The managed counterpart of the native interpreter. It exists so that the wire format can be round tripped and compared with the original graph, which is a much stronger check than testing the serializer alone. Every index is bounds checked and the buffer is verified before it is read, because buffers are untrusted input. Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
…d graphs Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
…y kind Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
- Move #include <unknwn.h> before LottieRuntime.h (which pulls in C++/WinRT headers), satisfying the classic-COM interop requirement. - Use winrt::implements<> with the projected interface listed first for GeometrySource and Effect, so winrt::make<> returns a com_ptr convertible to CompositionPath / IGraphicsEffect directly. - Fix StrokeMiterLimit cast (was uint32_t, should be float). - Default-construct WinRT projection type caches with nullptr fill value; these types have no default constructor. - Link dxguid.lib for D2D1 effect CLSIDs (Composite, GaussianBlur).
A console tool that links LottieRuntime.vcxproj, loads a serialized Lottie composition (.lcomp) given as its command-line argument, and prints the composition object hierarchy of the resulting visual tree: visuals, their shapes (recursively through container shapes), fill and stroke brushes, and gradient stops. Each line shows the runtime class name and, where set, the Comment property, so the printed tree can be matched back to the source Lottie layers. Builds via project reference to LottieRuntime.vcxproj and copies LottieRuntime.dll next to the exe as a post-build step, since C++ project references do not do this automatically.
Defines ILottieCompositionLoader (IID 3874B71B-05E6-42A9-B838-1AE7F0BA4E1C), a classic COM interface accepting (UINT32 length, BYTE const* buffer, REFIID, void**) that wraps LoadComposition for callers without a C++/WinRT toolchain. Implements it as LottieCompositionLoader (CLSID 9F7B7089-F512-4BBC-81FE-4FF12B4DA159) via winrt::implements<>, plus DllGetClassObject/DllCanUnloadNow exports and a LottieRuntime.def to keep those names undecorated. The class is never registered with the system: LottieRuntime.manifest is a private-assembly manifest declaring the comClass, copied next to a consuming exe and named directly by an ACTCTX, so CoCreateInstance resolves the CLSID without any HKEY_CLASSES_ROOT entry. Adds LottieRuntimeComTest, a console harness that builds an activation context from that manifest, activates it, CoCreateInstances the loader, and calls LoadComposition on a file argument. Known issue: CoCreateInstance currently returns E_ACCESSDENIED (0x80070005) even though CreateActCtx/ActivateActCtx succeed and the DLL exports DllGetClassObject/DllCanUnloadNow correctly - the private-assembly activation path needs further debugging before this is fully working end-to-end. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
Create the desktop DispatcherQueue lazily before activating the loader's Compositor. This keeps CoCreateInstance side-effect-free and gives Windows.UI.Composition the thread infrastructure it requires. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
Use C++/WinRT's module lock for IClassFactory::LockServer and DllCanUnloadNow so COM cannot unload the DLL while its objects remain alive. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
Build the COM test, record it under Time Travel Debugging, and collect optional SideBySide and COM event logs into one directory. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
Remove the one-off investigation helper now that the activation failure is diagnosed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
Handle omitted property-set state, expose the required effect-source interface, cache and cycle-check canvas geometries and strings, preserve sprite shadows, and load URI and stream image surfaces. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
Use the FlatBuffers headers and flatc from pinned upstream default-branch commit 5761d6e for C++. Keep C# generation on the 25.2.10 runtime available through Microsoft's configured NuGet feed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
Create custom controllers explicitly, pass them to StartAnimation, and initialize root property sets before descending into children so controller expressions can bind to root progress. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
Remove exported C++ symbols, require callers to own the DispatcherQueue, support architecture-neutral registration-free activation, load embedded image streams synchronously, and make the native project portable from its packaged source layout. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
Replace separate validation and dump executables with LottieRuntime.exe supporting validate, --dump, and --show modes. Document JSON conversion and package the complete native runtime source set, COM project, generated binding, and FlatBuffers headers in LottieGen.nupkg. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
Disable incremental linking and enable /O1, function-level linking, string pooling, LTCG, reference elimination, and COMDAT folding for Release builds. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
Keep the runtime loadable on Windows 10 1809 while rejecting compositions whose declared UniversalApiContract version is unavailable before graph hydration. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58fac82f-0489-4c57-a18d-2b7ba273faa6
|
@dotnet-policy-service agree company="Microsoft" |
Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
Co-authored-by: jonwis <18537118+jonwis@users.noreply.github.com>
Split runtime schema dependencies from tool-side serialization, avoid copying byte-array buffers, and process keyframes in one pass. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 408cb9b9-d2b1-4a7a-bc3e-f6ab25b8793f
…preter Add a managed FlatBuffer interpreter alongside the native one
|
@jonwis I left a few inline comments, but wanted to share some higher-level thoughts as well:
|
| @@ -0,0 +1,108 @@ | |||
| # LottieRuntime (managed) | |||
There was a problem hiding this comment.
I think the managed side should just live in Lottie-Windows. Then there's one C# library that handles both JSON and .lcomp, and .lcomp can reuse the existing pipeline (CompositionDeserializer → Instantiator → AnimatedVisualPlayer) instead of a separate C# interpreter. I'd keep LottieRuntime as the small native runtime for C++ only. Otherwise, I'm worried we end up with too many pieces doing the same thing but a little differently.
There was a problem hiding this comment.
OK. I'll extend the existing C# library with this support instead and remove this one.
OK, will narrow to just the producer and C++ consumer code, and update the C# instantiator. In Windows, we'll want to have a shared copy of the instantiator. What do you think about "a pretty OK sample" that shows using this in a common way? Or do we just assume the bots will figure out how to have one copy per process?
That'd be great! Is there anything needed to get this ready for a C++/WinRT consumer of WASDK XAML/Composition? Does Lottie-Windows have a C++/WinRT package?
See note on supported UAP versions. At some point we should include "supported WASDK versions" and migrate people to using the Microsoft.UI types. I'll make the changes you suggest.
I'll have to see what that looks like; IIRC I had to tinker a bit to get flatc.exe working correctly. Thanks for the comments! |
Remove the managed and COM loader implementations, add projection-selectable native source, emit multi-UAP FlatBuffer variants, and consolidate the validation tool under source/LottieRuntime. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: adcabe6f-aa5c-4e06-948d-b49e5adae80c
Replace the FlatBuffers submodule with the pinned public headers and license, and document a validated regeneration workflow for matching flatc binaries and headers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: adcabe6f-aa5c-4e06-948d-b49e5adae80c
|
Addressed the FlatBuffers vendoring suggestion from your review: the submodule is removed, and the pinned C++ headers plus upstream LICENSE are now checked into |
Add native metadata loading with live theme properties, cached loaded-image descriptors and image reuse. Preserve the existing visual-only API, fix owned property-set realization ordering, and document the APIs with focused synthetic native regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ee78c03d-680b-409f-8f5b-264e3e7f9317
Hosts can implement IAnimatedVisual2 by calling StopAnimations from DestroyAnimations and StartAnimations from CreateAnimations, as LottieGen's generated code did. Without it AnimatedVisualPlayer's Resources optimization cannot release idle animations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cfdf7544-9ef9-4586-8d82-56d89206cc1d
Add LottieVisualSource, an IAnimatedVisualSource2 implementation over serialized compositions for hosts that use AnimatedVisualPlayer. Visuals implement IAnimatedVisual2 so AnimationOptimization="Resources" can stop animations while idle, and IClosable. Sources with images also implement IDynamicAnimatedVisualSource and report image loading progress. The source selects the embedded variant for the running UAP contract, forwards theme colors (and scalars through SetScalarProperty) to live and future visuals, and builds markers using the options each host needs. Add VisualSourceTests, which hosts XAML and checks animation stop and restart, theme bindings, marker ranges, closing, and error reporting. Undefine BUILD_WINDOWS in LottieRuntime.cpp so the vendored copy builds unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cfdf7544-9ef9-4586-8d82-56d89206cc1d
…-sample-tool' into jonwis-build-windows-interpreter-sample-tool
The task rejected -Language flatbuffer even though LottieGen.exe supports it. Accept it in validation and report the generated .lcomp files (one per UAP version variant) as OutputFiles, using the paths LottieGen prints. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cfdf7544-9ef9-4586-8d82-56d89206cc1d
Restore pinned FlatBuffers dependencies for MSBuild, bootstrap vcpkg when needed, and replace vendored headers. Package the schema, native sources, headers, and license under the documented consumer layout. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d33f7269-9a0c-4437-aadd-0da22dcee956
Remove package-content validation, restore vcpkg before invoking its compiler for both bindings, and support historical ports in repo-local vcpkg checkouts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d33f7269-9a0c-4437-aadd-0da22dcee956
Scope managed analyzers and GitVersioning to C# projects and remove stale loader cleanup from the native validation tool. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d33f7269-9a0c-4437-aadd-0da22dcee956
Summary
Adds a data-driven alternative to per-animation generated native code:
LottieGen -Language flatbufferserializes the translatedWinCompDatagraph into.lcompfiles.There is no separate runtime DLL, COM activation layer, or exported loader ABI. The earlier
registration-free COM design has been removed. Each consuming binary owns its reader implementation.
The existing C#, C++/CX, and C++/WinRT generation paths remain available.
Format and integration
The format stores the translated Composition graph, not the original Lottie JSON. Translation stays
in the generator; the application needs only the native reader and compiled data.
.lcompvariants; the host selects one.The same serialized format serves two separately compiled C++/WinRT projections:
Windows.UI.CompositionLOTTIE_RUNTIME_WINUI2Microsoft.UI.CompositionLOTTIE_RUNTIME_WINUI3Consumers build as C++20 with exactly one definition per reader compilation. The projection-specific
namespaces keep the two native implementations distinct; this is source integration, not an ABI bridge.
LottieGen.nupkgincludes the reader source/header, generated schema binding, pinned FlatBuffersheaders, licenses, and integration instructions. It does not distribute a reader DLL or COM manifest.
Native loading APIs
LoadCompositionretains the Visual-only loading contract.LoadCompositionWithMetadatareturns the root visual, duration, dimensions, frame rate, markers,live theme properties, and realized image-surface descriptors.
changes the existing visual tree.
buffer and XAML host compositor.
out-of-range progress values are preserved; projection and playback policy belong to the host.
The host owns XAML integration, animated-visual adapters, progress animation, image-completion policy,
and object lifetime. Image-bearing animations use the XAML host's compositor.
Anonymized native-client size example
Representative migrations from generated native animation code to embedded
.lcompresources:foo.dllbar.dllbaz.dllqux.dllquux.dllCounts are distinct animations, not generated API-contract variants. Negative percentages mean a
smaller DLL. The combined percentage is weighted by the original DLL sizes, not averaged across rows.
These are matched standalone Release/x64 measurements of complete DLLs, including each DLL's reader,
host adapters, and embedded payloads. They exclude PDBs and unchanged dependencies, and do not measure
whole-package size or working set. One pair used identical analysis-disabled settings on both sides.
The two-animation result in
baz.dllincludes removing fallback variants outside that host's supportedOS range.
The single-animation DLL grows because reader/adapter overhead outweighs the generated code removed.
The reader cost is amortized within each binary, not shared through a new runtime DLL.
Validation and remaining work
/W4 /WXand passes on WinUI 2/x64. It coversmetadata validation, the legacy no-metadata API, live theme/cache identity, owned-property
initialization ordering, image reuse, and invalid image descriptors.
--dump, and--showpaths. Its build stillneeds removal of a stale
loadercleanup reference left by the deleted COM implementation; thenative regression result above does not claim that the inspection tool or the full matrix is green.
(via Copilot)