#ifndef UI_OZONE_PLATFORM_WAYLAND_COMMON_WAYLAND_UTIL_H_
#define UI_OZONE_PLATFORM_WAYLAND_COMMON_WAYLAND_UTIL_H_
#include <vector>
#include "base/containers/flat_map.h"
#include "base/files/scoped_file.h"
#include "base/functional/callback.h"
#include "base/functional/callback_forward.h"
#include "base/time/time.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/events/platform_event.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/transform.h"
#include "ui/gfx/overlay_transform.h"
#include "ui/ozone/platform/wayland/common/wayland_object.h"
#include "ui/platform_window/platform_window_init_properties.h"
class SkBitmap;
class SkPath;
namespace ui {
class WaylandShmBuffer;
class WaylandWindow;
}
namespace gfx {
enum class BufferFormat : uint8_t;
class Size;
}
namespace wl {
RequestSizeCallback;
OnRequestBufferCallback;
BufferFormatsWithModifiersMap;
enum class EventDispatchPolicy { … };
uint32_t IdentifyDirection(int hittest);
bool DrawBitmap(const SkBitmap& bitmap, ui::WaylandShmBuffer* out_buffer);
void ReadDataFromFD(base::ScopedFD fd, std::vector<uint8_t>* contents);
gfx::Rect TranslateBoundsToParentCoordinates(const gfx::Rect& child_bounds,
const gfx::Rect& parent_bounds);
gfx::RectF TranslateBoundsToParentCoordinatesF(const gfx::RectF& child_bounds,
const gfx::RectF& parent_bounds);
gfx::Rect TranslateBoundsToTopLevelCoordinates(const gfx::Rect& child_bounds,
const gfx::Rect& parent_bounds);
wl_output_transform ToWaylandTransform(gfx::OverlayTransform transform);
gfx::Rect ApplyWaylandTransform(const gfx::Rect& rect,
const gfx::Size& bounds,
wl_output_transform transform);
gfx::RectF ApplyWaylandTransform(const gfx::RectF& rect,
const gfx::SizeF& bounds,
wl_output_transform transform);
gfx::SizeF ApplyWaylandTransform(const gfx::SizeF& size,
wl_output_transform transform);
ui::WaylandWindow* RootWindowFromWlSurface(wl_surface* surface);
gfx::Rect TranslateWindowBoundsToParentDIP(ui::WaylandWindow* window,
ui::WaylandWindow* parent_window);
std::vector<gfx::Rect> CreateRectsFromSkPath(const SkPath& path);
SkPath ConvertPathToDIP(const SkPath& path_in_pixels, float scale);
void SkColorToWlArray(const SkColor& color, wl_array& array);
void SkColorToWlArray(const SkColor4f& color, wl_array& array);
void TransformToWlArray(
const absl::variant<gfx::OverlayTransform, gfx::Transform>& transform,
wl_array& array);
base::TimeTicks EventMillisecondsToTimeTicks(uint32_t milliseconds);
float ClampScale(float scale);
bool MaybeHandlePlatformEventForDrag(const ui::PlatformEvent& event,
bool start_drag_ack_received,
base::OnceClosure cancel_drag_cb);
}
#endif