Reland "Non-SFI mode: Switch to newlib. (patchset #4 id:60001 of https://codereview...
[chromium-blink-merge.git] / cc / layers / render_surface.h
blob32276b6c408f783d6ac0bffcc0b620947b8ef9d8
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;
23 class CC_EXPORT RenderSurface {
24 public:
25 explicit RenderSurface(Layer* owning_layer);
26 ~RenderSurface();
28 // Returns the rect that encloses the RenderSurfaceImpl including any
29 // reflection.
30 gfx::RectF DrawableContentRect() const;
32 void SetContentRect(const gfx::Rect& content_rect) {
33 content_rect_ = content_rect;
35 gfx::Rect content_rect() const { return content_rect_; }
37 void SetDrawOpacity(float opacity) { draw_opacity_ = opacity; }
38 float draw_opacity() const { return draw_opacity_; }
40 void SetDrawOpacityIsAnimating(bool draw_opacity_is_animating) {
41 draw_opacity_is_animating_ = draw_opacity_is_animating;
43 bool draw_opacity_is_animating() const { return draw_opacity_is_animating_; }
45 void SetDrawTransform(const gfx::Transform& draw_transform) {
46 draw_transform_ = draw_transform;
48 const gfx::Transform& draw_transform() const { return draw_transform_; }
50 void SetScreenSpaceTransform(const gfx::Transform& screen_space_transform) {
51 screen_space_transform_ = screen_space_transform;
53 const gfx::Transform& screen_space_transform() const {
54 return screen_space_transform_;
57 void SetReplicaDrawTransform(const gfx::Transform& replica_draw_transform) {
58 replica_draw_transform_ = replica_draw_transform;
60 const gfx::Transform& replica_draw_transform() const {
61 return replica_draw_transform_;
64 void SetReplicaScreenSpaceTransform(
65 const gfx::Transform& replica_screen_space_transform) {
66 replica_screen_space_transform_ = replica_screen_space_transform;
68 const gfx::Transform& replica_screen_space_transform() const {
69 return replica_screen_space_transform_;
72 void SetTargetSurfaceTransformsAreAnimating(bool animating) {
73 target_surface_transforms_are_animating_ = animating;
75 bool target_surface_transforms_are_animating() const {
76 return target_surface_transforms_are_animating_;
78 void SetScreenSpaceTransformsAreAnimating(bool animating) {
79 screen_space_transforms_are_animating_ = animating;
81 bool screen_space_transforms_are_animating() const {
82 return screen_space_transforms_are_animating_;
85 bool is_clipped() const { return is_clipped_; }
86 void SetIsClipped(bool is_clipped) { is_clipped_ = is_clipped; }
88 gfx::Rect clip_rect() const { return clip_rect_; }
89 void SetClipRect(const gfx::Rect& clip_rect) { clip_rect_ = clip_rect; }
91 // When false, the RenderSurface does not contribute to another target
92 // RenderSurface that is being drawn for the current frame. It could still be
93 // drawn to as a target, but its output will not be a part of any other
94 // surface.
95 bool contributes_to_drawn_surface() const {
96 return contributes_to_drawn_surface_;
98 void set_contributes_to_drawn_surface(bool contributes_to_drawn_surface) {
99 contributes_to_drawn_surface_ = contributes_to_drawn_surface;
102 LayerList& layer_list() { return layer_list_; }
103 // A no-op since DelegatedRendererLayers on the main thread don't have any
104 // RenderPasses so they can't contribute to a surface.
105 void AddContributingDelegatedRenderPassLayer(Layer* layer) {}
107 void SetNearestOcclusionImmuneAncestor(RenderSurface* surface) {
108 nearest_occlusion_immune_ancestor_ = surface;
110 const RenderSurface* nearest_occlusion_immune_ancestor() const {
111 return nearest_occlusion_immune_ancestor_;
114 void ClearLayerLists();
116 private:
117 Layer* owning_layer_;
119 // Uses this surface's space.
120 gfx::Rect content_rect_;
122 float draw_opacity_;
123 bool draw_opacity_is_animating_;
124 gfx::Transform draw_transform_;
125 gfx::Transform screen_space_transform_;
126 gfx::Transform replica_draw_transform_;
127 gfx::Transform replica_screen_space_transform_;
128 bool target_surface_transforms_are_animating_;
129 bool screen_space_transforms_are_animating_;
131 bool is_clipped_;
132 bool contributes_to_drawn_surface_;
134 // Uses the space of the surface's target surface.
135 gfx::Rect clip_rect_;
137 LayerList layer_list_;
139 // The nearest ancestor target surface that will contain the contents of this
140 // surface, and that ignores outside occlusion. This can point to itself.
141 RenderSurface* nearest_occlusion_immune_ancestor_;
143 // For LayerIteratorActions
144 int target_render_surface_layer_index_history_;
145 size_t current_layer_index_history_;
147 DISALLOW_COPY_AND_ASSIGN(RenderSurface);
150 } // namespace cc
151 #endif // CC_LAYERS_RENDER_SURFACE_H_