Some pedantic C++ fixes
diff --git a/include/rive/factory.hpp b/include/rive/factory.hpp
index 1960faf..c250285 100644
--- a/include/rive/factory.hpp
+++ b/include/rive/factory.hpp
@@ -30,14 +30,14 @@
float ex, float ey,
const ColorInt colors[], // [count]
const float stops[], // [count]
- int count,
+ size_t count,
RenderTileMode,
const Mat2D* localMatrix = nullptr) = 0;
virtual rcp<RenderShader> makeRadialGradient(float cx, float cy, float radius,
const ColorInt colors[], // [count]
const float stops[], // [count]
- int count,
+ size_t count,
RenderTileMode,
const Mat2D* localMatrix = nullptr) = 0;
diff --git a/skia/renderer/include/skia_factory.hpp b/skia/renderer/include/skia_factory.hpp
index 26629ed..9b145bb 100644
--- a/skia/renderer/include/skia_factory.hpp
+++ b/skia/renderer/include/skia_factory.hpp
@@ -18,14 +18,14 @@
float ex, float ey,
const ColorInt colors[], // [count]
const float stops[], // [count]
- int count,
+ size_t count,
RenderTileMode,
const Mat2D* localMatrix = nullptr) override;
rcp<RenderShader> makeRadialGradient(float cx, float cy, float radius,
const ColorInt colors[], // [count]
const float stops[], // [count]
- int count,
+ size_t count,
RenderTileMode,
const Mat2D* localMatrix = nullptr) override;
diff --git a/skia/renderer/src/skia_factory.cpp b/skia/renderer/src/skia_factory.cpp
index 017c160..071da4d 100644
--- a/skia/renderer/src/skia_factory.cpp
+++ b/skia/renderer/src/skia_factory.cpp
@@ -264,7 +264,7 @@
float ex, float ey,
const ColorInt colors[], // [count]
const float stops[], // [count]
- int count,
+ size_t count,
RenderTileMode mode,
const Mat2D* localMatrix) {
const SkPoint pts[] = {{sx, sy}, {ex, ey}};
@@ -277,7 +277,7 @@
rcp<RenderShader> SkiaFactory::makeRadialGradient(float cx, float cy, float radius,
const ColorInt colors[], // [count]
const float stops[], // [count]
- int count,
+ size_t count,
RenderTileMode mode,
const Mat2D* localMatrix) {
const SkMatrix lm = localMatrix ? ToSkia::convert(*localMatrix) : SkMatrix();
diff --git a/src/artboard.cpp b/src/artboard.cpp
index dffdf8c..0a099ba 100644
--- a/src/artboard.cpp
+++ b/src/artboard.cpp
@@ -302,7 +302,7 @@
auto it = std::find(m_Objects.begin(), m_Objects.end(), object);
if (it != m_Objects.end()) {
- return it - m_Objects.begin();
+ return castTo<uint32_t>(it - m_Objects.begin());
} else {
return 0;
}
diff --git a/src/constraints/ik_constraint.cpp b/src/constraints/ik_constraint.cpp
index bb07b3a..0c532c0 100644
--- a/src/constraints/ik_constraint.cpp
+++ b/src/constraints/ik_constraint.cpp
@@ -227,7 +227,7 @@
for (int i = 0; i < last; i++) {
BoneChainLink* item = &m_FkChain[i];
solve2(item, tip, worldTargetTranslation);
- for (int j = item->index + 1, end = m_FkChain.size() - 1; j < end; j++) {
+ for (int j = item->index + 1, end = (int)m_FkChain.size() - 1; j < end; j++) {
BoneChainLink& fk = m_FkChain[j];
fk.parentWorldInverse = getParentWorld(*fk.bone).invertOrIdentity();
}
diff --git a/src/shapes/path.cpp b/src/shapes/path.cpp
index 28efb10..f6090fd 100644
--- a/src/shapes/path.cpp
+++ b/src/shapes/path.cpp
@@ -70,8 +70,8 @@
} else {
startIsCubic = prevIsCubic = false;
auto point = *firstPoint->as<StraightVertex>();
-
- if (auto radius = point.radius(); radius > 0.0f) {
+ auto radius = point.radius();
+ if (radius > 0.0f) {
auto prev = vertices[length - 1];
Vec2D pos = point.renderTranslation();
@@ -120,8 +120,8 @@
} else {
auto point = *vertex->as<StraightVertex>();
Vec2D pos = point.renderTranslation();
-
- if (auto radius = point.radius(); radius > 0.0f) {
+ auto radius = point.radius();
+ if (radius > 0.0f) {
Vec2D toPrev = out - pos;
auto toPrevLength = toPrev.normalizeLength();
diff --git a/src/shapes/points_path.cpp b/src/shapes/points_path.cpp
index 842f05a..dcdc0a5 100644
--- a/src/shapes/points_path.cpp
+++ b/src/shapes/points_path.cpp
@@ -23,7 +23,7 @@
void PointsPath::update(ComponentDirt value) {
if (hasDirt(value, ComponentDirt::Path) && skin() != nullptr) {
- skin()->deform(Span((Vertex**)m_Vertices.data(), m_Vertices.size()));
+ skin()->deform(Span<Vertex*>((Vertex**)m_Vertices.data(), m_Vertices.size()));
}
Super::update(value);
}
@@ -35,4 +35,4 @@
Super::markPathDirty();
}
-void PointsPath::markSkinDirty() { markPathDirty(); }
\ No newline at end of file
+void PointsPath::markSkinDirty() { markPathDirty(); }
diff --git a/test/no_op_factory.cpp b/test/no_op_factory.cpp
index 2f088f2..c09fa80 100644
--- a/test/no_op_factory.cpp
+++ b/test/no_op_factory.cpp
@@ -13,14 +13,14 @@
float ex, float ey,
const ColorInt colors[], // [count]
const float stops[], // [count]
- int count,
+ size_t count,
RenderTileMode,
const Mat2D* localMatrix) { return nullptr; }
rcp<RenderShader> NoOpFactory::makeRadialGradient(float cx, float cy, float radius,
const ColorInt colors[], // [count]
const float stops[], // [count]
- int count,
+ size_t count,
RenderTileMode,
const Mat2D* localMatrix) { return nullptr; }
diff --git a/test/no_op_factory.hpp b/test/no_op_factory.hpp
index 59095be..495c1a8 100644
--- a/test/no_op_factory.hpp
+++ b/test/no_op_factory.hpp
@@ -15,14 +15,14 @@
float ex, float ey,
const ColorInt colors[], // [count]
const float stops[], // [count]
- int count,
+ size_t count,
RenderTileMode,
const Mat2D* localMatrix = nullptr) override;
rcp<RenderShader> makeRadialGradient(float cx, float cy, float radius,
const ColorInt colors[], // [count]
const float stops[], // [count]
- int count,
+ size_t count,
RenderTileMode,
const Mat2D* localMatrix = nullptr) override;