layer.h revision 0529e5d033099cbfc42635f6f6183833b09dff6e
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 3// found in the LICENSE file. 4 5#ifndef CC_LAYERS_LAYER_H_ 6#define CC_LAYERS_LAYER_H_ 7 8#include <set> 9#include <string> 10 11#include "base/callback.h" 12#include "base/memory/ref_counted.h" 13#include "base/observer_list.h" 14#include "cc/animation/layer_animation_controller.h" 15#include "cc/animation/layer_animation_value_observer.h" 16#include "cc/animation/layer_animation_value_provider.h" 17#include "cc/base/cc_export.h" 18#include "cc/base/region.h" 19#include "cc/base/scoped_ptr_vector.h" 20#include "cc/debug/micro_benchmark.h" 21#include "cc/layers/draw_properties.h" 22#include "cc/layers/layer_lists.h" 23#include "cc/layers/layer_position_constraint.h" 24#include "cc/layers/paint_properties.h" 25#include "cc/layers/render_surface.h" 26#include "cc/output/filter_operations.h" 27#include "skia/ext/refptr.h" 28#include "third_party/skia/include/core/SkColor.h" 29#include "third_party/skia/include/core/SkImageFilter.h" 30#include "third_party/skia/include/core/SkPicture.h" 31#include "third_party/skia/include/core/SkXfermode.h" 32#include "ui/gfx/rect.h" 33#include "ui/gfx/rect_f.h" 34#include "ui/gfx/transform.h" 35 36namespace gfx { 37class BoxF; 38} 39 40namespace base { 41namespace debug { 42class ConvertableToTraceFormat; 43} 44} 45 46namespace cc { 47 48class Animation; 49class AnimationDelegate; 50struct AnimationEvent; 51class CopyOutputRequest; 52class LayerAnimationDelegate; 53class LayerAnimationEventObserver; 54class LayerClient; 55class LayerImpl; 56class LayerTreeHost; 57class LayerTreeImpl; 58class PriorityCalculator; 59class RenderingStatsInstrumentation; 60class ResourceUpdateQueue; 61class ScrollbarLayerInterface; 62struct AnimationEvent; 63template <typename LayerType> 64class OcclusionTracker; 65 66// Base class for composited layers. Special layer types are derived from 67// this class. 68class CC_EXPORT Layer : public base::RefCounted<Layer>, 69 public LayerAnimationValueObserver, 70 public LayerAnimationValueProvider { 71 public: 72 typedef RenderSurfaceLayerList RenderSurfaceListType; 73 typedef LayerList LayerListType; 74 typedef RenderSurface RenderSurfaceType; 75 76 enum LayerIdLabels { 77 INVALID_ID = -1, 78 }; 79 80 static scoped_refptr<Layer> Create(); 81 82 int id() const { return layer_id_; } 83 84 Layer* RootLayer(); 85 Layer* parent() { return parent_; } 86 const Layer* parent() const { return parent_; } 87 void AddChild(scoped_refptr<Layer> child); 88 void InsertChild(scoped_refptr<Layer> child, size_t index); 89 void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer); 90 void RemoveFromParent(); 91 void RemoveAllChildren(); 92 void SetChildren(const LayerList& children); 93 bool HasAncestor(const Layer* ancestor) const; 94 95 const LayerList& children() const { return children_; } 96 Layer* child_at(size_t index) { return children_[index].get(); } 97 98 // This requests the layer and its subtree be rendered and given to the 99 // callback. If the copy is unable to be produced (the layer is destroyed 100 // first), then the callback is called with a NULL/empty result. 101 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> request); 102 bool HasCopyRequest() const { 103 return !copy_requests_.empty(); 104 } 105 106 void SetAnchorPoint(const gfx::PointF& anchor_point); 107 gfx::PointF anchor_point() const { return anchor_point_; } 108 109 void SetAnchorPointZ(float anchor_point_z); 110 float anchor_point_z() const { return anchor_point_z_; } 111 112 virtual void SetBackgroundColor(SkColor background_color); 113 SkColor background_color() const { return background_color_; } 114 // If contents_opaque(), return an opaque color else return a 115 // non-opaque color. Tries to return background_color(), if possible. 116 SkColor SafeOpaqueBackgroundColor() const; 117 118 // A layer's bounds are in logical, non-page-scaled pixels (however, the 119 // root layer's bounds are in physical pixels). 120 void SetBounds(const gfx::Size& bounds); 121 gfx::Size bounds() const { return bounds_; } 122 123 void SetMasksToBounds(bool masks_to_bounds); 124 bool masks_to_bounds() const { return masks_to_bounds_; } 125 126 void SetMaskLayer(Layer* mask_layer); 127 Layer* mask_layer() { return mask_layer_.get(); } 128 const Layer* mask_layer() const { return mask_layer_.get(); } 129 130 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect); 131 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::RectF(bounds())); } 132 133 void SetOpacity(float opacity); 134 float opacity() const { return opacity_; } 135 bool OpacityIsAnimating() const; 136 virtual bool OpacityCanAnimateOnImplThread() const; 137 138 void SetBlendMode(SkXfermode::Mode blend_mode); 139 SkXfermode::Mode blend_mode() const { return blend_mode_; } 140 141 bool uses_default_blend_mode() const { 142 return blend_mode_ == SkXfermode::kSrcOver_Mode; 143 } 144 145 // A layer is root for an isolated group when it and all its descendants are 146 // drawn over a black and fully transparent background, creating an isolated 147 // group. It should be used along with SetBlendMode(), in order to restrict 148 // layers within the group to blend with layers outside this group. 149 void SetIsRootForIsolatedGroup(bool root); 150 bool is_root_for_isolated_group() const { 151 return is_root_for_isolated_group_; 152 } 153 154 void SetFilters(const FilterOperations& filters); 155 const FilterOperations& filters() const { return filters_; } 156 bool FilterIsAnimating() const; 157 158 // Background filters are filters applied to what is behind this layer, when 159 // they are viewed through non-opaque regions in this layer. They are used 160 // through the WebLayer interface, and are not exposed to HTML. 161 void SetBackgroundFilters(const FilterOperations& filters); 162 const FilterOperations& background_filters() const { 163 return background_filters_; 164 } 165 166 virtual void SetContentsOpaque(bool opaque); 167 bool contents_opaque() const { return contents_opaque_; } 168 169 void SetPosition(const gfx::PointF& position); 170 gfx::PointF position() const { return position_; } 171 172 void SetIsContainerForFixedPositionLayers(bool container); 173 bool IsContainerForFixedPositionLayers() const; 174 175 void SetPositionConstraint(const LayerPositionConstraint& constraint); 176 const LayerPositionConstraint& position_constraint() const { 177 return position_constraint_; 178 } 179 180 void SetTransform(const gfx::Transform& transform); 181 const gfx::Transform& transform() const { return transform_; } 182 bool TransformIsAnimating() const; 183 bool transform_is_invertible() const { return transform_is_invertible_; } 184 185 void SetScrollParent(Layer* parent); 186 187 Layer* scroll_parent() { return scroll_parent_; } 188 const Layer* scroll_parent() const { return scroll_parent_; } 189 190 void AddScrollChild(Layer* child); 191 void RemoveScrollChild(Layer* child); 192 193 std::set<Layer*>* scroll_children() { return scroll_children_.get(); } 194 const std::set<Layer*>* scroll_children() const { 195 return scroll_children_.get(); 196 } 197 198 void SetClipParent(Layer* ancestor); 199 200 Layer* clip_parent() { return clip_parent_; } 201 const Layer* clip_parent() const { 202 return clip_parent_; 203 } 204 205 void AddClipChild(Layer* child); 206 void RemoveClipChild(Layer* child); 207 208 std::set<Layer*>* clip_children() { return clip_children_.get(); } 209 const std::set<Layer*>* clip_children() const { 210 return clip_children_.get(); 211 } 212 213 DrawProperties<Layer>& draw_properties() { return draw_properties_; } 214 const DrawProperties<Layer>& draw_properties() const { 215 return draw_properties_; 216 } 217 218 // The following are shortcut accessors to get various information from 219 // draw_properties_ 220 const gfx::Transform& draw_transform() const { 221 return draw_properties_.target_space_transform; 222 } 223 const gfx::Transform& screen_space_transform() const { 224 return draw_properties_.screen_space_transform; 225 } 226 float draw_opacity() const { return draw_properties_.opacity; } 227 bool draw_opacity_is_animating() const { 228 return draw_properties_.opacity_is_animating; 229 } 230 bool draw_transform_is_animating() const { 231 return draw_properties_.target_space_transform_is_animating; 232 } 233 bool screen_space_transform_is_animating() const { 234 return draw_properties_.screen_space_transform_is_animating; 235 } 236 bool screen_space_opacity_is_animating() const { 237 return draw_properties_.screen_space_opacity_is_animating; 238 } 239 bool can_use_lcd_text() const { return draw_properties_.can_use_lcd_text; } 240 bool is_clipped() const { return draw_properties_.is_clipped; } 241 gfx::Rect clip_rect() const { return draw_properties_.clip_rect; } 242 gfx::Rect drawable_content_rect() const { 243 return draw_properties_.drawable_content_rect; 244 } 245 gfx::Rect visible_content_rect() const { 246 return draw_properties_.visible_content_rect; 247 } 248 Layer* render_target() { 249 DCHECK(!draw_properties_.render_target || 250 draw_properties_.render_target->render_surface()); 251 return draw_properties_.render_target; 252 } 253 const Layer* render_target() const { 254 DCHECK(!draw_properties_.render_target || 255 draw_properties_.render_target->render_surface()); 256 return draw_properties_.render_target; 257 } 258 RenderSurface* render_surface() const { 259 return draw_properties_.render_surface.get(); 260 } 261 int num_unclipped_descendants() const { 262 return draw_properties_.num_unclipped_descendants; 263 } 264 265 void SetScrollOffset(gfx::Vector2d scroll_offset); 266 gfx::Vector2d scroll_offset() const { return scroll_offset_; } 267 void SetScrollOffsetFromImplSide(const gfx::Vector2d& scroll_offset); 268 269 void SetScrollClipLayerId(int clip_layer_id); 270 bool scrollable() const { return scroll_clip_layer_id_ != INVALID_ID; } 271 272 void SetUserScrollable(bool horizontal, bool vertical); 273 bool user_scrollable_horizontal() const { 274 return user_scrollable_horizontal_; 275 } 276 bool user_scrollable_vertical() const { return user_scrollable_vertical_; } 277 278 void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread); 279 bool should_scroll_on_main_thread() const { 280 return should_scroll_on_main_thread_; 281 } 282 283 void SetHaveWheelEventHandlers(bool have_wheel_event_handlers); 284 bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; } 285 286 void SetHaveScrollEventHandlers(bool have_scroll_event_handlers); 287 bool have_scroll_event_handlers() const { 288 return have_scroll_event_handlers_; 289 } 290 291 void SetNonFastScrollableRegion(const Region& non_fast_scrollable_region); 292 const Region& non_fast_scrollable_region() const { 293 return non_fast_scrollable_region_; 294 } 295 296 void SetTouchEventHandlerRegion(const Region& touch_event_handler_region); 297 const Region& touch_event_handler_region() const { 298 return touch_event_handler_region_; 299 } 300 301 void set_did_scroll_callback(const base::Closure& callback) { 302 did_scroll_callback_ = callback; 303 } 304 305 void SetDrawCheckerboardForMissingTiles(bool checkerboard); 306 bool draw_checkerboard_for_missing_tiles() const { 307 return draw_checkerboard_for_missing_tiles_; 308 } 309 310 void SetForceRenderSurface(bool force_render_surface); 311 bool force_render_surface() const { return force_render_surface_; } 312 313 gfx::Vector2d ScrollDelta() const { return gfx::Vector2d(); } 314 gfx::Vector2dF TotalScrollOffset() const { 315 // Floating point to match the LayerImpl version. 316 return scroll_offset() + ScrollDelta(); 317 } 318 319 void SetDoubleSided(bool double_sided); 320 bool double_sided() const { return double_sided_; } 321 322 void SetShouldFlattenTransform(bool flatten); 323 bool should_flatten_transform() const { return should_flatten_transform_; } 324 325 void SetIs3dSorted(bool sorted); 326 bool is_3d_sorted() const { return is_3d_sorted_; } 327 328 void set_use_parent_backface_visibility(bool use) { 329 use_parent_backface_visibility_ = use; 330 } 331 bool use_parent_backface_visibility() const { 332 return use_parent_backface_visibility_; 333 } 334 335 virtual void SetLayerTreeHost(LayerTreeHost* host); 336 337 bool HasDelegatedContent() const { return false; } 338 bool HasContributingDelegatedRenderPasses() const { return false; } 339 340 void SetIsDrawable(bool is_drawable); 341 342 void SetHideLayerAndSubtree(bool hide); 343 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; } 344 345 void SetReplicaLayer(Layer* layer); 346 Layer* replica_layer() { return replica_layer_.get(); } 347 const Layer* replica_layer() const { return replica_layer_.get(); } 348 349 bool has_mask() const { return !!mask_layer_.get(); } 350 bool has_replica() const { return !!replica_layer_.get(); } 351 bool replica_has_mask() const { 352 return replica_layer_.get() && 353 (mask_layer_.get() || replica_layer_->mask_layer_.get()); 354 } 355 356 // These methods typically need to be overwritten by derived classes. 357 virtual bool DrawsContent() const; 358 virtual void SavePaintProperties(); 359 // Returns true iff any resources were updated that need to be committed. 360 virtual bool Update(ResourceUpdateQueue* queue, 361 const OcclusionTracker<Layer>* occlusion); 362 virtual bool NeedMoreUpdates(); 363 virtual void SetIsMask(bool is_mask) {} 364 virtual void ReduceMemoryUsage() {} 365 virtual void OnOutputSurfaceCreated() {} 366 367 virtual scoped_refptr<base::debug::ConvertableToTraceFormat> TakeDebugInfo(); 368 369 void SetLayerClient(LayerClient* client) { client_ = client; } 370 371 virtual void PushPropertiesTo(LayerImpl* layer); 372 373 void CreateRenderSurface(); 374 void ClearRenderSurface(); 375 376 // The contents scale converts from logical, non-page-scaled pixels to target 377 // pixels. The contents scale is 1 for the root layer as it is already in 378 // physical pixels. By default contents scale is forced to be 1 except for 379 // subclasses of ContentsScalingLayer. 380 float contents_scale_x() const { return draw_properties_.contents_scale_x; } 381 float contents_scale_y() const { return draw_properties_.contents_scale_y; } 382 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } 383 384 virtual void CalculateContentsScale(float ideal_contents_scale, 385 float device_scale_factor, 386 float page_scale_factor, 387 float maximum_animation_contents_scale, 388 bool animating_transform_to_screen, 389 float* contents_scale_x, 390 float* contents_scale_y, 391 gfx::Size* content_bounds); 392 393 LayerTreeHost* layer_tree_host() { return layer_tree_host_; } 394 const LayerTreeHost* layer_tree_host() const { return layer_tree_host_; } 395 396 // Set the priority of all desired textures in this layer. 397 virtual void SetTexturePriorities(const PriorityCalculator& priority_calc) {} 398 399 bool AddAnimation(scoped_ptr<Animation> animation); 400 void PauseAnimation(int animation_id, double time_offset); 401 void RemoveAnimation(int animation_id); 402 403 LayerAnimationController* layer_animation_controller() { 404 return layer_animation_controller_.get(); 405 } 406 void SetLayerAnimationControllerForTest( 407 scoped_refptr<LayerAnimationController> controller); 408 409 void set_layer_animation_delegate(AnimationDelegate* delegate) { 410 layer_animation_controller_->set_layer_animation_delegate(delegate); 411 } 412 413 bool HasActiveAnimation() const; 414 415 void AddLayerAnimationEventObserver( 416 LayerAnimationEventObserver* animation_observer); 417 void RemoveLayerAnimationEventObserver( 418 LayerAnimationEventObserver* animation_observer); 419 420 virtual Region VisibleContentOpaqueRegion() const; 421 422 virtual ScrollbarLayerInterface* ToScrollbarLayer(); 423 424 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const; 425 426 virtual skia::RefPtr<SkPicture> GetPicture() const; 427 428 // Constructs a LayerImpl of the correct runtime type for this Layer type. 429 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); 430 431 bool NeedsDisplayForTesting() const { return !update_rect_.IsEmpty(); } 432 void ResetNeedsDisplayForTesting() { update_rect_ = gfx::RectF(); } 433 434 RenderingStatsInstrumentation* rendering_stats_instrumentation() const; 435 436 const PaintProperties& paint_properties() const { 437 return paint_properties_; 438 } 439 440 // The scale at which contents should be rastered, to match the scale at 441 // which they will drawn to the screen. This scale is a component of the 442 // contents scale but does not include page/device scale factors. 443 // TODO(danakj): This goes away when TiledLayer goes away. 444 void set_raster_scale(float scale) { raster_scale_ = scale; } 445 float raster_scale() const { return raster_scale_; } 446 bool raster_scale_is_unknown() const { return raster_scale_ == 0.f; } 447 448 virtual bool SupportsLCDText() const; 449 450 void SetNeedsPushProperties(); 451 bool needs_push_properties() const { return needs_push_properties_; } 452 bool descendant_needs_push_properties() const { 453 return num_dependents_need_push_properties_ > 0; 454 } 455 void reset_needs_push_properties_for_testing() { 456 needs_push_properties_ = false; 457 } 458 459 virtual void RunMicroBenchmark(MicroBenchmark* benchmark); 460 461 protected: 462 friend class LayerImpl; 463 friend class TreeSynchronizer; 464 virtual ~Layer(); 465 466 Layer(); 467 468 // These SetNeeds functions are in order of severity of update: 469 // 470 // Called when this layer has been modified in some way, but isn't sure 471 // that it needs a commit yet. It needs CalcDrawProperties and UpdateLayers 472 // before it knows whether or not a commit is required. 473 void SetNeedsUpdate(); 474 // Called when a property has been modified in a way that the layer 475 // knows immediately that a commit is required. This implies SetNeedsUpdate 476 // as well as SetNeedsPushProperties to push that property. 477 void SetNeedsCommit(); 478 // Called when there's been a change in layer structure. Implies both 479 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties. 480 void SetNeedsFullTreeSync(); 481 482 // Called when the next commit should wait until the pending tree is activated 483 // before finishing the commit and unblocking the main thread. Used to ensure 484 // unused resources on the impl thread are returned before commit completes. 485 void SetNextCommitWaitsForActivation(); 486 487 // Called when the blend mode or filters have been changed. 488 void SetNeedsFilterContextIfNeeded(); 489 490 void AddDependentNeedsPushProperties(); 491 void RemoveDependentNeedsPushProperties(); 492 bool parent_should_know_need_push_properties() const { 493 return needs_push_properties() || descendant_needs_push_properties(); 494 } 495 496 bool IsPropertyChangeAllowed() const; 497 498 // If this layer has a scroll parent, it removes |this| from its list of 499 // scroll children. 500 void RemoveFromScrollTree(); 501 502 // If this layer has a clip parent, it removes |this| from its list of clip 503 // children. 504 void RemoveFromClipTree(); 505 506 void reset_raster_scale_to_unknown() { raster_scale_ = 0.f; } 507 508 // This flag is set when the layer needs to push properties to the impl 509 // side. 510 bool needs_push_properties_; 511 512 // The number of direct children or dependent layers that need to be recursed 513 // to in order for them or a descendent of them to push properties to the impl 514 // side. 515 int num_dependents_need_push_properties_; 516 517 // Tracks whether this layer may have changed stacking order with its 518 // siblings. 519 bool stacking_order_changed_; 520 521 // The update rect is the region of the compositor resource that was 522 // actually updated by the compositor. For layers that may do updating 523 // outside the compositor's control (i.e. plugin layers), this information 524 // is not available and the update rect will remain empty. 525 // Note this rect is in layer space (not content space). 526 gfx::RectF update_rect_; 527 528 scoped_refptr<Layer> mask_layer_; 529 530 int layer_id_; 531 532 // When true, the layer is about to perform an update. Any commit requests 533 // will be handled implicitly after the update completes. 534 bool ignore_set_needs_commit_; 535 536 private: 537 friend class base::RefCounted<Layer>; 538 539 void SetParent(Layer* layer); 540 bool DescendantIsFixedToContainerLayer() const; 541 542 // Returns the index of the child or -1 if not found. 543 int IndexOfChild(const Layer* reference); 544 545 // This should only be called from RemoveFromParent(). 546 void RemoveChildOrDependent(Layer* child); 547 548 // LayerAnimationValueProvider implementation. 549 virtual gfx::Vector2dF ScrollOffsetForAnimation() const OVERRIDE; 550 551 // LayerAnimationValueObserver implementation. 552 virtual void OnFilterAnimated(const FilterOperations& filters) OVERRIDE; 553 virtual void OnOpacityAnimated(float opacity) OVERRIDE; 554 virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE; 555 virtual void OnScrollOffsetAnimated( 556 const gfx::Vector2dF& scroll_offset) OVERRIDE; 557 virtual void OnAnimationWaitingForDeletion() OVERRIDE; 558 virtual bool IsActive() const OVERRIDE; 559 560 LayerList children_; 561 Layer* parent_; 562 563 // Layer instances have a weak pointer to their LayerTreeHost. 564 // This pointer value is nil when a Layer is not in a tree and is 565 // updated via SetLayerTreeHost() if a layer moves between trees. 566 LayerTreeHost* layer_tree_host_; 567 568 scoped_refptr<LayerAnimationController> layer_animation_controller_; 569 570 // Layer properties. 571 gfx::Size bounds_; 572 573 gfx::Vector2d scroll_offset_; 574 // This variable indicates which ancestor layer (if any) whose size, 575 // transformed relative to this layer, defines the maximum scroll offset for 576 // this layer. 577 int scroll_clip_layer_id_; 578 bool should_scroll_on_main_thread_ : 1; 579 bool have_wheel_event_handlers_ : 1; 580 bool have_scroll_event_handlers_ : 1; 581 bool user_scrollable_horizontal_ : 1; 582 bool user_scrollable_vertical_ : 1; 583 bool is_root_for_isolated_group_ : 1; 584 bool is_container_for_fixed_position_layers_ : 1; 585 bool is_drawable_ : 1; 586 bool hide_layer_and_subtree_ : 1; 587 bool masks_to_bounds_ : 1; 588 bool contents_opaque_ : 1; 589 bool double_sided_ : 1; 590 bool should_flatten_transform_ : 1; 591 bool use_parent_backface_visibility_ : 1; 592 bool draw_checkerboard_for_missing_tiles_ : 1; 593 bool force_render_surface_ : 1; 594 bool is_3d_sorted_ : 1; 595 bool transform_is_invertible_ : 1; 596 Region non_fast_scrollable_region_; 597 Region touch_event_handler_region_; 598 gfx::PointF position_; 599 gfx::PointF anchor_point_; 600 SkColor background_color_; 601 float opacity_; 602 SkXfermode::Mode blend_mode_; 603 FilterOperations filters_; 604 FilterOperations background_filters_; 605 float anchor_point_z_; 606 LayerPositionConstraint position_constraint_; 607 Layer* scroll_parent_; 608 scoped_ptr<std::set<Layer*> > scroll_children_; 609 610 Layer* clip_parent_; 611 scoped_ptr<std::set<Layer*> > clip_children_; 612 613 gfx::Transform transform_; 614 615 // Replica layer used for reflections. 616 scoped_refptr<Layer> replica_layer_; 617 618 // Transient properties. 619 float raster_scale_; 620 621 LayerClient* client_; 622 623 ScopedPtrVector<CopyOutputRequest> copy_requests_; 624 625 base::Closure did_scroll_callback_; 626 627 DrawProperties<Layer> draw_properties_; 628 629 PaintProperties paint_properties_; 630 631 DISALLOW_COPY_AND_ASSIGN(Layer); 632}; 633 634} // namespace cc 635 636#endif // CC_LAYERS_LAYER_H_ 637