| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMPOSITOR_LAYER_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_H_ |
| 6 #define UI_COMPOSITOR_LAYER_H_ | 6 #define UI_COMPOSITOR_LAYER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 18 #include "base/observer_list.h" |
| 18 #include "cc/base/region.h" | 19 #include "cc/base/region.h" |
| 19 #include "cc/layers/content_layer_client.h" | 20 #include "cc/layers/content_layer_client.h" |
| 20 #include "cc/layers/layer_client.h" | 21 #include "cc/layers/layer_client.h" |
| 21 #include "cc/layers/surface_layer.h" | 22 #include "cc/layers/surface_layer.h" |
| 22 #include "cc/layers/texture_layer_client.h" | 23 #include "cc/layers/texture_layer_client.h" |
| 23 #include "cc/resources/texture_mailbox.h" | 24 #include "cc/resources/texture_mailbox.h" |
| 24 #include "cc/surfaces/surface_id.h" | 25 #include "cc/surfaces/surface_id.h" |
| 25 #include "third_party/skia/include/core/SkColor.h" | 26 #include "third_party/skia/include/core/SkColor.h" |
| 26 #include "third_party/skia/include/core/SkRegion.h" | 27 #include "third_party/skia/include/core/SkRegion.h" |
| 27 #include "ui/compositor/compositor.h" | 28 #include "ui/compositor/compositor.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 44 class SurfaceLayer; | 45 class SurfaceLayer; |
| 45 class TextureLayer; | 46 class TextureLayer; |
| 46 struct ReturnedResource; | 47 struct ReturnedResource; |
| 47 typedef std::vector<ReturnedResource> ReturnedResourceArray; | 48 typedef std::vector<ReturnedResource> ReturnedResourceArray; |
| 48 } | 49 } |
| 49 | 50 |
| 50 namespace ui { | 51 namespace ui { |
| 51 | 52 |
| 52 class Compositor; | 53 class Compositor; |
| 53 class LayerAnimator; | 54 class LayerAnimator; |
| 55 class LayerObserver; |
| 54 class LayerOwner; | 56 class LayerOwner; |
| 55 class LayerThreadedAnimationDelegate; | 57 class LayerThreadedAnimationDelegate; |
| 56 | 58 |
| 57 // Layer manages a texture, transform and a set of child Layers. Any View that | 59 // Layer manages a texture, transform and a set of child Layers. Any View that |
| 58 // has enabled layers ends up creating a Layer to manage the texture. | 60 // has enabled layers ends up creating a Layer to manage the texture. |
| 59 // A Layer can also be created without a texture, in which case it renders | 61 // A Layer can also be created without a texture, in which case it renders |
| 60 // nothing and is simply used as a node in a hierarchy of layers. | 62 // nothing and is simply used as a node in a hierarchy of layers. |
| 61 // Coordinate system used in layers is DIP (Density Independent Pixel) | 63 // Coordinate system used in layers is DIP (Density Independent Pixel) |
| 62 // coordinates unless explicitly mentioned as pixel coordinates. | 64 // coordinates unless explicitly mentioned as pixel coordinates. |
| 63 // | 65 // |
| (...skipping 22 matching lines...) Expand all Loading... |
| 86 // only ever be called on the root layer. | 88 // only ever be called on the root layer. |
| 87 void SetCompositor(Compositor* compositor, | 89 void SetCompositor(Compositor* compositor, |
| 88 scoped_refptr<cc::Layer> root_layer); | 90 scoped_refptr<cc::Layer> root_layer); |
| 89 void ResetCompositor(); | 91 void ResetCompositor(); |
| 90 | 92 |
| 91 LayerDelegate* delegate() { return delegate_; } | 93 LayerDelegate* delegate() { return delegate_; } |
| 92 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } | 94 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } |
| 93 | 95 |
| 94 LayerOwner* owner() { return owner_; } | 96 LayerOwner* owner() { return owner_; } |
| 95 | 97 |
| 98 void AddObserver(LayerObserver* observer); |
| 99 void RemoveObserver(LayerObserver* observer); |
| 100 |
| 96 // Adds a new Layer to this Layer. | 101 // Adds a new Layer to this Layer. |
| 97 void Add(Layer* child); | 102 void Add(Layer* child); |
| 98 | 103 |
| 99 // Removes a Layer from this Layer. | 104 // Removes a Layer from this Layer. |
| 100 void Remove(Layer* child); | 105 void Remove(Layer* child); |
| 101 | 106 |
| 102 // Stacks |child| above all other children. | 107 // Stacks |child| above all other children. |
| 103 void StackAtTop(Layer* child); | 108 void StackAtTop(Layer* child); |
| 104 | 109 |
| 105 // Stacks |child| directly above |other|. Both must be children of this | 110 // Stacks |child| directly above |other|. Both must be children of this |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 // Width of the border in pixels, where the scaling is blended. | 500 // Width of the border in pixels, where the scaling is blended. |
| 496 int zoom_inset_; | 501 int zoom_inset_; |
| 497 | 502 |
| 498 // Shape of the window. | 503 // Shape of the window. |
| 499 std::unique_ptr<SkRegion> alpha_shape_; | 504 std::unique_ptr<SkRegion> alpha_shape_; |
| 500 | 505 |
| 501 std::string name_; | 506 std::string name_; |
| 502 | 507 |
| 503 LayerDelegate* delegate_; | 508 LayerDelegate* delegate_; |
| 504 | 509 |
| 510 base::ObserverList<LayerObserver> observer_list_; |
| 511 |
| 505 LayerOwner* owner_; | 512 LayerOwner* owner_; |
| 506 | 513 |
| 507 scoped_refptr<LayerAnimator> animator_; | 514 scoped_refptr<LayerAnimator> animator_; |
| 508 | 515 |
| 509 // Ownership of the layer is held through one of the strongly typed layer | 516 // Ownership of the layer is held through one of the strongly typed layer |
| 510 // pointers, depending on which sort of layer this is. | 517 // pointers, depending on which sort of layer this is. |
| 511 scoped_refptr<cc::Layer> content_layer_; | 518 scoped_refptr<cc::Layer> content_layer_; |
| 512 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; | 519 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; |
| 513 scoped_refptr<cc::TextureLayer> texture_layer_; | 520 scoped_refptr<cc::TextureLayer> texture_layer_; |
| 514 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; | 521 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 540 // The texture scale. | 547 // The texture scale. |
| 541 float texture_x_scale_; | 548 float texture_x_scale_; |
| 542 float texture_y_scale_; | 549 float texture_y_scale_; |
| 543 | 550 |
| 544 DISALLOW_COPY_AND_ASSIGN(Layer); | 551 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 545 }; | 552 }; |
| 546 | 553 |
| 547 } // namespace ui | 554 } // namespace ui |
| 548 | 555 |
| 549 #endif // UI_COMPOSITOR_LAYER_H_ | 556 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |