[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 1 | // Copyright (c) 2011 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 UI_GFX_COMPOSITOR_LAYER_H_ |
| 6 | #define UI_GFX_COMPOSITOR_LAYER_H_ |
| 7 | #pragma once |
| 8 | |
[email protected] | 33699e62 | 2011-11-17 18:29:30 | [diff] [blame] | 9 | #include <string> |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 10 | #include <vector> |
| 11 | |
[email protected] | 7fca53d4 | 2011-09-29 15:38:12 | [diff] [blame] | 12 | #include "base/compiler_specific.h" |
[email protected] | 51f1b48 | 2011-06-23 16:52:12 | [diff] [blame] | 13 | #include "base/memory/ref_counted.h" |
[email protected] | 7fca53d4 | 2011-09-29 15:38:12 | [diff] [blame] | 14 | #include "base/memory/scoped_ptr.h" |
[email protected] | 00b8698 | 2011-09-01 00:02:09 | [diff] [blame] | 15 | #include "base/message_loop.h" |
[email protected] | 33274903 | 2011-10-22 00:32:46 | [diff] [blame] | 16 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebContentLayerClient.h" |
[email protected] | 4b58d55 | 2011-10-26 00:54:46 | [diff] [blame] | 17 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayer.h" |
[email protected] | 33274903 | 2011-10-22 00:32:46 | [diff] [blame] | 18 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerClient.h" |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 19 | #include "ui/gfx/rect.h" |
| 20 | #include "ui/gfx/transform.h" |
[email protected] | c155c25 | 2011-07-29 16:17:55 | [diff] [blame] | 21 | #include "ui/gfx/compositor/compositor.h" |
[email protected] | e876c27 | 2011-11-02 16:42:45 | [diff] [blame] | 22 | #include "ui/gfx/compositor/layer_animation_delegate.h" |
[email protected] | 00b8698 | 2011-09-01 00:02:09 | [diff] [blame] | 23 | #include "ui/gfx/compositor/layer_delegate.h" |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 24 | |
[email protected] | 892ad8a | 2011-07-27 02:47:22 | [diff] [blame] | 25 | class SkCanvas; |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 26 | |
| 27 | namespace ui { |
| 28 | |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 29 | class Compositor; |
[email protected] | fe7074c6 | 2011-10-28 15:22:54 | [diff] [blame] | 30 | class LayerAnimator; |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 31 | class Texture; |
| 32 | |
| 33 | // Layer manages a texture, transform and a set of child Layers. Any View that |
| 34 | // has enabled layers ends up creating a Layer to manage the texture. |
[email protected] | 28cd2bb | 2011-09-19 21:04:19 | [diff] [blame] | 35 | // A Layer can also be created without a texture, in which case it renders |
| 36 | // nothing and is simply used as a node in a hierarchy of layers. |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 37 | // |
| 38 | // NOTE: unlike Views, each Layer does *not* own its children views. If you |
| 39 | // delete a Layer and it has children, the parent of each child layer is set to |
| 40 | // NULL, but the children are not deleted. |
[email protected] | 33274903 | 2011-10-22 00:32:46 | [diff] [blame] | 41 | class COMPOSITOR_EXPORT Layer : |
[email protected] | e876c27 | 2011-11-02 16:42:45 | [diff] [blame] | 42 | public LayerAnimationDelegate, |
[email protected] | 33274903 | 2011-10-22 00:32:46 | [diff] [blame] | 43 | NON_EXPORTED_BASE(public WebKit::WebLayerClient), |
| 44 | NON_EXPORTED_BASE(public WebKit::WebContentLayerClient) { |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 45 | public: |
[email protected] | 993d6b32 | 2011-09-27 19:14:38 | [diff] [blame] | 46 | enum LayerType { |
[email protected] | 28cd2bb | 2011-09-19 21:04:19 | [diff] [blame] | 47 | LAYER_HAS_NO_TEXTURE = 0, |
| 48 | LAYER_HAS_TEXTURE = 1 |
| 49 | }; |
| 50 | |
[email protected] | 7ab3f27 | 2011-11-16 00:51:56 | [diff] [blame] | 51 | Layer(); |
| 52 | explicit Layer(LayerType type); |
[email protected] | 8f2a15d | 2011-09-29 15:50:59 | [diff] [blame] | 53 | virtual ~Layer(); |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 54 | |
[email protected] | 993d6b32 | 2011-09-27 19:14:38 | [diff] [blame] | 55 | // Retrieves the Layer's compositor. The Layer will walk up its parent chain |
| 56 | // to locate it. Returns NULL if the Layer is not attached to a compositor. |
| 57 | Compositor* GetCompositor(); |
| 58 | |
| 59 | // Called by the compositor when the Layer is set as its root Layer. This can |
| 60 | // only ever be called on the root layer. |
| 61 | void SetCompositor(Compositor* compositor); |
| 62 | |
[email protected] | 00b8698 | 2011-09-01 00:02:09 | [diff] [blame] | 63 | LayerDelegate* delegate() { return delegate_; } |
| 64 | void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } |
| 65 | |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 66 | // Adds a new Layer to this Layer. |
| 67 | void Add(Layer* child); |
| 68 | |
| 69 | // Removes a Layer from this Layer. |
| 70 | void Remove(Layer* child); |
| 71 | |
[email protected] | 5e4e61f | 2011-11-22 16:55:24 | [diff] [blame^] | 72 | // Stacks |child| above all other children. |
| 73 | void StackAtTop(Layer* child); |
[email protected] | 18dab37 | 2011-10-03 21:21:44 | [diff] [blame] | 74 | |
[email protected] | 5e4e61f | 2011-11-22 16:55:24 | [diff] [blame^] | 75 | // Stacks |child| above |other|, both of which must be children of this layer. |
| 76 | // Does nothing if |other| is already above |child|. |
| 77 | void StackAbove(Layer* child, Layer* other); |
[email protected] | 62dd7ea | 2011-11-08 15:51:47 | [diff] [blame] | 78 | |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 79 | // Returns the child Layers. |
[email protected] | 25ae9a1 | 2011-10-12 14:55:22 | [diff] [blame] | 80 | const std::vector<Layer*>& children() const { return children_; } |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 81 | |
| 82 | // The parent. |
| 83 | const Layer* parent() const { return parent_; } |
| 84 | Layer* parent() { return parent_; } |
| 85 | |
[email protected] | ad725891 | 2011-08-29 20:33:53 | [diff] [blame] | 86 | // Returns true if this Layer contains |other| somewhere in its children. |
| 87 | bool Contains(const Layer* other) const; |
| 88 | |
[email protected] | fe7074c6 | 2011-10-28 15:22:54 | [diff] [blame] | 89 | // The layer's animator is responsible for causing automatic animations when |
| 90 | // properties are set. It also manages a queue of pending animations and |
| 91 | // handles blending of animations. The layer takes ownership of the animator. |
| 92 | void SetAnimator(LayerAnimator* animator); |
| 93 | |
| 94 | // Returns the layer's animator. Creates a default animator of one has not |
| 95 | // been set. Will not return NULL. |
| 96 | LayerAnimator* GetAnimator(); |
[email protected] | 7fca53d4 | 2011-09-29 15:38:12 | [diff] [blame] | 97 | |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 98 | // The transform, relative to the parent. |
[email protected] | fe7074c6 | 2011-10-28 15:22:54 | [diff] [blame] | 99 | void SetTransform(const Transform& transform); |
| 100 | const Transform& transform() const { return transform_; } |
| 101 | |
| 102 | // Return the target transform if animator is running, or the current |
| 103 | // transform otherwise. |
| 104 | Transform GetTargetTransform() const; |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 105 | |
| 106 | // The bounds, relative to the parent. |
[email protected] | c155c25 | 2011-07-29 16:17:55 | [diff] [blame] | 107 | void SetBounds(const gfx::Rect& bounds); |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 108 | const gfx::Rect& bounds() const { return bounds_; } |
| 109 | |
[email protected] | 5ba9d5f | 2011-10-20 01:58:33 | [diff] [blame] | 110 | // Return the target bounds if animator is running, or the current bounds |
| 111 | // otherwise. |
| 112 | gfx::Rect GetTargetBounds() const; |
| 113 | |
[email protected] | 7fca53d4 | 2011-09-29 15:38:12 | [diff] [blame] | 114 | // The opacity of the layer. The opacity is applied to each pixel of the |
| 115 | // texture (resulting alpha = opacity * alpha). |
| 116 | float opacity() const { return opacity_; } |
| 117 | void SetOpacity(float opacity); |
| 118 | |
[email protected] | 3f1f5e6a | 2011-11-11 15:09:02 | [diff] [blame] | 119 | // Return the target opacity if animator is running, or the current opacity |
[email protected] | fe7074c6 | 2011-10-28 15:22:54 | [diff] [blame] | 120 | // otherwise. |
| 121 | float GetTargetOpacity() const; |
| 122 | |
[email protected] | e4e8afef | 2011-10-05 13:58:33 | [diff] [blame] | 123 | // Sets the visibility of the Layer. A Layer may be visible but not |
| 124 | // drawn. This happens if any ancestor of a Layer is not visible. |
[email protected] | 993d6b32 | 2011-09-27 19:14:38 | [diff] [blame] | 125 | void SetVisible(bool visible); |
[email protected] | f941f47a | 2011-10-15 18:44:51 | [diff] [blame] | 126 | bool visible() const { return visible_; } |
[email protected] | 3aa4394 | 2011-09-13 20:59:53 | [diff] [blame] | 127 | |
[email protected] | e4e8afef | 2011-10-05 13:58:33 | [diff] [blame] | 128 | // Returns true if this Layer is drawn. A Layer is drawn only if all ancestors |
| 129 | // are visible. |
| 130 | bool IsDrawn() const; |
| 131 | |
[email protected] | c1f6730 | 2011-09-27 14:18:09 | [diff] [blame] | 132 | // Returns true if this layer can have a texture (has_texture_ is true) |
| 133 | // and is not completely obscured by a child. |
[email protected] | 33274903 | 2011-10-22 00:32:46 | [diff] [blame] | 134 | bool ShouldDraw() const; |
[email protected] | c1f6730 | 2011-09-27 14:18:09 | [diff] [blame] | 135 | |
[email protected] | ad725891 | 2011-08-29 20:33:53 | [diff] [blame] | 136 | // Converts a point from the coordinates of |source| to the coordinates of |
| 137 | // |target|. Necessarily, |source| and |target| must inhabit the same Layer |
| 138 | // tree. |
| 139 | static void ConvertPointToLayer(const Layer* source, |
| 140 | const Layer* target, |
| 141 | gfx::Point* point); |
| 142 | |
[email protected] | c155c25 | 2011-07-29 16:17:55 | [diff] [blame] | 143 | // See description in View for details |
| 144 | void SetFillsBoundsOpaquely(bool fills_bounds_opaquely); |
| 145 | bool fills_bounds_opaquely() const { return fills_bounds_opaquely_; } |
| 146 | |
[email protected] | a50ff37 | 2011-11-03 16:06:28 | [diff] [blame] | 147 | // Returns the invalid rectangle. That is, the region of the layer that needs |
| 148 | // to be repainted. This is exposed for testing and isn't generally useful. |
| 149 | const gfx::Rect& invalid_rect() const { return invalid_rect_; } |
| 150 | |
[email protected] | c155c25 | 2011-07-29 16:17:55 | [diff] [blame] | 151 | const gfx::Rect& hole_rect() const { return hole_rect_; } |
| 152 | |
[email protected] | 33699e62 | 2011-11-17 18:29:30 | [diff] [blame] | 153 | const std::string& name() const { return name_; } |
| 154 | void set_name(const std::string& name) { name_ = name; } |
| 155 | |
[email protected] | 536987c8 | 2011-06-28 03:46:08 | [diff] [blame] | 156 | const ui::Texture* texture() const { return texture_.get(); } |
[email protected] | 1cbbee3c | 2011-06-24 12:32:19 | [diff] [blame] | 157 | |
[email protected] | 28cd2bb | 2011-09-19 21:04:19 | [diff] [blame] | 158 | // |texture| cannot be NULL, and this function cannot be called more than |
| 159 | // once. |
| 160 | // TODO(beng): This can be removed from the API when we are in a |
| 161 | // single-compositor world. |
| 162 | void SetExternalTexture(ui::Texture* texture); |
| 163 | |
[email protected] | 892ad8a | 2011-07-27 02:47:22 | [diff] [blame] | 164 | // Resets the canvas of the texture. |
| 165 | void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 166 | |
[email protected] | 870119a | 2011-09-30 18:13:22 | [diff] [blame] | 167 | // Adds |invalid_rect| to the Layer's pending invalid rect and calls |
| 168 | // ScheduleDraw(). |
[email protected] | 00b8698 | 2011-09-01 00:02:09 | [diff] [blame] | 169 | void SchedulePaint(const gfx::Rect& invalid_rect); |
| 170 | |
[email protected] | 870119a | 2011-09-30 18:13:22 | [diff] [blame] | 171 | // Schedules a redraw of the layer tree at the compositor. |
| 172 | void ScheduleDraw(); |
| 173 | |
[email protected] | 6b29ebb | 2011-09-29 17:41:20 | [diff] [blame] | 174 | // Does drawing for the layer. |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 175 | void Draw(); |
| 176 | |
[email protected] | 3aa4394 | 2011-09-13 20:59:53 | [diff] [blame] | 177 | // Draws a tree of Layers, by calling Draw() on each in the hierarchy starting |
| 178 | // with the receiver. |
| 179 | void DrawTree(); |
| 180 | |
[email protected] | a97527b | 2011-09-14 15:44:38 | [diff] [blame] | 181 | // Sometimes the Layer is being updated by something other than SetCanvas |
[email protected] | 396ecd5 | 2011-11-22 00:08:52 | [diff] [blame] | 182 | // (e.g. the GPU process on UI_COMPOSITOR_IMAGE_TRANSPORT). |
[email protected] | a97527b | 2011-09-14 15:44:38 | [diff] [blame] | 183 | bool layer_updated_externally() const { return layer_updated_externally_; } |
| 184 | |
[email protected] | 33274903 | 2011-10-22 00:32:46 | [diff] [blame] | 185 | // WebLayerClient |
| 186 | virtual void notifyNeedsComposite(); |
| 187 | |
| 188 | // WebContentLayerClient |
| 189 | virtual void paintContents(WebKit::WebCanvas*, const WebKit::WebRect& clip); |
| 190 | |
| 191 | #if defined(USE_WEBKIT_COMPOSITOR) |
[email protected] | 4b58d55 | 2011-10-26 00:54:46 | [diff] [blame] | 192 | WebKit::WebLayer web_layer() { return web_layer_; } |
[email protected] | 33274903 | 2011-10-22 00:32:46 | [diff] [blame] | 193 | #endif |
| 194 | |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 195 | private: |
[email protected] | 714e3843 | 2011-11-15 17:10:39 | [diff] [blame] | 196 | struct LayerProperties { |
| 197 | public: |
| 198 | ui::Layer* layer; |
| 199 | ui::Transform transform_relative_to_root; |
| 200 | }; |
| 201 | |
[email protected] | b4bb9ca | 2011-09-23 20:53:14 | [diff] [blame] | 202 | // TODO(vollick): Eventually, if a non-leaf node has an opacity of less than |
| 203 | // 1.0, we'll render to a separate texture, and then apply the alpha. |
| 204 | // Currently, we multiply our opacity by all our ancestor's opacities and |
| 205 | // use the combined result, but this is only temporary. |
| 206 | float GetCombinedOpacity() const; |
| 207 | |
[email protected] | 00b8698 | 2011-09-01 00:02:09 | [diff] [blame] | 208 | // Called during the Draw() pass to freshen the Layer's contents from the |
| 209 | // delegate. |
| 210 | void UpdateLayerCanvas(); |
| 211 | |
[email protected] | 714e3843 | 2011-11-15 17:10:39 | [diff] [blame] | 212 | // Called to indicate that a layer's properties have changed and that the |
| 213 | // holes for the layers must be recomputed. |
| 214 | void SetNeedsToRecomputeHole(); |
| 215 | |
| 216 | // Resets |hole_rect_| to the empty rect for all layers below and |
| 217 | // including this one. |
| 218 | void ClearHoleRects(); |
| 219 | |
| 220 | // Does a preorder traversal of layers starting with this layer. Omits layers |
| 221 | // which cannot punch a hole in another layer such as non visible layers |
| 222 | // and layers which don't fill their bounds opaquely. |
| 223 | void GetLayerProperties(const ui::Transform& current_transform, |
| 224 | std::vector<LayerProperties>* traverasal); |
| 225 | |
[email protected] | c155c25 | 2011-07-29 16:17:55 | [diff] [blame] | 226 | // A hole in a layer is an area in the layer that does not get drawn |
| 227 | // because this area is covered up with another layer which is known to be |
| 228 | // opaque. |
| 229 | // This method computes the dimension of the hole (if there is one) |
| 230 | // based on whether one of its child nodes is always opaque. |
[email protected] | 714e3843 | 2011-11-15 17:10:39 | [diff] [blame] | 231 | // Note: This method should only be called from the root. |
[email protected] | c155c25 | 2011-07-29 16:17:55 | [diff] [blame] | 232 | void RecomputeHole(); |
| 233 | |
[email protected] | 714e3843 | 2011-11-15 17:10:39 | [diff] [blame] | 234 | void set_hole_rect(const gfx::Rect& hole_rect) { |
| 235 | hole_rect_ = hole_rect; |
| 236 | } |
[email protected] | 6b29ebb | 2011-09-29 17:41:20 | [diff] [blame] | 237 | |
| 238 | // Determines the regions that don't intersect |rect| and places the |
| 239 | // result in |sides|. |
| 240 | // |
| 241 | // rect_____________________________ |
| 242 | // |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |
| 243 | // |xxxxxxxxxxxxx top xxxxxxxxxxxxxx| |
| 244 | // |________________________________| |
| 245 | // |xxxxx| |xxxxx| |
| 246 | // |xxxxx|region_to_punch_out |xxxxx| |
| 247 | // |left | |right| |
| 248 | // |_____|____________________|_____| |
| 249 | // |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| |
| 250 | // |xxxxxxxxxx bottom xxxxxxxxxxxxxx| |
| 251 | // |________________________________| |
| 252 | static void PunchHole(const gfx::Rect& rect, |
| 253 | const gfx::Rect& region_to_punch_out, |
| 254 | std::vector<gfx::Rect>* sides); |
| 255 | |
[email protected] | 714e3843 | 2011-11-15 17:10:39 | [diff] [blame] | 256 | // Drops texture just for this layer. |
| 257 | void DropTexture(); |
| 258 | |
[email protected] | 993d6b32 | 2011-09-27 19:14:38 | [diff] [blame] | 259 | // Drop all textures for layers below and including this one. Called when |
| 260 | // the layer is removed from a hierarchy. Textures will be re-generated if |
| 261 | // the layer is subsequently re-attached and needs to be drawn. |
| 262 | void DropTextures(); |
| 263 | |
[email protected] | ad725891 | 2011-08-29 20:33:53 | [diff] [blame] | 264 | bool ConvertPointForAncestor(const Layer* ancestor, gfx::Point* point) const; |
| 265 | bool ConvertPointFromAncestor(const Layer* ancestor, gfx::Point* point) const; |
| 266 | |
| 267 | bool GetTransformRelativeTo(const Layer* ancestor, |
| 268 | Transform* transform) const; |
| 269 | |
[email protected] | b4bb9ca | 2011-09-23 20:53:14 | [diff] [blame] | 270 | // The only externally updated layers are ones that get their pixels from |
| 271 | // WebKit and WebKit does not produce valid alpha values. All other layers |
| 272 | // should have valid alpha. |
| 273 | bool has_valid_alpha_channel() const { return !layer_updated_externally_; } |
| 274 | |
[email protected] | 7fca53d4 | 2011-09-29 15:38:12 | [diff] [blame] | 275 | // Following are invoked from the animation or if no animation exists to |
| 276 | // update the values immediately. |
| 277 | void SetBoundsImmediately(const gfx::Rect& bounds); |
| 278 | void SetTransformImmediately(const ui::Transform& transform); |
| 279 | void SetOpacityImmediately(float opacity); |
| 280 | |
[email protected] | fe7074c6 | 2011-10-28 15:22:54 | [diff] [blame] | 281 | // Implementation of LayerAnimatorDelegate |
| 282 | virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE; |
| 283 | virtual void SetTransformFromAnimation(const Transform& transform) OVERRIDE; |
| 284 | virtual void SetOpacityFromAnimation(float opacity) OVERRIDE; |
| 285 | virtual void ScheduleDrawForAnimation() OVERRIDE; |
| 286 | virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE; |
| 287 | virtual const Transform& GetTransformForAnimation() const OVERRIDE; |
| 288 | virtual float GetOpacityForAnimation() const OVERRIDE; |
[email protected] | 7fca53d4 | 2011-09-29 15:38:12 | [diff] [blame] | 289 | |
[email protected] | 33274903 | 2011-10-22 00:32:46 | [diff] [blame] | 290 | #if defined(USE_WEBKIT_COMPOSITOR) |
| 291 | void CreateWebLayer(); |
| 292 | void RecomputeTransform(); |
[email protected] | b9616d59 | 2011-11-14 20:04:42 | [diff] [blame] | 293 | void RecomputeDrawsContentAndUVRect(); |
[email protected] | 33274903 | 2011-10-22 00:32:46 | [diff] [blame] | 294 | #endif |
| 295 | |
[email protected] | 993d6b32 | 2011-09-27 19:14:38 | [diff] [blame] | 296 | const LayerType type_; |
| 297 | |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 298 | Compositor* compositor_; |
| 299 | |
[email protected] | 51f1b48 | 2011-06-23 16:52:12 | [diff] [blame] | 300 | scoped_refptr<ui::Texture> texture_; |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 301 | |
| 302 | Layer* parent_; |
| 303 | |
| 304 | std::vector<Layer*> children_; |
| 305 | |
| 306 | ui::Transform transform_; |
| 307 | |
| 308 | gfx::Rect bounds_; |
| 309 | |
[email protected] | e4e8afef | 2011-10-05 13:58:33 | [diff] [blame] | 310 | // Visibility of this layer. See SetVisible/IsDrawn for more details. |
[email protected] | 3aa4394 | 2011-09-13 20:59:53 | [diff] [blame] | 311 | bool visible_; |
| 312 | |
[email protected] | c155c25 | 2011-07-29 16:17:55 | [diff] [blame] | 313 | bool fills_bounds_opaquely_; |
| 314 | |
| 315 | gfx::Rect hole_rect_; |
| 316 | |
[email protected] | 714e3843 | 2011-11-15 17:10:39 | [diff] [blame] | 317 | bool recompute_hole_; |
| 318 | |
[email protected] | 00b8698 | 2011-09-01 00:02:09 | [diff] [blame] | 319 | gfx::Rect invalid_rect_; |
| 320 | |
[email protected] | a97527b | 2011-09-14 15:44:38 | [diff] [blame] | 321 | // If true the layer is always up to date. |
| 322 | bool layer_updated_externally_; |
| 323 | |
[email protected] | b4bb9ca | 2011-09-23 20:53:14 | [diff] [blame] | 324 | float opacity_; |
| 325 | |
[email protected] | 33699e62 | 2011-11-17 18:29:30 | [diff] [blame] | 326 | std::string name_; |
| 327 | |
[email protected] | 00b8698 | 2011-09-01 00:02:09 | [diff] [blame] | 328 | LayerDelegate* delegate_; |
| 329 | |
[email protected] | fe7074c6 | 2011-10-28 15:22:54 | [diff] [blame] | 330 | scoped_ptr<LayerAnimator> animator_; |
[email protected] | 7fca53d4 | 2011-09-29 15:38:12 | [diff] [blame] | 331 | |
[email protected] | 33274903 | 2011-10-22 00:32:46 | [diff] [blame] | 332 | #if defined(USE_WEBKIT_COMPOSITOR) |
[email protected] | 4b58d55 | 2011-10-26 00:54:46 | [diff] [blame] | 333 | WebKit::WebLayer web_layer_; |
| 334 | bool web_layer_is_accelerated_; |
[email protected] | 33274903 | 2011-10-22 00:32:46 | [diff] [blame] | 335 | #endif |
| 336 | |
[email protected] | adc93fa7 | 2011-06-21 19:47:39 | [diff] [blame] | 337 | DISALLOW_COPY_AND_ASSIGN(Layer); |
| 338 | }; |
| 339 | |
| 340 | } // namespace ui |
| 341 | |
| 342 | #endif // UI_GFX_COMPOSITOR_LAYER_H_ |