123730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
223730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)// found in the LICENSE file.
423730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#ifndef CC_OUTPUT_OVERLAY_CANDIDATE_H_
623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#define CC_OUTPUT_OVERLAY_CANDIDATE_H_
723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#include <vector>
923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
1023730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#include "base/basictypes.h"
1123730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#include "cc/base/cc_export.h"
1223730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#include "cc/resources/resource_format.h"
1323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#include "ui/gfx/geometry/rect.h"
14c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch#include "ui/gfx/overlay_transform.h"
15effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "ui/gfx/transform.h"
1623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
1723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)namespace cc {
1823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
19effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochclass CC_EXPORT OverlayCandidate {
20effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch public:
21c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  static gfx::OverlayTransform GetOverlayTransform(
22effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch      const gfx::Transform& quad_transform,
23effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch      bool flipped);
24effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  static gfx::Rect GetOverlayRect(const gfx::Transform& quad_transform,
25effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch                                  const gfx::Rect& rect);
26effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
2723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  OverlayCandidate();
2823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  ~OverlayCandidate();
2923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
3023730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  // Transformation to apply to layer during composition.
31c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  gfx::OverlayTransform transform;
3223730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  // Format of the buffer to composite.
3323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  ResourceFormat format;
3423730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  // Rect on the display to position the overlay to.
3523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  gfx::Rect display_rect;
3623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  // Crop within the buffer to be placed inside |display_rect|.
3723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  gfx::RectF uv_rect;
38effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Texture resource to present in an overlay.
39effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  unsigned resource_id;
40effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Stacking order of the overlay plane relative to the main surface,
41effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // which is 0. Signed to allow for "underlays".
42effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  int plane_z_order;
4323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
4423730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  // To be modified by the implementer if this candidate can go into
4523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  // an overlay.
4623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  bool overlay_handled;
4723730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)};
4823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
49effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochtypedef std::vector<OverlayCandidate> OverlayCandidateList;
50effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
5123730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)}  // namespace cc
5223730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
5323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#endif  // CC_OUTPUT_OVERLAY_CANDIDATE_H_
54