Skip to content

Commit

Permalink
[flatland] Swap 90 and 270 rotations
Browse files Browse the repository at this point in the history
gfx::OverlayTransform and Flatland rotate in opposite directions
relative to each other, so swap 90 and 270.

(cherry picked from commit 6d54ffd)

Fixed: 1457636, b/287589034
Change-Id: I544358770824387a9c0ed6ef843fbb5658c741e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4642370
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Auto-Submit: Emircan Uysaler <emircan@chromium.org>
Commit-Queue: Emircan Uysaler <emircan@chromium.org>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1161984}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4644529
Auto-Submit: Wez <wez@chromium.org>
Reviewed-by: David Dorwin <ddorwin@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/branch-heads/5845@{#91}
Cr-Branched-From: 5a5dff6-refs/heads/main@{#1160321}
  • Loading branch information
uysalere authored and Chromium LUCI CQ committed Jun 26, 2023
1 parent 67e510a commit 520f004
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 8 additions & 6 deletions ui/ozone/platform/flatland/flatland_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ OverlayTransformFlatlandProperties OverlayTransformToFlatlandProperties(
.translation = {rounded_bounds.x(), rounded_bounds.y()},
.orientation = fuchsia::ui::composition::Orientation::CCW_0_DEGREES,
.image_flip = fuchsia::ui::composition::ImageFlip::NONE};
// gfx::OverlayTransform and Flatland rotate in opposite directions relative
// to each other, so swap 90 and 270.
case gfx::OVERLAY_TRANSFORM_ROTATE_90:
return {
.translation = {rounded_bounds.x(),
rounded_bounds.y() + rounded_bounds.height()},
.orientation = fuchsia::ui::composition::Orientation::CCW_90_DEGREES,
.translation = {rounded_bounds.x() + rounded_bounds.width(),
rounded_bounds.y()},
.orientation = fuchsia::ui::composition::Orientation::CCW_270_DEGREES,
.image_flip = fuchsia::ui::composition::ImageFlip::NONE};
case gfx::OVERLAY_TRANSFORM_ROTATE_180:
return {
Expand All @@ -78,9 +80,9 @@ OverlayTransformFlatlandProperties OverlayTransformToFlatlandProperties(
.image_flip = fuchsia::ui::composition::ImageFlip::NONE};
case gfx::OVERLAY_TRANSFORM_ROTATE_270:
return {
.translation = {rounded_bounds.x() + rounded_bounds.width(),
rounded_bounds.y()},
.orientation = fuchsia::ui::composition::Orientation::CCW_270_DEGREES,
.translation = {rounded_bounds.x(),
rounded_bounds.y() + rounded_bounds.height()},
.orientation = fuchsia::ui::composition::Orientation::CCW_90_DEGREES,
.image_flip = fuchsia::ui::composition::ImageFlip::NONE};
case gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL:
return {
Expand Down
8 changes: 4 additions & 4 deletions ui/ozone/platform/flatland/flatland_surface_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,19 @@ INSTANTIATE_TEST_SUITE_P(
Vec{10, 20},
SizeU{120U, 115U}),
std::make_tuple(gfx::OVERLAY_TRANSFORM_ROTATE_90,
Orientation::CCW_90_DEGREES,
Orientation::CCW_270_DEGREES,
ImageFlip::NONE,
Vec{10, 135},
Vec{130, 20},
SizeU{115U, 120U}),
std::make_tuple(gfx::OVERLAY_TRANSFORM_ROTATE_180,
Orientation::CCW_180_DEGREES,
ImageFlip::NONE,
Vec{130, 135},
SizeU{120U, 115U}),
std::make_tuple(gfx::OVERLAY_TRANSFORM_ROTATE_270,
Orientation::CCW_270_DEGREES,
Orientation::CCW_90_DEGREES,
ImageFlip::NONE,
Vec{130, 20},
Vec{10, 135},
SizeU{115U, 120U}),
std::make_tuple(gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL,
Orientation::CCW_0_DEGREES,
Expand Down

0 comments on commit 520f004

Please sign in to comment.