| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 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 | 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 CC_LAYERS_LAYER_H_ | 5 #ifndef CC_LAYERS_LAYER_H_ |
| 6 #define CC_LAYERS_LAYER_H_ | 6 #define CC_LAYERS_LAYER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 13 #include "cc/animation/layer_animation_controller.h" | 14 #include "cc/animation/layer_animation_controller.h" |
| 14 #include "cc/animation/layer_animation_value_observer.h" | 15 #include "cc/animation/layer_animation_value_observer.h" |
| 15 #include "cc/base/cc_export.h" | 16 #include "cc/base/cc_export.h" |
| 16 #include "cc/base/region.h" | 17 #include "cc/base/region.h" |
| 17 #include "cc/layers/draw_properties.h" | 18 #include "cc/layers/draw_properties.h" |
| 18 #include "cc/layers/layer_lists.h" | 19 #include "cc/layers/layer_lists.h" |
| 19 #include "cc/layers/layer_position_constraint.h" | 20 #include "cc/layers/layer_position_constraint.h" |
| 20 #include "cc/layers/paint_properties.h" | 21 #include "cc/layers/paint_properties.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 void AddChild(scoped_refptr<Layer> child); | 70 void AddChild(scoped_refptr<Layer> child); |
| 70 void InsertChild(scoped_refptr<Layer> child, size_t index); | 71 void InsertChild(scoped_refptr<Layer> child, size_t index); |
| 71 void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer); | 72 void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer); |
| 72 void RemoveFromParent(); | 73 void RemoveFromParent(); |
| 73 void RemoveAllChildren(); | 74 void RemoveAllChildren(); |
| 74 void SetChildren(const LayerList& children); | 75 void SetChildren(const LayerList& children); |
| 75 | 76 |
| 76 const LayerList& children() const { return children_; } | 77 const LayerList& children() const { return children_; } |
| 77 Layer* child_at(size_t index) { return children_[index].get(); } | 78 Layer* child_at(size_t index) { return children_[index].get(); } |
| 78 | 79 |
| 80 typedef base::Callback<void(scoped_ptr<SkBitmap>)> |
| 81 RequestCopyAsBitmapCallback; |
| 82 |
| 83 // This requests the layer and its subtree be rendered into an SkBitmap and |
| 84 // call the given callback when the SkBitmap has been produced. If the copy |
| 85 // is unable to be produced (the layer is destroyed first), then the callback |
| 86 // is called with a NULL bitmap. |
| 87 void RequestCopyAsBitmap(RequestCopyAsBitmapCallback callback); |
| 88 bool HasRequestCopyCallback() const { |
| 89 return !request_copy_callbacks_.empty(); |
| 90 } |
| 91 |
| 79 void SetAnchorPoint(gfx::PointF anchor_point); | 92 void SetAnchorPoint(gfx::PointF anchor_point); |
| 80 gfx::PointF anchor_point() const { return anchor_point_; } | 93 gfx::PointF anchor_point() const { return anchor_point_; } |
| 81 | 94 |
| 82 void SetAnchorPointZ(float anchor_point_z); | 95 void SetAnchorPointZ(float anchor_point_z); |
| 83 float anchor_point_z() const { return anchor_point_z_; } | 96 float anchor_point_z() const { return anchor_point_z_; } |
| 84 | 97 |
| 85 virtual void SetBackgroundColor(SkColor background_color); | 98 virtual void SetBackgroundColor(SkColor background_color); |
| 86 SkColor background_color() const { return background_color_; } | 99 SkColor background_color() const { return background_color_; } |
| 87 | 100 |
| 88 // A layer's bounds are in logical, non-page-scaled pixels (however, the | 101 // A layer's bounds are in logical, non-page-scaled pixels (however, the |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 // Replica layer used for reflections. | 486 // Replica layer used for reflections. |
| 474 scoped_refptr<Layer> replica_layer_; | 487 scoped_refptr<Layer> replica_layer_; |
| 475 | 488 |
| 476 // Transient properties. | 489 // Transient properties. |
| 477 float raster_scale_; | 490 float raster_scale_; |
| 478 bool automatically_compute_raster_scale_; | 491 bool automatically_compute_raster_scale_; |
| 479 bool bounds_contain_page_scale_; | 492 bool bounds_contain_page_scale_; |
| 480 | 493 |
| 481 gfx::Transform impl_transform_; | 494 gfx::Transform impl_transform_; |
| 482 | 495 |
| 496 std::vector<RequestCopyAsBitmapCallback> request_copy_callbacks_; |
| 497 |
| 483 WebKit::WebLayerScrollClient* layer_scroll_client_; | 498 WebKit::WebLayerScrollClient* layer_scroll_client_; |
| 484 | 499 |
| 485 DrawProperties<Layer, RenderSurface> draw_properties_; | 500 DrawProperties<Layer, RenderSurface> draw_properties_; |
| 486 | 501 |
| 487 PaintProperties paint_properties_; | 502 PaintProperties paint_properties_; |
| 488 | 503 |
| 489 DISALLOW_COPY_AND_ASSIGN(Layer); | 504 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 490 }; | 505 }; |
| 491 | 506 |
| 492 } // namespace cc | 507 } // namespace cc |
| 493 | 508 |
| 494 #endif // CC_LAYERS_LAYER_H_ | 509 #endif // CC_LAYERS_LAYER_H_ |
| OLD | NEW |