Upstream version 6.35.121.0
[platform/framework/web/crosswalk.git] / src / cc / output / overlay_candidate.h
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.
4
5 #ifndef CC_OUTPUT_OVERLAY_CANDIDATE_H_
6 #define CC_OUTPUT_OVERLAY_CANDIDATE_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/resources/resource_format.h"
13 #include "ui/gfx/geometry/rect.h"
14 #include "ui/gfx/transform.h"
15
16 namespace cc {
17
18 class CC_EXPORT OverlayCandidate {
19  public:
20   enum OverlayTransform {
21     INVALID,
22     NONE,
23     FLIP_HORIZONTAL,
24     FLIP_VERTICAL,
25     ROTATE_90,
26     ROTATE_180,
27     ROTATE_270,
28   };
29
30   static OverlayTransform GetOverlayTransform(
31       const gfx::Transform& quad_transform,
32       bool flipped);
33   static gfx::Rect GetOverlayRect(const gfx::Transform& quad_transform,
34                                   const gfx::Rect& rect);
35
36   OverlayCandidate();
37   ~OverlayCandidate();
38
39   // Transformation to apply to layer during composition.
40   OverlayTransform transform;
41   // Format of the buffer to composite.
42   ResourceFormat format;
43   // Rect on the display to position the overlay to.
44   gfx::Rect display_rect;
45   // Crop within the buffer to be placed inside |display_rect|.
46   gfx::RectF uv_rect;
47   // Texture resource to present in an overlay.
48   unsigned resource_id;
49   // Stacking order of the overlay plane relative to the main surface,
50   // which is 0. Signed to allow for "underlays".
51   int plane_z_order;
52
53   // To be modified by the implementer if this candidate can go into
54   // an overlay.
55   bool overlay_handled;
56 };
57
58 typedef std::vector<OverlayCandidate> OverlayCandidateList;
59
60 }  // namespace cc
61
62 #endif  // CC_OUTPUT_OVERLAY_CANDIDATE_H_