From 15dff54478bdb295341423af8ea8ba863f0ed194 Mon Sep 17 00:00:00 2001 From: Jim Graham Date: Thu, 2 Nov 2023 01:13:12 -0700 Subject: [PATCH] Deprecate the exposed Rect fields --- impeller/geometry/geometry_asserts.h | 8 ++++---- impeller/geometry/geometry_unittests.cc | 8 ++++---- impeller/geometry/rect.h | 2 ++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/impeller/geometry/geometry_asserts.h b/impeller/geometry/geometry_asserts.h index 57022b461f9a0..ab3f37389a522 100644 --- a/impeller/geometry/geometry_asserts.h +++ b/impeller/geometry/geometry_asserts.h @@ -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."; diff --git a/impeller/geometry/geometry_unittests.cc b/impeller/geometry/geometry_unittests.cc index 6dc6bd0f741f0..d5ee6d423002d 100644 --- a/impeller/geometry/geometry_unittests.cc +++ b/impeller/geometry/geometry_unittests.cc @@ -744,10 +744,10 @@ TEST(GeometryTest, CanConvertTTypesExplicitly) { { Rect r1 = Rect::MakeXYWH(1.0, 2.0, 3.0, 4.0); IRect r2 = static_cast(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); } } diff --git a/impeller/geometry/rect.h b/impeller/geometry/rect.h index 3f6cdceb04910..c40ce26ad1541 100644 --- a/impeller/geometry/rect.h +++ b/impeller/geometry/rect.h @@ -20,7 +20,9 @@ template struct TRect { using Type = T; + /// DEPRECATED: Use |GetOrigin| TPoint origin; + /// DEPRECATED: Use |GetSize| TSize size; constexpr TRect() : origin({0, 0}), size({0, 0}) {}