Skip to content

Commit

Permalink
Fixed clang check.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dragostis and dragostis committed Oct 20, 2023
1 parent 780403b commit 5c8dbb2
Show file tree
Hide file tree
Showing 19 changed files with 78 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3b32d24314be7d877a11b8069622d6d6115383b7
c5cde614bdb0de792c0bb074185f6ff51b1ff954
8 changes: 5 additions & 3 deletions include/rive/animation/nested_input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ class NestedInput : public NestedInputBase
{
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;
}
Expand Down
5 changes: 4 additions & 1 deletion include/rive/animation/state_machine_instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ class StateMachineInstance : public Scene, public KeyedCallbackReporter
/// 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; }
Expand Down
4 changes: 2 additions & 2 deletions include/rive/assets/file_asset_referencer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ namespace rive
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;
Expand Down
2 changes: 1 addition & 1 deletion include/rive/file_asset_loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FileAssetLoader
/// 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

Expand Down
4 changes: 2 additions & 2 deletions include/rive/shapes/shape_paint_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class ShapePaintContainer

void propagateOpacity(float opacity);

#ifdef TESTING
#ifdef TESTING
const std::vector<ShapePaint*>& shapePaints() const { return m_ShapePaints; }
#endif
#endif
};
} // namespace rive

Expand Down
14 changes: 9 additions & 5 deletions src/animation/listener_bool_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ bool ListenerBoolChange::validateInputType(const StateMachineInput* input) const

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:
Expand All @@ -39,15 +40,18 @@ void ListenerBoolChange::perform(StateMachineInstance* stateMachineInstance, Vec
break;
}
}
} else {
}
else
{
auto inputInstance = stateMachineInstance->input(inputId());
if (inputInstance == nullptr)
{
return;
}
// 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:
Expand Down
14 changes: 9 additions & 5 deletions src/animation/listener_number_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,30 @@ bool ListenerNumberChange::validateInputType(const StateMachineInput* input) con

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)
{
return;
}
// 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());
}
}
Expand Down
14 changes: 9 additions & 5 deletions src/animation/listener_trigger_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,30 @@ bool ListenerTriggerChange::validateInputType(const StateMachineInput* input) co
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)
{
return;
}
// 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();
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/animation/nested_bool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/animation/nested_number.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/animation/nested_trigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

}
13 changes: 7 additions & 6 deletions src/assets/font_asset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ bool FontAsset::decode(Span<const uint8_t> data, Factory* factory)
}
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);
}

}
12 changes: 7 additions & 5 deletions src/importers/file_asset_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FileAssetImporter::FileAssetImporter(FileAsset* fileAsset,
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)
{
Expand All @@ -24,23 +24,25 @@ void FileAssetImporter::onFileAssetContents(std::unique_ptr<FileAssetContents> c

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;
}
5 changes: 2 additions & 3 deletions src/shapes/shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ void Shape::addPath(Path* path)

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)
Expand Down
1 change: 0 additions & 1 deletion test/follow_path_constraint_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ TEST_CASE("follow path constraint updates world transform", "[file]")
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");
Expand Down
2 changes: 0 additions & 2 deletions test/in_band_asset_load_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <catch.hpp>
#include <cstdio>


class PretendAssetLoader : public rive ::FileAssetLoader
{

Expand Down Expand Up @@ -65,7 +64,6 @@ TEST_CASE("Load asset with in-band image", "[asset]")
REQUIRE(firstAsset->as<rive::ImageAsset>()->decodedByteSize == 308);
}


TEST_CASE("Load asset with in-band image, passing responsibility to loader", "[asset]")
{
auto loader = PretendAssetLoader();
Expand Down
5 changes: 3 additions & 2 deletions test/nested_artboard_opacity_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ TEST_CASE("Nested artboard background renders with opacity", "[file]")

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();
Expand Down
4 changes: 2 additions & 2 deletions viewer/src/skia/skia_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ sk_sp<SkSurface> makeSkiaSurface(GrDirectContext* context, int width, int height
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"
Expand Down

0 comments on commit 5c8dbb2

Please sign in to comment.