// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module wl.mojom;
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/mojom/color_space.mojom";
import "ui/gfx/mojom/gpu_fence_handle.mojom";
import "ui/gfx/mojom/overlay_transform.mojom";
import "ui/gfx/mojom/overlay_priority_hint.mojom";
import "ui/gfx/mojom/rrect_f.mojom";
import "ui/gfx/mojom/transform.mojom";
import "skia/public/mojom/skcolor4f.mojom";
union TransformUnion {
gfx.mojom.OverlayTransform overlay_transform;
gfx.mojom.Transform matrix_transform;
};
// This is not a mirror of ui::OverlayPlane, it only contains things that are
// useful to ozone/wayland.
struct WaylandOverlayConfig {
// Specifies the stacking order of this overlay plane, relative to primary
// plane.
int32 z_order;
// Optional: specifies the color space data of the wayland config.
gfx.mojom.ColorSpace? color_space;
// Specifies how the buffer is to be transformed during composition.
TransformUnion transform;
// A unique id for the buffer, which is used to identify imported wl_buffers
// on the browser process.
uint32 buffer_id;
// Scale factor of the GPU side surface with respect to a display where the
// surface is located at.
float surface_scale_factor;
// Specifies where it is supposed to be on the display in physical pixels.
// This, after scaled by buffer_scale sets the destination rectangle of
// Wayland Viewport.
gfx.mojom.RectF bounds_rect;
// Specifies the region within the buffer to be placed inside |bounds_rect|.
// This sets the source rectangle of Wayland Viewport.
gfx.mojom.RectF crop_rect;
// Describes the changed region of the buffer. Optional to hint a partial
// swap.
gfx.mojom.Rect damage_region;
// Specifies if alpha blending, with premultiplied alpha should be applied at
// scanout.
bool enable_blend;
// Opacity of the overlay independent of buffer alpha.
// Valid values are [0.0, 1.0f].
float opacity;
// Specifies a GpuFenceHandle to be waited on before content of the buffer can
// be accessed by the display controller for overlay, or by the gpu for
// compositing.
gfx.mojom.GpuFenceHandle? access_fence_handle;
// Specifies priority of this overlay if delegated composition is supported
// and enabled.
gfx.mojom.OverlayPriorityHint priority_hint;
// Optional: specifies rounded clip bounds of the overlay if delegated
// composition is supported and enabled.
gfx.mojom.RRectF? rounded_clip_bounds;
// Optional: background color of this overlay plane.
skia.mojom.SkColor4f? background_color;
// Optional: clip rect for this overlay.
gfx.mojom.Rect? clip_rect;
};