Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] Deprecate the exposed Rect fields #47592

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions impeller/geometry/geometry_asserts.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ inline ::testing::AssertionResult QuaternionNear(impeller::Quaternion a,
}

inline ::testing::AssertionResult RectNear(impeller::Rect a, impeller::Rect b) {
auto equal = NumberNear(a.origin.x, b.origin.x) &&
NumberNear(a.origin.y, b.origin.y) &&
NumberNear(a.size.width, b.size.width) &&
NumberNear(a.size.height, b.size.height);
auto equal = NumberNear(a.GetOrigin().x, b.GetOrigin().x) &&
NumberNear(a.GetOrigin().y, b.GetOrigin().y) &&
NumberNear(a.GetSize().width, b.GetSize().width) &&
NumberNear(a.GetSize().height, b.GetSize().height);

return equal ? ::testing::AssertionSuccess()
: ::testing::AssertionFailure() << "Rects are not equal.";
Expand Down
8 changes: 4 additions & 4 deletions impeller/geometry/geometry_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -744,10 +744,10 @@ TEST(GeometryTest, CanConvertTTypesExplicitly) {
{
Rect r1 = Rect::MakeXYWH(1.0, 2.0, 3.0, 4.0);
IRect r2 = static_cast<IRect>(r1);
ASSERT_EQ(r2.origin.x, 1u);
ASSERT_EQ(r2.origin.y, 2u);
ASSERT_EQ(r2.size.width, 3u);
ASSERT_EQ(r2.size.height, 4u);
ASSERT_EQ(r2.GetOrigin().x, 1u);
ASSERT_EQ(r2.GetOrigin().y, 2u);
ASSERT_EQ(r2.GetSize().width, 3u);
ASSERT_EQ(r2.GetSize().height, 4u);
}
}

Expand Down
2 changes: 2 additions & 0 deletions impeller/geometry/rect.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ template <class T>
struct TRect {
using Type = T;

/// DEPRECATED: Use |GetOrigin|
TPoint<Type> origin;
/// DEPRECATED: Use |GetSize|
TSize<Type> size;

constexpr TRect() : origin({0, 0}), size({0, 0}) {}
Expand Down