20 Commits

Author SHA1 Message Date
bodymovin
d920ee0efd fix(scripting): search first parent transform component to build scri… (#11443) 99ca3a30cc
fix(scripting): search first parent transform component to build script node

feature: modulate opacity (#11427) 128d9d61e0
* feature: modulate opacity

* fix: clang-format

* fix: rust renderer has a no-op modulateOpacity

* fix: no-op modulateOpacity for canvas android

* feature: modulate opacity on android canvas

* fix: rcp ref

* fix: missing override

* fix: gms

* fix: make flutter_renderer match cg one

* fix: josh pr feedback

* fix: remove CG transparency layer

* fix: save modulated gradient up-front

* fix: store only one gradient ref

* fix: remove specific constructor

* fix: use GradDataArray!

* fix: expose currentModulatedOpacity

* fix: cg_factory modulated opacity value

* fix: modulate negative opacity test

* fix: verify double modulate negative also clamps

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
Co-authored-by: hernan <hernan@rive.app>
2026-01-13 01:13:05 +00:00
JoshJRive
c468e6757b Get the Linux unit tests building and running in the GitHub workflow (#10761) a0b890f273
Co-authored-by: Josh Jersild <joshua@rive.app>
2025-10-15 22:11:25 +00:00
blakdragan7
237f2c8d30 feat(Image sampler filters) Adds Image filter options for rendering images (#9309) 930facea3f
* added filter type to draw batch

* c++ implementation of ImageSamplerOptions

* image sampler options now pushes correct for RiveRenderPaint

* wip

* OpenGL uses correct sample options

* now only one filter option that accounts for mip map

* d3d now uses sampler states options

* better way to get the filter option

* added mirror and inverse mirror options

* started using helper functions for retreiving sampler optiojnhs

* workaround for vulkn semaphore issue

* wip

* added filter type to draw batch

* c++ implementation of ImageSamplerOptions

* image sampler options now pushes correct for RiveRenderPaint

* wip

* OpenGL uses correct sample options

* now only one filter option that accounts for mip map

* d3d now uses sampler states options

* better way to get the filter option

* added mirror and inverse mirror options

* started using helper functions for retreiving sampler optiojnhs

* workaround for vulkn semaphore issue

* wip

* undo deleting empty descriptor

* properly packed image options

* removed uneeded checks

* more unit tests

* unreal image_filter_options integration, gm for image filters

* properly implement new draw functions for cgrender

* finish mege conflicts

* merge vulkan sampler options

* cherry-picked vulkan imp into branch

* initial metal

* clang-format

* d3d12 image filter options

* fixed d3d

* clang-format

* fixed mip filter for metal

* made every filter option act as similiar as possible

* addressed pr changes

* fixed tests

* empty commit to fix github

* fix: webgl renderers

* started addressing PR comments

* metal change for pr

* more pr stuff

* final PR address

* shader update per PR request

* rhi updat e

* added gm requested in pr

* made d3d12 work with more then 2000 sampler changes per flush

* pr comments

Co-authored-by: Chris Dalton <chris@rive.app>
Co-authored-by: Jonathon Copeland <jcopela4@gmail.com>
Co-authored-by: Luigi Rosso <luigi.rosso@gmail.com>
2025-05-29 05:36:59 +00:00
luigi-rosso
633e37f7d0 Silvers
# Description
This adds the ability to serialize draw commands to .sriv file via a SerializingFactory which can be used by the unit tests in place of the NoOpFactory.

# Details
You can use the SerializingFactory to initialize your .riv and annotate the serialization with things like frame size and new frame/frame begin. This makes it possible to drop the generated .sriv into the Flutter viewer which will perform the serialized rendering commands to show exactly what the runtime is doing, high level rendering-wise. It can also diff two .sriv files if they are dropped in one drag/drop op.

When adding new "Silver" tests make sure to rebaseline the silvers by doing:
```
cd rive/packages/runtime/tests/unit_tests
./test.sh rebaseline
```

You can now modify the runtime and re-run the tests to make sure the silvers still match:
```
./test.sh
```

The important function to call at the end of your test is ::matches on the SerializingFactory. This will either save or check for equality of the existing silver.
```
TEST_CASE("juice silver", "[file]")
{
    SerializingFactory silver;

    // .. actually use the factory

    CHECK(silver.matches("juice"));
}
```

Diffs=
b329a96f26 Silvers (#9281)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2025-03-31 22:41:54 +00:00
blakdragan7
c719ce1cc4 Deterministic lite rtti
Made lite rtti now use compile time hashes that use the name of the class with rtti enabled as the hash string.

Every use of rtti now needs to be a macro. but other then that, usage of lite rtti is unchanged.

Diffs=
2be44a0f45 Deterministic lite rtti (#8349)

Co-authored-by: Jonathon Copeland <jcopela4@gmail.com>
2024-10-18 02:39:00 +00:00
csmartdalton
163f1beef3 Drop the ColumnLimit to 80 for clang-format
This gives better support for smaller screens and side-by-side windows.

Also standardize the formatting check on GitHub on version 17.

Diffs=
e52e9fff29 Drop the ColumnLimit to 80 for clang-format (#8320)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
2024-10-11 19:22:48 +00:00
csmartdalton
163b2250af Convert RenderPath/CommandPath and RenderPaint to refcounted objects
Diffs=
8666bde87 Convert RenderPath/CommandPath and RenderPaint to refcounted objects (#6395)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
2023-12-27 22:45:06 +00:00
csmartdalton
94d378d055 Add a "lite_rtti" utility and use it with Render objects
We need to be more robust if a user tries to use mismatched factories and renderers. This PR creates a simple "lite_rtti" utility and applies it to every Render object. The renderers now abort early instead of crashing if they are given a Render object for the wrong renderer.

Diffs=
c357e7aa7 Add a "lite_rtti" utility and use it with Render objects (#6311)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
2023-12-08 02:57:31 +00:00
mjtalbot
04de4710ca Outofbandcache
Ok, got this passing testes, which I guess is a step in the right direction.

Before changing unique pointers to rcp, we could only use an image once, as soon as we assigned a new image, the old image would get garbage collected. (this is the actual problem we are trying to solve)

This "solves" the problem and  allows us to add images to a cache in wasm, and then cycle through the cache, swapping out the render image to be displayed for a given fileAsset. We can replace images & fonts on the fly this way.

Problems:
1. overwriting ref & unref in RenderImage, shows that is being reffed and un-reffed constantly (when viewing the attached file with the viewer). Is that expected? doing something similar for Font does not show up the same. I suspect this is related to how we use images when it comes to rendering, just figured i'd check
2. We dont seem to "leak" anything as detectable by our tests, which is good, but our wasm examples show that neither our fonts nor our render images get collected. presumably thats because we would need to manually tell wasm via js that we want to let go of an image?

Also @csmartdalton @umberto-sonnino & @luigi-rosso  it would be great to see what else is concerning.

example file

[just_a_box_with_a_tree.riv.zip](https://github.com/rive-app/rive/files/13042414/just_a_box_with_a_tree.riv.zip)

Diffs=
1506b069c Outofbandcache (#6049)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-10-26 07:56:22 +00:00
csmartdalton
f7758ca24c Fission the CG and Skia renderers
Diffs=
c63346b93 Fission the CG and Skia renderers (#6071)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
2023-10-12 08:18:52 +00:00
csmartdalton
a1f5e03451 Make RenderBuffer mappable
Adds map() and unmap() functions to RenderBuffer, and changes Mesh::draw() to map and update the vertex buffer instead of making a new one.

Also refactors RenderBuffer to just be a blob of data as opposed to an array of elements of fixed size and type. Removes the type-specific factory methods for creating RenderBuffers in favor of a single one that just takes a buffer type and buffer size.

Diffs=
06a187288 Make RenderBuffer mappable (#5907)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
2023-08-31 03:43:28 +00:00
luigi-rosso
7e2e70df67 Runtime Text!
Not ready for review! But feel free to peek :)

Starting to add support for runtime text. This is the bulk of the implementation marrying the Core objects to the text engine we've been working on at the runtime level. PRing in draft early to let tests run.

Also refactors some class and file names to disambiguate more clearly with the Core objects.

Diffs=
051769242 Runtime Text! (#4741)
2023-02-01 00:31:43 +00:00
luigi-rosso
ad04f39753 Bidi Text Support
Adding support for bidirectional text using SheenBidi to break styled runs into directional runs. This also needs to introduce the "baseDirection" of a paragraph (and the concept of a paragraph) in order to properly flow the runs after shaping.

Diffs=
291a3a02b Bidi Text Support (#4282)
2022-10-11 21:06:03 +00:00
csmartdalton
9c3168ef9d clang-format updates
- Put braces on their own line
- Turn off single-line case labels

Diffs=
32e79999a clang-format updates
2022-10-03 20:23:45 +00:00
csmartdalton
e4e765b084 Update Factory::makeRenderPath to only accept a RawPath
Deletes the version that takes spans of points and verbs. We are
planning to inject the implicit moveTos into RawPath, at which point we
won't be able to just copy in arrays of points and verbs anymore.

Also changes the "RawPath" version of the factory method to take a
non-const "RawPath&" ref. This enables zero-copy construction via
stealing the arrays out from under the RawPath's points and verbs.

Diffs=
1bd616612 Update Factory::makeRenderPath to only accept a RawPath (#4211)
2022-09-02 16:07:36 +00:00
csmartdalton
000e628e29 Deindent namespaces
Save the column real estate!

Diffs=
c5d9d854b Deindent namespaces
2022-08-20 00:42:56 +00:00
csmartdalton
1e201df858 clang-format tweaks
* Always align function arguments at the opening paren if they have to
  break (never just indented 4 spaces)

* Only break after a function's return type if there's no other way to
  make it fit in 100 columns

* Allow one-liner case labels in a switch statement

* Delete packages/coop/.clang-format

* Reformat the world

Diffs=
7d242ebc8 clang-format tweaks
2022-08-19 20:29:44 +00:00
mikerreed
69489eab6c Work on font-fallback
This is a way to handle missing characters from a given Font -- we detect this, and then try using other font(s).

The current test just adds some Chinese characters and tries to draw them (which are not present in most of our sample fonts).

CoreGraphics backend handles this for us, we just needed to notice when they introduce a new/different font in the GlyphRun, and wrap-it.

Diffs=
4f4b79858 Work on font-fallback
2022-07-28 13:19:05 +00:00
mikerreed
3a981390e6 Sharable utilities for runtime
Move common subclass of RenderBuffer (just cpu memory) into shareable location
- used by both Skia and CoreGraphics factories

Diffs=
be8594d42 Sharable utilities for runtime
2022-07-25 20:19:19 +00:00
mikerreed
1d3c347586 Move noop subclasses into utils
We had the idea of a "noop" factory or renderer in a few places. Centralize these in "utils".

Involved moving the specialized noorenderpath into its test file.

Diffs=
ec44ae50d Move noop subclasses into utils
2022-07-25 19:43:14 +00:00