[Do not revert] Roll-back V8 to version 4.4.63.
[chromium-blink-merge.git] / cc / layers / render_surface.h
blob1e3719d023ba5f596f1bd83b1b027e50eb031494
1 // Copyright 2010 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.
6 #ifndef CC_LAYERS_RENDER_SURFACE_H_
7 #define CC_LAYERS_RENDER_SURFACE_H_
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "cc/base/cc_export.h"
14 #include "cc/layers/layer_lists.h"
15 #include "ui/gfx/geometry/rect.h"
16 #include "ui/gfx/geometry/rect_f.h"
17 #include "ui/gfx/transform.h"
19 namespace cc {
21 class Layer;
22 template <typename LayerType>
23 class LayerIterator;
25 class CC_EXPORT RenderSurface {
26 public:
27 explicit RenderSurface(Layer* owning_layer);
28 ~RenderSurface();
30 // Returns the rect that encloses the RenderSurfaceImpl including any
31 // reflection.
32 gfx::RectF DrawableContentRect() const;
34 void SetContentRect(const gfx::Rect& content_rect) {
35 content_rect_ = content_rect;
37 gfx::Rect content_rect() const { return content_rect_; }
39 void SetDrawOpacity(float opacity) { draw_opacity_ = opacity; }
40 float draw_opacity() const { return draw_opacity_; }
42 void SetDrawOpacityIsAnimating(bool draw_opacity_is_animating) {
43 draw_opacity_is_animating_ = draw_opacity_is_animating;
45 bool draw_opacity_is_animating() const { return draw_opacity_is_animating_; }
47 void SetDrawTransform(const gfx::Transform& draw_transform) {
48 draw_transform_ = draw_transform;
50 const gfx::Transform& draw_transform() const { return draw_transform_; }
52 void SetScreenSpaceTransform(const gfx::Transform& screen_space_transform) {
53 screen_space_transform_ = screen_space_transform;
55 const gfx::Transform& screen_space_transform() const {
56 return screen_space_transform_;
59 void SetReplicaDrawTransform(const gfx::Transform& replica_draw_transform) {
60 replica_draw_transform_ = replica_draw_transform;
62 const gfx::Transform& replica_draw_transform() const {
63 return replica_draw_transform_;
66 void SetReplicaScreenSpaceTransform(
67 const gfx::Transform& replica_screen_space_transform) {
68 replica_screen_space_transform_ = replica_screen_space_transform;
70 const gfx::Transform& replica_screen_space_transform() const {
71 return replica_screen_space_transform_;
74 void SetTargetSurfaceTransformsAreAnimating(bool animating) {
75 target_surface_transforms_are_animating_ = animating;
77 bool target_surface_transforms_are_animating() const {
78 return target_surface_transforms_are_animating_;
80 void SetScreenSpaceTransformsAreAnimating(bool animating) {
81 screen_space_transforms_are_animating_ = animating;
83 bool screen_space_transforms_are_animating() const {
84 return screen_space_transforms_are_animating_;
87 bool is_clipped() const { return is_clipped_; }
88 void SetIsClipped(bool is_clipped) { is_clipped_ = is_clipped; }
90 gfx::Rect clip_rect() const { return clip_rect_; }
91 void SetClipRect(const gfx::Rect& clip_rect) { clip_rect_ = clip_rect; }
93 // When false, the RenderSurface does not contribute to another target
94 // RenderSurface that is being drawn for the current frame. It could still be
95 // drawn to as a target, but its output will not be a part of any other
96 // surface.
97 bool contributes_to_drawn_surface() const {
98 return contributes_to_drawn_surface_;
100 void set_contributes_to_drawn_surface(bool contributes_to_drawn_surface) {
101 contributes_to_drawn_surface_ = contributes_to_drawn_surface;
104 LayerList& layer_list() { return layer_list_; }
105 // A no-op since DelegatedRendererLayers on the main thread don't have any
106 // RenderPasses so they can't contribute to a surface.
107 void AddContributingDelegatedRenderPassLayer(Layer* layer) {}
109 void SetNearestOcclusionImmuneAncestor(RenderSurface* surface) {
110 nearest_occlusion_immune_ancestor_ = surface;
112 const RenderSurface* nearest_occlusion_immune_ancestor() const {
113 return nearest_occlusion_immune_ancestor_;
116 void ClearLayerLists();
118 private:
119 friend class LayerIterator<Layer>;
121 Layer* owning_layer_;
123 // Uses this surface's space.
124 gfx::Rect content_rect_;
126 float draw_opacity_;
127 bool draw_opacity_is_animating_;
128 gfx::Transform draw_transform_;
129 gfx::Transform screen_space_transform_;
130 gfx::Transform replica_draw_transform_;
131 gfx::Transform replica_screen_space_transform_;
132 bool target_surface_transforms_are_animating_;
133 bool screen_space_transforms_are_animating_;
135 bool is_clipped_;
136 bool contributes_to_drawn_surface_;
138 // Uses the space of the surface's target surface.
139 gfx::Rect clip_rect_;
141 LayerList layer_list_;
143 // The nearest ancestor target surface that will contain the contents of this
144 // surface, and that ignores outside occlusion. This can point to itself.
145 RenderSurface* nearest_occlusion_immune_ancestor_;
147 // For LayerIteratorActions
148 int target_render_surface_layer_index_history_;
149 int current_layer_index_history_;
151 DISALLOW_COPY_AND_ASSIGN(RenderSurface);
154 } // namespace cc
155 #endif // CC_LAYERS_RENDER_SURFACE_H_