summaryrefslogtreecommitdiffstats
path: root/cc/output/overlay_candidate.h
blob: 28ae8cb73d35897979db66e61e3ac5bd720069a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_OUTPUT_OVERLAY_CANDIDATE_H_
#define CC_OUTPUT_OVERLAY_CANDIDATE_H_

#include <vector>

#include "cc/base/cc_export.h"
#include "cc/resources/resource_format.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/overlay_transform.h"
#include "ui/gfx/transform.h"

namespace cc {

class CC_EXPORT OverlayCandidate {
 public:
  static gfx::OverlayTransform GetOverlayTransform(
      const gfx::Transform& quad_transform,
      bool flipped);
  // Apply transform |delta| to |in| and return the resulting transform,
  // or OVERLAY_TRANSFORM_INVALID.
  static gfx::OverlayTransform ModifyTransform(gfx::OverlayTransform in,
                                               gfx::OverlayTransform delta);
  static gfx::Rect GetOverlayRect(const gfx::Transform& quad_transform,
                                  const gfx::Rect& rect);

  OverlayCandidate();
  ~OverlayCandidate();

  // Transformation to apply to layer during composition.
  gfx::OverlayTransform transform;
  // Format of the buffer to composite.
  ResourceFormat format;
  // Rect on the display to position the overlay to.
  gfx::Rect display_rect;
  // Crop within the buffer to be placed inside |display_rect|.
  gfx::RectF uv_rect;
  // Texture resource to present in an overlay.
  unsigned resource_id;
  // Stacking order of the overlay plane relative to the main surface,
  // which is 0. Signed to allow for "underlays".
  int plane_z_order;

  // To be modified by the implementer if this candidate can go into
  // an overlay.
  bool overlay_handled;
};

typedef std::vector<OverlayCandidate> OverlayCandidateList;

}  // namespace cc

#endif  // CC_OUTPUT_OVERLAY_CANDIDATE_H_