OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GFX_COMPOSITOR_LAYER_H_ | 5 #ifndef UI_GFX_COMPOSITOR_LAYER_H_ |
6 #define UI_GFX_COMPOSITOR_LAYER_H_ | 6 #define UI_GFX_COMPOSITOR_LAYER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContentLayerClient
.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContentLayerClient
.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayer.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayer.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerClient.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerClient.h" |
18 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
19 #include "ui/gfx/transform.h" | 19 #include "ui/gfx/transform.h" |
20 #include "ui/gfx/compositor/compositor.h" | 20 #include "ui/gfx/compositor/compositor.h" |
21 #include "ui/gfx/compositor/layer_animator_delegate.h" | 21 #include "ui/gfx/compositor/layer_animation_delegate.h" |
22 #include "ui/gfx/compositor/layer_delegate.h" | 22 #include "ui/gfx/compositor/layer_delegate.h" |
23 | 23 |
24 class SkCanvas; | 24 class SkCanvas; |
25 | 25 |
26 namespace ui { | 26 namespace ui { |
27 | 27 |
28 class Compositor; | 28 class Compositor; |
29 class LayerAnimator; | 29 class LayerAnimator; |
30 class LayerAnimationSequence; | 30 class LayerAnimationSequence; |
31 class Texture; | 31 class Texture; |
32 | 32 |
33 // Layer manages a texture, transform and a set of child Layers. Any View that | 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. | 34 // has enabled layers ends up creating a Layer to manage the texture. |
35 // A Layer can also be created without a texture, in which case it renders | 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. | 36 // nothing and is simply used as a node in a hierarchy of layers. |
37 // | 37 // |
38 // NOTE: unlike Views, each Layer does *not* own its children views. If you | 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 | 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. | 40 // NULL, but the children are not deleted. |
41 class COMPOSITOR_EXPORT Layer : | 41 class COMPOSITOR_EXPORT Layer : |
42 public LayerAnimatorDelegate, | 42 public LayerAnimationDelegate, |
43 NON_EXPORTED_BASE(public WebKit::WebLayerClient), | 43 NON_EXPORTED_BASE(public WebKit::WebLayerClient), |
44 NON_EXPORTED_BASE(public WebKit::WebContentLayerClient) { | 44 NON_EXPORTED_BASE(public WebKit::WebContentLayerClient) { |
45 public: | 45 public: |
46 enum LayerType { | 46 enum LayerType { |
47 LAYER_HAS_NO_TEXTURE = 0, | 47 LAYER_HAS_NO_TEXTURE = 0, |
48 LAYER_HAS_TEXTURE = 1 | 48 LAYER_HAS_TEXTURE = 1 |
49 }; | 49 }; |
50 | 50 |
51 // |compositor| can be NULL, and will be set later when the Layer is added to | 51 // |compositor| can be NULL, and will be set later when the Layer is added to |
52 // a Compositor. | 52 // a Compositor. |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 void SetOpacityImmediately(float opacity); | 274 void SetOpacityImmediately(float opacity); |
275 | 275 |
276 // Implementation of LayerAnimatorDelegate | 276 // Implementation of LayerAnimatorDelegate |
277 virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE; | 277 virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE; |
278 virtual void SetTransformFromAnimation(const Transform& transform) OVERRIDE; | 278 virtual void SetTransformFromAnimation(const Transform& transform) OVERRIDE; |
279 virtual void SetOpacityFromAnimation(float opacity) OVERRIDE; | 279 virtual void SetOpacityFromAnimation(float opacity) OVERRIDE; |
280 virtual void ScheduleDrawForAnimation() OVERRIDE; | 280 virtual void ScheduleDrawForAnimation() OVERRIDE; |
281 virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE; | 281 virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE; |
282 virtual const Transform& GetTransformForAnimation() const OVERRIDE; | 282 virtual const Transform& GetTransformForAnimation() const OVERRIDE; |
283 virtual float GetOpacityForAnimation() const OVERRIDE; | 283 virtual float GetOpacityForAnimation() const OVERRIDE; |
284 virtual void OnLayerAnimationEnded(LayerAnimationSequence* sequence) OVERRIDE; | |
285 | 284 |
286 #if defined(USE_WEBKIT_COMPOSITOR) | 285 #if defined(USE_WEBKIT_COMPOSITOR) |
287 void CreateWebLayer(); | 286 void CreateWebLayer(); |
288 void RecomputeTransform(); | 287 void RecomputeTransform(); |
289 void RecomputeDrawsContent(); | 288 void RecomputeDrawsContent(); |
290 #endif | 289 #endif |
291 | 290 |
292 const LayerType type_; | 291 const LayerType type_; |
293 | 292 |
294 Compositor* compositor_; | 293 Compositor* compositor_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 WebKit::WebLayer web_layer_; | 326 WebKit::WebLayer web_layer_; |
328 bool web_layer_is_accelerated_; | 327 bool web_layer_is_accelerated_; |
329 #endif | 328 #endif |
330 | 329 |
331 DISALLOW_COPY_AND_ASSIGN(Layer); | 330 DISALLOW_COPY_AND_ASSIGN(Layer); |
332 }; | 331 }; |
333 | 332 |
334 } // namespace ui | 333 } // namespace ui |
335 | 334 |
336 #endif // UI_GFX_COMPOSITOR_LAYER_H_ | 335 #endif // UI_GFX_COMPOSITOR_LAYER_H_ |
OLD | NEW |