| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 // Width of the border in pixels, where the scaling is blended. | 501 // Width of the border in pixels, where the scaling is blended. |
| 497 int zoom_inset_; | 502 int zoom_inset_; |
| 498 | 503 |
| 499 // Shape of the window. | 504 // Shape of the window. |
| 500 std::unique_ptr<SkRegion> alpha_shape_; | 505 std::unique_ptr<SkRegion> alpha_shape_; |
| 501 | 506 |
| 502 std::string name_; | 507 std::string name_; |
| 503 | 508 |
| 504 LayerDelegate* delegate_; | 509 LayerDelegate* delegate_; |
| 505 | 510 |
| 511 base::ObserverList<LayerObserver> observer_list_; |
| 512 |
| 506 LayerOwner* owner_; | 513 LayerOwner* owner_; |
| 507 | 514 |
| 508 scoped_refptr<LayerAnimator> animator_; | 515 scoped_refptr<LayerAnimator> animator_; |
| 509 | 516 |
| 510 // Ownership of the layer is held through one of the strongly typed layer | 517 // Ownership of the layer is held through one of the strongly typed layer |
| 511 // pointers, depending on which sort of layer this is. | 518 // pointers, depending on which sort of layer this is. |
| 512 scoped_refptr<cc::Layer> content_layer_; | 519 scoped_refptr<cc::Layer> content_layer_; |
| 513 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; | 520 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; |
| 514 scoped_refptr<cc::TextureLayer> texture_layer_; | 521 scoped_refptr<cc::TextureLayer> texture_layer_; |
| 515 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; | 522 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 541 // The texture scale. | 548 // The texture scale. |
| 542 float texture_x_scale_; | 549 float texture_x_scale_; |
| 543 float texture_y_scale_; | 550 float texture_y_scale_; |
| 544 | 551 |
| 545 DISALLOW_COPY_AND_ASSIGN(Layer); | 552 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 546 }; | 553 }; |
| 547 | 554 |
| 548 } // namespace ui | 555 } // namespace ui |
| 549 | 556 |
| 550 #endif // UI_COMPOSITOR_LAYER_H_ | 557 #endif // UI_COMPOSITOR_LAYER_H_ |
| OLD | NEW |