C++: Improve reliability of comparison operator of slint::Image

Call into the Rust implementation, so that we have to maintain only one
implementation.
This commit is contained in:
Simon Hausmann 2023-05-23 20:14:17 +02:00 committed by Simon Hausmann
parent f51ca82f10
commit 084ff70079
3 changed files with 13 additions and 2 deletions

View file

@ -199,9 +199,12 @@ public:
}
/// Returns true if \a a refers to the same image as \a b; false otherwise.
friend bool operator==(const Image &a, const Image &b) { return a.data == b.data; }
friend bool operator==(const Image &a, const Image &b)
{
return cbindgen_private::types::slint_image_compare_equal(&a.data, &b.data);
}
/// Returns false if \a a refers to the same image as \a b; true otherwise.
friend bool operator!=(const Image &a, const Image &b) { return a.data != b.data; }
friend bool operator!=(const Image &a, const Image &b) { return !(a == b); }
/// \private
explicit Image(cbindgen_private::types::Image inner) : data(inner) { }