Fixed clang check. The [[ syntax requires bash, not merely sh. This patch fixes this by simply running the script and letting it use the binary declared inside. Diffs= c5cde614b Fixed clang check. (#6125) Co-authored-by: DragoČ™ Tiselice <dragos@rive.app>
diff --git a/.rive_head b/.rive_head index 3b7e4bf..737da8c 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -3b32d24314be7d877a11b8069622d6d6115383b7 +c5cde614bdb0de792c0bb074185f6ff51b1ff954
diff --git a/include/rive/animation/nested_input.hpp b/include/rive/animation/nested_input.hpp index 9d4970c..495bafb 100644 --- a/include/rive/animation/nested_input.hpp +++ b/include/rive/animation/nested_input.hpp
@@ -9,11 +9,13 @@ { public: protected: - SMIInput* input() { + SMIInput* input() + { auto parent = this->parent(); - if (parent != nullptr && parent->is<NestedStateMachine>()) + if (parent != nullptr && parent->is<NestedStateMachine>()) { - StateMachineInstance* smInstance = parent->as<NestedStateMachine>()->stateMachineInstance(); + StateMachineInstance* smInstance = + parent->as<NestedStateMachine>()->stateMachineInstance(); auto inputInstance = smInstance->input(this->inputId()); return inputInstance; }
diff --git a/include/rive/animation/state_machine_instance.hpp b/include/rive/animation/state_machine_instance.hpp index 069d1a7..2a4838b 100644 --- a/include/rive/animation/state_machine_instance.hpp +++ b/include/rive/animation/state_machine_instance.hpp
@@ -100,7 +100,10 @@ /// the backing artboard (explicitly not allowed on Scenes). Artboard* artboard() { return m_artboardInstance; } - void setParentStateMachineInstance(StateMachineInstance* instance) { m_parentStateMachineInstance = instance; } + void setParentStateMachineInstance(StateMachineInstance* instance) + { + m_parentStateMachineInstance = instance; + } StateMachineInstance* parentStateMachineInstance() { return m_parentStateMachineInstance; } void setParentNestedArtboard(NestedArtboard* artboard) { m_parentNestedArtboard = artboard; }
diff --git a/include/rive/assets/file_asset_referencer.hpp b/include/rive/assets/file_asset_referencer.hpp index 1d5797a..1a82cfc 100644 --- a/include/rive/assets/file_asset_referencer.hpp +++ b/include/rive/assets/file_asset_referencer.hpp
@@ -9,10 +9,10 @@ class FileAsset; class FileAssetReferencer { -protected: +protected: FileAsset* m_fileAsset = nullptr; -public: +public: virtual ~FileAssetReferencer() = 0; virtual void setAsset(FileAsset* asset); virtual uint32_t assetId() = 0;
diff --git a/include/rive/file_asset_loader.hpp b/include/rive/file_asset_loader.hpp index 32136bb..55661bb 100644 --- a/include/rive/file_asset_loader.hpp +++ b/include/rive/file_asset_loader.hpp
@@ -16,7 +16,7 @@ /// Load the contents of the given asset /// /// @param asset describes the asset that Rive is looking for the - /// contents of. + /// contents of. /// @param inBandBytes is a pointer to the bytes in question /// @returns bool indicating if we are loading or have loaded the contents
diff --git a/include/rive/shapes/shape_paint_container.hpp b/include/rive/shapes/shape_paint_container.hpp index ceccbf4..1ef63b8 100644 --- a/include/rive/shapes/shape_paint_container.hpp +++ b/include/rive/shapes/shape_paint_container.hpp
@@ -39,9 +39,9 @@ void propagateOpacity(float opacity); - #ifdef TESTING +#ifdef TESTING const std::vector<ShapePaint*>& shapePaints() const { return m_ShapePaints; } - #endif +#endif }; } // namespace rive
diff --git a/src/animation/listener_bool_change.cpp b/src/animation/listener_bool_change.cpp index ba9e2aa..b497585 100644 --- a/src/animation/listener_bool_change.cpp +++ b/src/animation/listener_bool_change.cpp
@@ -17,15 +17,16 @@ void ListenerBoolChange::perform(StateMachineInstance* stateMachineInstance, Vec2D position) const { - if (nestedInputId() != Core::emptyId) + if (nestedInputId() != Core::emptyId) { auto nestedInputInstance = stateMachineInstance->artboard()->resolve(nestedInputId()); - if (nestedInputInstance == nullptr) + if (nestedInputInstance == nullptr) { return; } auto nestedBoolInput = static_cast<NestedBool*>(nestedInputInstance); - if (nestedBoolInput != nullptr) { + if (nestedBoolInput != nullptr) + { switch (value()) { case 0: @@ -39,7 +40,9 @@ break; } } - } else { + } + else + { auto inputInstance = stateMachineInstance->input(inputId()); if (inputInstance == nullptr) { @@ -47,7 +50,8 @@ } // If it's not null, it must be our correct type (why we validate at load time). auto boolInput = static_cast<SMIBool*>(inputInstance); - if (boolInput != nullptr) { + if (boolInput != nullptr) + { switch (value()) { case 0:
diff --git a/src/animation/listener_number_change.cpp b/src/animation/listener_number_change.cpp index 3b3ae43..6dfaec9 100644 --- a/src/animation/listener_number_change.cpp +++ b/src/animation/listener_number_change.cpp
@@ -17,18 +17,21 @@ void ListenerNumberChange::perform(StateMachineInstance* stateMachineInstance, Vec2D position) const { - if (nestedInputId() != Core::emptyId) + if (nestedInputId() != Core::emptyId) { auto nestedInputInstance = stateMachineInstance->artboard()->resolve(nestedInputId()); - if (nestedInputInstance == nullptr) + if (nestedInputInstance == nullptr) { return; } auto nestedNumberInput = static_cast<NestedNumber*>(nestedInputInstance); - if (nestedNumberInput != nullptr) { + if (nestedNumberInput != nullptr) + { nestedNumberInput->nestedValue(value()); } - } else { + } + else + { auto inputInstance = stateMachineInstance->input(inputId()); if (inputInstance == nullptr) { @@ -36,7 +39,8 @@ } // If it's not null, it must be our correct type (why we validate at load time). auto numberInput = static_cast<SMINumber*>(inputInstance); - if (numberInput != nullptr) { + if (numberInput != nullptr) + { numberInput->value(value()); } }
diff --git a/src/animation/listener_trigger_change.cpp b/src/animation/listener_trigger_change.cpp index 8b6ac21..9e3e988 100644 --- a/src/animation/listener_trigger_change.cpp +++ b/src/animation/listener_trigger_change.cpp
@@ -19,18 +19,21 @@ void ListenerTriggerChange::perform(StateMachineInstance* stateMachineInstance, Vec2D position) const { - if (nestedInputId() != Core::emptyId) + if (nestedInputId() != Core::emptyId) { auto nestedInputInstance = stateMachineInstance->artboard()->resolve(nestedInputId()); - if (nestedInputInstance == nullptr) + if (nestedInputInstance == nullptr) { return; } auto nestedTriggerInput = static_cast<NestedTrigger*>(nestedInputInstance); - if (nestedTriggerInput != nullptr) { + if (nestedTriggerInput != nullptr) + { nestedTriggerInput->fire(CallbackData(stateMachineInstance, 0)); } - } else { + } + else + { auto inputInstance = stateMachineInstance->input(inputId()); if (inputInstance == nullptr) { @@ -38,7 +41,8 @@ } // If it's not null, it must be our correct type (why we validate at load time). auto triggerInput = static_cast<SMITrigger*>(inputInstance); - if (triggerInput != nullptr) { + if (triggerInput != nullptr) + { triggerInput->fire(); } }
diff --git a/src/animation/nested_bool.cpp b/src/animation/nested_bool.cpp index cf4110d..6fda258 100644 --- a/src/animation/nested_bool.cpp +++ b/src/animation/nested_bool.cpp
@@ -6,12 +6,14 @@ using namespace rive; class StateMachineInstance; -void NestedBool::nestedValueChanged() { +void NestedBool::nestedValueChanged() +{ auto inputInstance = input(); - if (inputInstance != nullptr) + if (inputInstance != nullptr) { auto boolInput = static_cast<SMIBool*>(inputInstance); - if (boolInput != nullptr) { + if (boolInput != nullptr) + { boolInput->value(nestedValue()); } }
diff --git a/src/animation/nested_number.cpp b/src/animation/nested_number.cpp index 6628b91..e5256bc 100644 --- a/src/animation/nested_number.cpp +++ b/src/animation/nested_number.cpp
@@ -6,12 +6,14 @@ using namespace rive; class StateMachineInstance; -void NestedNumber::nestedValueChanged() { +void NestedNumber::nestedValueChanged() +{ auto inputInstance = input(); - if (inputInstance != nullptr) + if (inputInstance != nullptr) { auto numInput = static_cast<SMINumber*>(inputInstance); - if (numInput != nullptr) { + if (numInput != nullptr) + { numInput->value(nestedValue()); } }
diff --git a/src/animation/nested_trigger.cpp b/src/animation/nested_trigger.cpp index f590f94..26b7990 100644 --- a/src/animation/nested_trigger.cpp +++ b/src/animation/nested_trigger.cpp
@@ -6,14 +6,15 @@ using namespace rive; class StateMachineInstance; -void NestedTrigger::fire(const CallbackData& value) { +void NestedTrigger::fire(const CallbackData& value) +{ auto inputInstance = input(); - if (inputInstance != nullptr) + if (inputInstance != nullptr) { auto numInput = static_cast<SMITrigger*>(inputInstance); - if (numInput != nullptr) { + if (numInput != nullptr) + { numInput->fire(); } } - } \ No newline at end of file
diff --git a/src/assets/font_asset.cpp b/src/assets/font_asset.cpp index a398e55..f40f32d 100644 --- a/src/assets/font_asset.cpp +++ b/src/assets/font_asset.cpp
@@ -13,14 +13,15 @@ } std::string FontAsset::fileExtension() const { return "ttf"; } -void FontAsset::font(rcp<Font> font) { - m_font = std::move(font); +void FontAsset::font(rcp<Font> font) +{ + m_font = std::move(font); - // We could try to tie this to some generic FileAssetReferencer callback - // but for that we'd need this to be behind a more generic setter like + // We could try to tie this to some generic FileAssetReferencer callback + // but for that we'd need this to be behind a more generic setter like // ::asset(rcp<Asset> asset) - for (FileAssetReferencer* fileAssetReferencer: fileAssetReferencers()){ + for (FileAssetReferencer* fileAssetReferencer : fileAssetReferencers()) + { static_cast<TextStyle*>(fileAssetReferencer)->addDirt(ComponentDirt::TextShape); } - } \ No newline at end of file
diff --git a/src/importers/file_asset_importer.cpp b/src/importers/file_asset_importer.cpp index 545b462..b5f1558 100644 --- a/src/importers/file_asset_importer.cpp +++ b/src/importers/file_asset_importer.cpp
@@ -13,7 +13,7 @@ m_FileAsset(fileAsset), m_FileAssetLoader(assetLoader), m_Factory(factory) {} -// if file asset contents are found when importing a rive file, store those for when we resolve +// if file asset contents are found when importing a rive file, store those for when we resolve // the importer later void FileAssetImporter::onFileAssetContents(std::unique_ptr<FileAssetContents> contents) { @@ -24,23 +24,25 @@ StatusCode FileAssetImporter::resolve() { - + Span<const uint8_t> bytes; if (m_Content != nullptr) { bytes = m_Content->bytes(); } - // If we have a file asset loader, lets give it the opportunity to claim responsibility for loading the asset + // If we have a file asset loader, lets give it the opportunity to claim responsibility for + // loading the asset if (m_FileAssetLoader != nullptr && m_FileAssetLoader->loadContents(*m_FileAsset, bytes)) { return StatusCode::Ok; } // If we do not, but we have found in band contents, load those - else if (bytes.size() > 0){ + else if (bytes.size() > 0) + { m_FileAsset->decode(bytes, m_Factory); } - + // Note that it's ok for an asset to not resolve (or to resolve async). return StatusCode::Ok; }
diff --git a/src/shapes/shape.cpp b/src/shapes/shape.cpp index 0d612bd..9abbf75 100644 --- a/src/shapes/shape.cpp +++ b/src/shapes/shape.cpp
@@ -21,9 +21,8 @@ bool Shape::canDeferPathUpdate() { - return renderOpacity() == 0 - && (pathSpace() & PathSpace::Clipping) != PathSpace::Clipping - && (pathSpace() & PathSpace::FollowPath) != PathSpace::FollowPath; + return renderOpacity() == 0 && (pathSpace() & PathSpace::Clipping) != PathSpace::Clipping && + (pathSpace() & PathSpace::FollowPath) != PathSpace::FollowPath; } void Shape::update(ComponentDirt value)
diff --git a/test/follow_path_constraint_test.cpp b/test/follow_path_constraint_test.cpp index 7ed2959..2090186 100644 --- a/test/follow_path_constraint_test.cpp +++ b/test/follow_path_constraint_test.cpp
@@ -27,7 +27,6 @@ REQUIRE(targetComponents.y() == rectComponents.y()); } - TEST_CASE("follow path with 0 opacity constraint updates world transform", "[file]") { auto file = ReadRiveFile("../../test/assets/follow_path_with_0_opacity.riv");
diff --git a/test/in_band_asset_load_test.cpp b/test/in_band_asset_load_test.cpp index b9a50c5..29eb716 100644 --- a/test/in_band_asset_load_test.cpp +++ b/test/in_band_asset_load_test.cpp
@@ -17,7 +17,6 @@ #include <catch.hpp> #include <cstdio> - class PretendAssetLoader : public rive ::FileAssetLoader { @@ -65,7 +64,6 @@ REQUIRE(firstAsset->as<rive::ImageAsset>()->decodedByteSize == 308); } - TEST_CASE("Load asset with in-band image, passing responsibility to loader", "[asset]") { auto loader = PretendAssetLoader();
diff --git a/test/nested_artboard_opacity_test.cpp b/test/nested_artboard_opacity_test.cpp index e3c2b73..5fdd19e 100644 --- a/test/nested_artboard_opacity_test.cpp +++ b/test/nested_artboard_opacity_test.cpp
@@ -10,11 +10,12 @@ auto mainArtboard = file->artboard()->instance(); REQUIRE(mainArtboard->find("Parent Artboard") != nullptr); - auto artboard = mainArtboard->find<rive::Artboard>("Parent Artboard"); + auto artboard = mainArtboard->find<rive::Artboard>("Parent Artboard"); artboard->updateComponents(); REQUIRE(artboard->is<rive::Artboard>()); REQUIRE(artboard->find("Nested artboard container") != nullptr); - auto nestedArtboardContainer = artboard->find<rive::NestedArtboard>("Nested artboard container"); + auto nestedArtboardContainer = + artboard->find<rive::NestedArtboard>("Nested artboard container"); REQUIRE(nestedArtboardContainer->artboard() != nullptr); auto nestedArtboard = nestedArtboardContainer->artboard(); nestedArtboard->updateComponents();
diff --git a/viewer/src/skia/skia_host.cpp b/viewer/src/skia/skia_host.cpp index a24e4d8..aae1d10 100644 --- a/viewer/src/skia/skia_host.cpp +++ b/viewer/src/skia/skia_host.cpp
@@ -27,9 +27,9 @@ void skiaPresentSurface(sk_sp<SkSurface> surface); // Experimental flag, until we complete coregraphics_host -//#define TEST_CG_RENDERER +// #define TEST_CG_RENDERER -//#define SW_SKIA_MODE +// #define SW_SKIA_MODE #ifdef TEST_CG_RENDERER #include "cg_factory.hpp"