wayland_display_util.cc 971 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/exo/wayland/wayland_display_util.h"
  5. #include "base/notreached.h"
  6. namespace exo {
  7. namespace wayland {
  8. wl_output_transform OutputTransform(display::Display::Rotation rotation) {
  9. // Note: |rotation| describes the counter clockwise rotation that a
  10. // display's output is currently adjusted for, which is the inverse
  11. // of what we need to return.
  12. switch (rotation) {
  13. case display::Display::ROTATE_0:
  14. return WL_OUTPUT_TRANSFORM_NORMAL;
  15. case display::Display::ROTATE_90:
  16. return WL_OUTPUT_TRANSFORM_270;
  17. case display::Display::ROTATE_180:
  18. return WL_OUTPUT_TRANSFORM_180;
  19. case display::Display::ROTATE_270:
  20. return WL_OUTPUT_TRANSFORM_90;
  21. }
  22. NOTREACHED();
  23. return WL_OUTPUT_TRANSFORM_NORMAL;
  24. }
  25. } // namespace wayland
  26. } // namespace exo