overlay_plane_data.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // Copyright 2021 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. #ifndef UI_GFX_OVERLAY_PLANE_DATA_H_
  5. #define UI_GFX_OVERLAY_PLANE_DATA_H_
  6. #include "third_party/abseil-cpp/absl/types/optional.h"
  7. #include "third_party/skia/include/core/SkColor.h"
  8. #include "ui/gfx/color_space.h"
  9. #include "ui/gfx/geometry/rect.h"
  10. #include "ui/gfx/geometry/rect_f.h"
  11. #include "ui/gfx/geometry/rrect_f.h"
  12. #include "ui/gfx/gfx_export.h"
  13. #include "ui/gfx/hdr_metadata.h"
  14. #include "ui/gfx/overlay_priority_hint.h"
  15. #include "ui/gfx/overlay_transform.h"
  16. namespace gfx {
  17. struct GFX_EXPORT OverlayPlaneData {
  18. OverlayPlaneData();
  19. OverlayPlaneData(int z_order,
  20. OverlayTransform plane_transform,
  21. const RectF& display_bounds,
  22. const RectF& crop_rect,
  23. bool enable_blend,
  24. const Rect& damage_rect,
  25. float opacity,
  26. OverlayPriorityHint priority_hint,
  27. const gfx::RRectF& rounded_corners,
  28. const gfx::ColorSpace& color_space,
  29. const absl::optional<HDRMetadata>& hdr_metadata,
  30. absl::optional<SkColor4f> color = absl::nullopt,
  31. bool is_solid_color = false);
  32. ~OverlayPlaneData();
  33. OverlayPlaneData(const OverlayPlaneData& other);
  34. // Specifies the stacking order of the plane relative to the main framebuffer
  35. // located at index 0.
  36. int z_order = 0;
  37. // Specifies how the buffer is to be transformed during composition.
  38. OverlayTransform plane_transform = OverlayTransform::OVERLAY_TRANSFORM_NONE;
  39. // Bounds within the display to position the image in pixel coordinates. They
  40. // are sent as floating point rect as some backends such as Wayland are able
  41. // to do delegated compositing with sub-pixel accurate positioning.
  42. RectF display_bounds;
  43. // Normalized bounds of the image to be displayed in |display_bounds|.
  44. RectF crop_rect = RectF(1.f, 1.f);
  45. // Whether alpha blending should be enabled.
  46. bool enable_blend = false;
  47. // Damage on the buffer.
  48. Rect damage_rect;
  49. // Opacity of overlay plane. For a blending buffer (|enable_blend|) the total
  50. // transparency will by = channel alpha * |opacity|.
  51. float opacity = 1.0f;
  52. // Hints for overlay prioritization when delegated composition is used.
  53. OverlayPriorityHint priority_hint = OverlayPriorityHint::kNone;
  54. // Specifies the rounded corners of overlay plane.
  55. RRectF rounded_corners;
  56. // ColorSpace for this overlay.
  57. gfx::ColorSpace color_space;
  58. // Optional HDR meta data required to display this overlay.
  59. absl::optional<HDRMetadata> hdr_metadata;
  60. // Represents either a background of this overlay or a color of a solid color
  61. // quad, which can be checked via the |is_solid_color|.
  62. absl::optional<SkColor4f> color;
  63. // Set if this is a solid color quad.
  64. bool is_solid_color;
  65. };
  66. } // namespace gfx
  67. #endif // UI_GFX_OVERLAY_PLANE_DATA_H_