1 // Copyright 2014 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.
5 #ifndef UI_OZONE_PUBLIC_OVERLAY_CANDIDATES_OZONE_H_
6 #define UI_OZONE_PUBLIC_OVERLAY_CANDIDATES_OZONE_H_
10 #include "base/basictypes.h"
11 #include "ui/gfx/geometry/rect_f.h"
12 #include "ui/ozone/ozone_base_export.h"
13 #include "ui/ozone/public/surface_factory_ozone.h"
17 // This class can be used to answer questions about possible overlay
18 // configurations for a particular output device. We get an instance of this
19 // class from SurfaceFactoryOzone given an AcceleratedWidget.
20 class OZONE_BASE_EXPORT OverlayCandidatesOzone
{
22 struct OverlaySurfaceCandidate
{
23 OverlaySurfaceCandidate();
24 ~OverlaySurfaceCandidate();
26 // Transformation to apply to layer during composition.
27 gfx::OverlayTransform transform
= gfx::OVERLAY_TRANSFORM_NONE
;
28 // Format of the buffer to composite.
29 gfx::BufferFormat format
= gfx::BufferFormat::BGRA_8888
;
30 // Size of the buffer, in pixels.
31 gfx::Size buffer_size
;
32 // Rect on the display to position the overlay to. Input rectangle may
33 // not have integer coordinates, but when accepting for overlay, must
34 // be modified by CheckOverlaySupport to output integer values.
35 gfx::RectF display_rect
;
36 // Crop within the buffer to be placed inside |display_rect|.
38 // Quad geometry rect after applying the quad_transform().
39 gfx::Rect quad_rect_in_target_space
;
40 // Clip rect in the target content space after composition.
42 // If the quad is clipped after composition.
44 // Stacking order of the overlay plane relative to the main surface,
45 // which is 0. Signed to allow for "underlays".
46 int plane_z_order
= 0;
48 // To be modified by the implementer if this candidate can go into
50 bool overlay_handled
= false;
53 typedef std::vector
<OverlaySurfaceCandidate
> OverlaySurfaceCandidateList
;
55 // A list of possible overlay candidates is presented to this function.
56 // The expected result is that those candidates that can be in a separate
57 // plane are marked with |overlay_handled| set to true, otherwise they are
58 // to be traditionally composited. When setting |overlay_handled| to true,
59 // the implementation must also snap |display_rect| to integer coordinates
61 virtual void CheckOverlaySupport(OverlaySurfaceCandidateList
* surfaces
);
63 virtual ~OverlayCandidatesOzone();
68 #endif // UI_OZONE_PUBLIC_OVERLAY_CANDIDATES_OZONE_H_