chromium/components/viz/common/quads/offset_tag.h

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_VIZ_COMMON_QUADS_OFFSET_TAG_H_
#define COMPONENTS_VIZ_COMMON_QUADS_OFFSET_TAG_H_

#include <string>

#include "base/token.h"
#include "components/viz/common/surfaces/surface_range.h"
#include "components/viz/common/viz_common_export.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/vector2d_f.h"

namespace viz {
namespace mojom {
class OffsetTagDataView;
}

// OffsetTag is used to tag layer/quads that can be moved by the display
// compositor at draw time. The quads will be moved based on a corresponding
// OffsetTagValue provided by another viz client. The viz client that defines
// the OffsetTag will specify what surface provides the OffsetTagValue and
// OffsetTagConstraints to limit the position of quads.
class VIZ_COMMON_EXPORT OffsetTag {};

// Provides an offset value to translate tagged quads.
struct VIZ_COMMON_EXPORT OffsetTagValue {};

// Provides constraints on where the OffsetTagValue can move quads. The
// constraints must include the default 0,0 offset to be valid.
struct VIZ_COMMON_EXPORT OffsetTagConstraints {};

// Defines where to look for the value and constraints for an OffsetTag.
// `provider` will be resolved to a specific surface and the OffsetTagValue with
// matching `tag` will be used as the offset value. If no surface exists or the
// resolved surface has no matching OffsetTagValue then the default 0,0 offset
// will be used. If the offset value does not satisfy `constraints` then it will
// be clamped.
struct VIZ_COMMON_EXPORT OffsetTagDefinition {};

}  // namespace viz

#endif  // COMPONENTS_VIZ_COMMON_QUADS_OFFSET_TAG_H_