mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00
C++: Hide sixtyfps::PathData from the public API
This commit is contained in:
parent
51bc21c9a5
commit
fe59fb3ec3
2 changed files with 18 additions and 20 deletions
|
@ -12,14 +12,14 @@ LICENSE END */
|
|||
#include <string_view>
|
||||
#include "sixtyfps_pathdata_internal.h"
|
||||
|
||||
namespace sixtyfps {
|
||||
namespace sixtyfps::private_api {
|
||||
|
||||
using cbindgen_private::types::PathArcTo;
|
||||
using cbindgen_private::types::PathCubicTo;
|
||||
using cbindgen_private::types::PathElement;
|
||||
using cbindgen_private::types::PathEvent;
|
||||
using cbindgen_private::types::PathLineTo;
|
||||
using cbindgen_private::types::PathMoveTo;
|
||||
using cbindgen_private::types::PathCubicTo;
|
||||
using cbindgen_private::types::PathQuadraticTo;
|
||||
using cbindgen_private::types::Point;
|
||||
|
||||
|
@ -40,27 +40,25 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
friend bool operator==(const PathData &a, const PathData &b) {
|
||||
friend bool operator==(const PathData &a, const PathData &b)
|
||||
{
|
||||
if (a.data.tag != b.data.tag)
|
||||
return false;
|
||||
switch (a.data.tag) {
|
||||
case cbindgen_private::types::PathData::Tag::Elements:
|
||||
return a.data.elements._0 == b.data.elements._0;
|
||||
case cbindgen_private::types::PathData::Tag::Events:
|
||||
return a.data.events._0 == b.data.events._0 && b.data.events._0 == b.data.events._0;
|
||||
case cbindgen_private::types::PathData::Tag::None:
|
||||
return true;
|
||||
case cbindgen_private::types::PathData::Tag::Elements:
|
||||
return a.data.elements._0 == b.data.elements._0;
|
||||
case cbindgen_private::types::PathData::Tag::Events:
|
||||
return a.data.events._0 == b.data.events._0 && b.data.events._0 == b.data.events._0;
|
||||
case cbindgen_private::types::PathData::Tag::None:
|
||||
return true;
|
||||
}
|
||||
return false; //unreachable
|
||||
return false; // unreachable
|
||||
}
|
||||
friend bool operator!=(const PathData &a, const PathData &b) {
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
friend bool operator!=(const PathData &a, const PathData &b) { return !(a == b); }
|
||||
|
||||
private:
|
||||
static SharedVector<PathElement> elements_from_array(const PathElement *firstElement,
|
||||
size_t count)
|
||||
size_t count)
|
||||
{
|
||||
SharedVector<PathElement> tmp;
|
||||
sixtyfps_new_path_elements(&tmp, firstElement, count);
|
||||
|
@ -68,9 +66,9 @@ private:
|
|||
}
|
||||
|
||||
static cbindgen_private::types::PathData events_from_array(const PathEvent *firstEvent,
|
||||
size_t event_count,
|
||||
const Point *firstCoordinate,
|
||||
size_t coordinate_count)
|
||||
size_t event_count,
|
||||
const Point *firstCoordinate,
|
||||
size_t coordinate_count)
|
||||
{
|
||||
SharedVector<PathEvent> events;
|
||||
SharedVector<Point> coordinates;
|
||||
|
|
|
@ -2068,7 +2068,7 @@ fn compile_path(path: &crate::expression_tree::Path, component: &Rc<Component>)
|
|||
sixtyfps::PathElement elements[{}] = {{
|
||||
{}
|
||||
}};
|
||||
return sixtyfps::PathData(&elements[0], std::size(elements));
|
||||
return sixtyfps::private_api::PathData(&elements[0], std::size(elements));
|
||||
}}()"#,
|
||||
converted_elements.len(),
|
||||
converted_elements.join(",")
|
||||
|
@ -2084,7 +2084,7 @@ fn compile_path(path: &crate::expression_tree::Path, component: &Rc<Component>)
|
|||
sixtyfps::Point coordinates[{}] = {{
|
||||
{}
|
||||
}};
|
||||
return sixtyfps::PathData(&events[0], std::size(events), &coordinates[0], std::size(coordinates));
|
||||
return sixtyfps::private_api::PathData(&events[0], std::size(events), &coordinates[0], std::size(coordinates));
|
||||
}}()"#,
|
||||
converted_events.len(),
|
||||
converted_events.join(","),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue