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 #include "ui/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
16 #include "cc/base/scoped_ptr_algorithm.h" | 16 #include "cc/base/scoped_ptr_algorithm.h" |
17 #include "cc/layers/content_layer.h" | 17 #include "cc/layers/content_layer.h" |
18 #include "cc/layers/delegated_renderer_layer.h" | 18 #include "cc/layers/delegated_renderer_layer.h" |
19 #include "cc/layers/nine_patch_layer.h" | 19 #include "cc/layers/nine_patch_layer.h" |
20 #include "cc/layers/picture_layer.h" | 20 #include "cc/layers/picture_layer.h" |
21 #include "cc/layers/solid_color_layer.h" | 21 #include "cc/layers/solid_color_layer.h" |
22 #include "cc/layers/surface_layer.h" | 22 #include "cc/layers/surface_layer.h" |
23 #include "cc/layers/texture_layer.h" | 23 #include "cc/layers/texture_layer.h" |
24 #include "cc/output/copy_output_request.h" | 24 #include "cc/output/copy_output_request.h" |
25 #include "cc/output/delegated_frame_data.h" | 25 #include "cc/output/delegated_frame_data.h" |
26 #include "cc/output/filter_operation.h" | 26 #include "cc/output/filter_operation.h" |
27 #include "cc/output/filter_operations.h" | 27 #include "cc/output/filter_operations.h" |
28 #include "cc/resources/transferable_resource.h" | 28 #include "cc/resources/transferable_resource.h" |
29 #include "cc/trees/layer_tree_settings.h" | |
29 #include "ui/compositor/compositor_switches.h" | 30 #include "ui/compositor/compositor_switches.h" |
30 #include "ui/compositor/dip_util.h" | 31 #include "ui/compositor/dip_util.h" |
31 #include "ui/compositor/layer_animator.h" | 32 #include "ui/compositor/layer_animator.h" |
32 #include "ui/compositor/paint_context.h" | 33 #include "ui/compositor/paint_context.h" |
33 #include "ui/gfx/animation/animation.h" | 34 #include "ui/gfx/animation/animation.h" |
34 #include "ui/gfx/canvas.h" | 35 #include "ui/gfx/canvas.h" |
35 #include "ui/gfx/display.h" | 36 #include "ui/gfx/display.h" |
36 #include "ui/gfx/geometry/point3_f.h" | 37 #include "ui/gfx/geometry/point3_f.h" |
37 #include "ui/gfx/geometry/point_conversions.h" | 38 #include "ui/gfx/geometry/point_conversions.h" |
38 #include "ui/gfx/geometry/size_conversions.h" | 39 #include "ui/gfx/geometry/size_conversions.h" |
39 #include "ui/gfx/interpolated_transform.h" | 40 #include "ui/gfx/interpolated_transform.h" |
40 | 41 |
41 namespace { | 42 namespace { |
42 | 43 |
43 const ui::Layer* GetRoot(const ui::Layer* layer) { | 44 const ui::Layer* GetRoot(const ui::Layer* layer) { |
44 while (layer->parent()) | 45 while (layer->parent()) |
45 layer = layer->parent(); | 46 layer = layer->parent(); |
46 return layer; | 47 return layer; |
47 } | 48 } |
48 | 49 |
49 struct UIImplSidePaintingStatus { | 50 struct UIImplSidePaintingStatus { |
50 UIImplSidePaintingStatus() | 51 UIImplSidePaintingStatus() |
51 : enabled(ui::IsUIImplSidePaintingEnabled()) { | 52 : enabled(ui::IsUIImplSidePaintingEnabled()) { |
52 } | 53 } |
53 bool enabled; | 54 bool enabled; |
54 }; | 55 }; |
55 base::LazyInstance<UIImplSidePaintingStatus> g_ui_impl_side_painting_status = | 56 base::LazyInstance<UIImplSidePaintingStatus> g_ui_impl_side_painting_status = |
56 LAZY_INSTANCE_INITIALIZER; | 57 LAZY_INSTANCE_INITIALIZER; |
57 | 58 |
59 cc::LayerSettings g_ui_layer_settings; | |
piman
2015/05/11 21:31:24
Same here
| |
60 | |
58 } // namespace | 61 } // namespace |
59 | 62 |
60 namespace ui { | 63 namespace ui { |
61 | 64 |
62 Layer::Layer() | 65 Layer::Layer() |
63 : type_(LAYER_TEXTURED), | 66 : type_(LAYER_TEXTURED), |
64 compositor_(NULL), | 67 compositor_(NULL), |
65 parent_(NULL), | 68 parent_(NULL), |
66 visible_(true), | 69 visible_(true), |
67 force_render_surface_(false), | 70 force_render_surface_(false), |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 compositor_->SetRootLayer(NULL); | 121 compositor_->SetRootLayer(NULL); |
119 if (parent_) | 122 if (parent_) |
120 parent_->Remove(this); | 123 parent_->Remove(this); |
121 if (layer_mask_) | 124 if (layer_mask_) |
122 SetMaskLayer(NULL); | 125 SetMaskLayer(NULL); |
123 if (layer_mask_back_link_) | 126 if (layer_mask_back_link_) |
124 layer_mask_back_link_->SetMaskLayer(NULL); | 127 layer_mask_back_link_->SetMaskLayer(NULL); |
125 for (size_t i = 0; i < children_.size(); ++i) | 128 for (size_t i = 0; i < children_.size(); ++i) |
126 children_[i]->parent_ = NULL; | 129 children_[i]->parent_ = NULL; |
127 cc_layer_->RemoveLayerAnimationEventObserver(this); | 130 cc_layer_->RemoveLayerAnimationEventObserver(this); |
131 | |
128 cc_layer_->RemoveFromParent(); | 132 cc_layer_->RemoveFromParent(); |
129 } | 133 } |
130 | 134 |
131 // static | 135 // static |
132 bool Layer::UsingPictureLayer() { | 136 bool Layer::UsingPictureLayer() { |
133 return g_ui_impl_side_painting_status.Get().enabled; | 137 return g_ui_impl_side_painting_status.Get().enabled; |
134 } | 138 } |
135 | 139 |
140 // static | |
141 const cc::LayerSettings& Layer::UILayerSettings() { | |
142 return g_ui_layer_settings; | |
143 } | |
144 | |
145 // static | |
146 void Layer::SetUILayerSettings(const cc::LayerSettings& settings) { | |
147 g_ui_layer_settings = settings; | |
148 } | |
149 | |
136 const Compositor* Layer::GetCompositor() const { | 150 const Compositor* Layer::GetCompositor() const { |
137 return GetRoot(this)->compositor_; | 151 return GetRoot(this)->compositor_; |
138 } | 152 } |
139 | 153 |
140 float Layer::opacity() const { | 154 float Layer::opacity() const { |
141 return cc_layer_->opacity(); | 155 return cc_layer_->opacity(); |
142 } | 156 } |
143 | 157 |
144 void Layer::SetCompositor(Compositor* compositor) { | 158 void Layer::SetCompositor(Compositor* compositor, |
145 // This function must only be called to set the compositor on the root layer, | 159 scoped_refptr<cc::Layer> root_layer) { |
146 // or to reset it. | 160 // This function must only be called to set the compositor on the root ui |
147 DCHECK(!compositor || !compositor_); | 161 // layer. |
148 DCHECK(!compositor || compositor->root_layer() == this); | 162 DCHECK(compositor); |
163 DCHECK(!compositor_); | |
164 DCHECK(compositor->root_layer() == this); | |
149 DCHECK(!parent_); | 165 DCHECK(!parent_); |
150 if (compositor_) { | 166 |
167 compositor_ = compositor; | |
168 OnDeviceScaleFactorChanged(compositor->device_scale_factor()); | |
169 AddAnimatorsInTreeToCollection(compositor_->layer_animator_collection()); | |
170 | |
171 root_layer->AddChild(cc_layer_); | |
172 SendPendingThreadedAnimations(); | |
173 } | |
174 | |
175 void Layer::ResetCompositor() { | |
176 DCHECK(!parent_); | |
177 if (compositor_) | |
151 RemoveAnimatorsInTreeFromCollection( | 178 RemoveAnimatorsInTreeFromCollection( |
152 compositor_->layer_animator_collection()); | 179 compositor_->layer_animator_collection()); |
153 } | 180 compositor_ = nullptr; |
154 compositor_ = compositor; | |
155 if (compositor) { | |
156 OnDeviceScaleFactorChanged(compositor->device_scale_factor()); | |
157 SendPendingThreadedAnimations(); | |
158 AddAnimatorsInTreeToCollection(compositor_->layer_animator_collection()); | |
159 } | |
160 } | 181 } |
161 | 182 |
162 void Layer::Add(Layer* child) { | 183 void Layer::Add(Layer* child) { |
163 DCHECK(!child->compositor_); | 184 DCHECK(!child->compositor_); |
164 if (child->parent_) | 185 if (child->parent_) |
165 child->parent_->Remove(child); | 186 child->parent_->Remove(child); |
166 child->parent_ = this; | 187 child->parent_ = this; |
167 children_.push_back(child); | 188 children_.push_back(child); |
168 cc_layer_->AddChild(child->cc_layer_); | 189 cc_layer_->AddChild(child->cc_layer_); |
169 child->OnDeviceScaleFactorChanged(device_scale_factor_); | 190 child->OnDeviceScaleFactorChanged(device_scale_factor_); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
330 layer_mask->children().empty() && | 351 layer_mask->children().empty() && |
331 !layer_mask->layer_mask_back_link_)); | 352 !layer_mask->layer_mask_back_link_)); |
332 DCHECK(!layer_mask_back_link_); | 353 DCHECK(!layer_mask_back_link_); |
333 if (layer_mask_ == layer_mask) | 354 if (layer_mask_ == layer_mask) |
334 return; | 355 return; |
335 // We need to de-reference the currently linked object so that no problem | 356 // We need to de-reference the currently linked object so that no problem |
336 // arises if the mask layer gets deleted before this object. | 357 // arises if the mask layer gets deleted before this object. |
337 if (layer_mask_) | 358 if (layer_mask_) |
338 layer_mask_->layer_mask_back_link_ = NULL; | 359 layer_mask_->layer_mask_back_link_ = NULL; |
339 layer_mask_ = layer_mask; | 360 layer_mask_ = layer_mask; |
340 cc_layer_->SetMaskLayer( | 361 cc_layer_->SetMaskLayer(layer_mask ? layer_mask->cc_layer_ : NULL); |
341 layer_mask ? layer_mask->cc_layer() : NULL); | |
342 // We need to reference the linked object so that it can properly break the | 362 // We need to reference the linked object so that it can properly break the |
343 // link to us when it gets deleted. | 363 // link to us when it gets deleted. |
344 if (layer_mask) { | 364 if (layer_mask) { |
345 layer_mask->layer_mask_back_link_ = this; | 365 layer_mask->layer_mask_back_link_ = this; |
346 layer_mask->OnDeviceScaleFactorChanged(device_scale_factor_); | 366 layer_mask->OnDeviceScaleFactorChanged(device_scale_factor_); |
347 } | 367 } |
348 } | 368 } |
349 | 369 |
350 void Layer::SetBackgroundZoom(float zoom, int inset) { | 370 void Layer::SetBackgroundZoom(float zoom, int inset) { |
351 zoom_ = zoom; | 371 zoom_ = zoom; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 fills_bounds_opaquely_ = fills_bounds_opaquely; | 488 fills_bounds_opaquely_ = fills_bounds_opaquely; |
469 | 489 |
470 cc_layer_->SetContentsOpaque(fills_bounds_opaquely); | 490 cc_layer_->SetContentsOpaque(fills_bounds_opaquely); |
471 } | 491 } |
472 | 492 |
473 void Layer::SetFillsBoundsCompletely(bool fills_bounds_completely) { | 493 void Layer::SetFillsBoundsCompletely(bool fills_bounds_completely) { |
474 fills_bounds_completely_ = fills_bounds_completely; | 494 fills_bounds_completely_ = fills_bounds_completely; |
475 } | 495 } |
476 | 496 |
477 void Layer::SwitchToLayer(scoped_refptr<cc::Layer> new_layer) { | 497 void Layer::SwitchToLayer(scoped_refptr<cc::Layer> new_layer) { |
498 DCHECK(!new_layer->parent()); | |
499 | |
478 // Finish animations being handled by cc_layer_. | 500 // Finish animations being handled by cc_layer_. |
479 if (animator_.get()) { | 501 if (animator_.get()) { |
480 animator_->StopAnimatingProperty(LayerAnimationElement::TRANSFORM); | 502 animator_->StopAnimatingProperty(LayerAnimationElement::TRANSFORM); |
481 animator_->StopAnimatingProperty(LayerAnimationElement::OPACITY); | 503 animator_->StopAnimatingProperty(LayerAnimationElement::OPACITY); |
482 } | 504 } |
483 | 505 |
484 if (texture_layer_.get()) | 506 if (texture_layer_.get()) |
485 texture_layer_->ClearClient(); | 507 texture_layer_->ClearClient(); |
486 // TODO(piman): delegated_renderer_layer_ cleanup. | 508 // TODO(piman): delegated_renderer_layer_ cleanup. |
487 | 509 |
(...skipping 27 matching lines...) Expand all Loading... | |
515 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); | 537 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); |
516 cc_layer_->SetHideLayerAndSubtree(!visible_); | 538 cc_layer_->SetHideLayerAndSubtree(!visible_); |
517 | 539 |
518 SetLayerFilters(); | 540 SetLayerFilters(); |
519 SetLayerBackgroundFilters(); | 541 SetLayerBackgroundFilters(); |
520 } | 542 } |
521 | 543 |
522 void Layer::SwitchCCLayerForTest() { | 544 void Layer::SwitchCCLayerForTest() { |
523 scoped_refptr<cc::Layer> new_layer; | 545 scoped_refptr<cc::Layer> new_layer; |
524 if (Layer::UsingPictureLayer()) | 546 if (Layer::UsingPictureLayer()) |
525 new_layer = cc::PictureLayer::Create(this); | 547 new_layer = cc::PictureLayer::Create(UILayerSettings(), this); |
526 else | 548 else |
527 new_layer = cc::ContentLayer::Create(this); | 549 new_layer = cc::ContentLayer::Create(UILayerSettings(), this); |
528 SwitchToLayer(new_layer); | 550 SwitchToLayer(new_layer); |
529 content_layer_ = new_layer; | 551 content_layer_ = new_layer; |
530 } | 552 } |
531 | 553 |
532 void Layer::SetTextureMailbox( | 554 void Layer::SetTextureMailbox( |
533 const cc::TextureMailbox& mailbox, | 555 const cc::TextureMailbox& mailbox, |
534 scoped_ptr<cc::SingleReleaseCallback> release_callback, | 556 scoped_ptr<cc::SingleReleaseCallback> release_callback, |
535 gfx::Size texture_size_in_dip) { | 557 gfx::Size texture_size_in_dip) { |
536 DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); | 558 DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); |
537 DCHECK(mailbox.IsValid()); | 559 DCHECK(mailbox.IsValid()); |
538 DCHECK(release_callback); | 560 DCHECK(release_callback); |
539 if (!texture_layer_.get()) { | 561 if (!texture_layer_.get()) { |
540 scoped_refptr<cc::TextureLayer> new_layer = | 562 scoped_refptr<cc::TextureLayer> new_layer = |
541 cc::TextureLayer::CreateForMailbox(this); | 563 cc::TextureLayer::CreateForMailbox(UILayerSettings(), this); |
542 new_layer->SetFlipped(true); | 564 new_layer->SetFlipped(true); |
543 SwitchToLayer(new_layer); | 565 SwitchToLayer(new_layer); |
544 texture_layer_ = new_layer; | 566 texture_layer_ = new_layer; |
545 // Reset the frame_size_in_dip_ so that SetTextureSize() will not early out, | 567 // Reset the frame_size_in_dip_ so that SetTextureSize() will not early out, |
546 // the frame_size_in_dip_ was for a previous (different) |texture_layer_|. | 568 // the frame_size_in_dip_ was for a previous (different) |texture_layer_|. |
547 frame_size_in_dip_ = gfx::Size(); | 569 frame_size_in_dip_ = gfx::Size(); |
548 } | 570 } |
549 if (mailbox_release_callback_) | 571 if (mailbox_release_callback_) |
550 mailbox_release_callback_->Run(0, false); | 572 mailbox_release_callback_->Run(0, false); |
551 mailbox_release_callback_ = release_callback.Pass(); | 573 mailbox_release_callback_ = release_callback.Pass(); |
(...skipping 18 matching lines...) Expand all Loading... | |
570 bool Layer::TextureFlipped() const { | 592 bool Layer::TextureFlipped() const { |
571 DCHECK(texture_layer_.get()); | 593 DCHECK(texture_layer_.get()); |
572 return texture_layer_->flipped(); | 594 return texture_layer_->flipped(); |
573 } | 595 } |
574 | 596 |
575 void Layer::SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider, | 597 void Layer::SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider, |
576 gfx::Size frame_size_in_dip) { | 598 gfx::Size frame_size_in_dip) { |
577 DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); | 599 DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); |
578 | 600 |
579 scoped_refptr<cc::DelegatedRendererLayer> new_layer = | 601 scoped_refptr<cc::DelegatedRendererLayer> new_layer = |
580 cc::DelegatedRendererLayer::Create(frame_provider); | 602 cc::DelegatedRendererLayer::Create(UILayerSettings(), frame_provider); |
581 SwitchToLayer(new_layer); | 603 SwitchToLayer(new_layer); |
582 delegated_renderer_layer_ = new_layer; | 604 delegated_renderer_layer_ = new_layer; |
583 | 605 |
584 frame_size_in_dip_ = frame_size_in_dip; | 606 frame_size_in_dip_ = frame_size_in_dip; |
585 RecomputeDrawsContentAndUVRect(); | 607 RecomputeDrawsContentAndUVRect(); |
586 } | 608 } |
587 | 609 |
588 void Layer::SetShowSurface( | 610 void Layer::SetShowSurface( |
589 cc::SurfaceId surface_id, | 611 cc::SurfaceId surface_id, |
590 const cc::SurfaceLayer::SatisfyCallback& satisfy_callback, | 612 const cc::SurfaceLayer::SatisfyCallback& satisfy_callback, |
591 const cc::SurfaceLayer::RequireCallback& require_callback, | 613 const cc::SurfaceLayer::RequireCallback& require_callback, |
592 gfx::Size surface_size, | 614 gfx::Size surface_size, |
593 float scale, | 615 float scale, |
594 gfx::Size frame_size_in_dip) { | 616 gfx::Size frame_size_in_dip) { |
595 DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); | 617 DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); |
596 | 618 |
597 scoped_refptr<cc::SurfaceLayer> new_layer = | 619 scoped_refptr<cc::SurfaceLayer> new_layer = cc::SurfaceLayer::Create( |
598 cc::SurfaceLayer::Create(satisfy_callback, require_callback); | 620 UILayerSettings(), satisfy_callback, require_callback); |
599 new_layer->SetSurfaceId(surface_id, scale, surface_size); | 621 new_layer->SetSurfaceId(surface_id, scale, surface_size); |
600 SwitchToLayer(new_layer); | 622 SwitchToLayer(new_layer); |
601 surface_layer_ = new_layer; | 623 surface_layer_ = new_layer; |
602 | 624 |
603 frame_size_in_dip_ = frame_size_in_dip; | 625 frame_size_in_dip_ = frame_size_in_dip; |
604 RecomputeDrawsContentAndUVRect(); | 626 RecomputeDrawsContentAndUVRect(); |
605 } | 627 } |
606 | 628 |
607 void Layer::SetShowSolidColorContent() { | 629 void Layer::SetShowSolidColorContent() { |
608 DCHECK_EQ(type_, LAYER_SOLID_COLOR); | 630 DCHECK_EQ(type_, LAYER_SOLID_COLOR); |
609 | 631 |
610 if (solid_color_layer_.get()) | 632 if (solid_color_layer_.get()) |
611 return; | 633 return; |
612 | 634 |
613 scoped_refptr<cc::SolidColorLayer> new_layer = cc::SolidColorLayer::Create(); | 635 scoped_refptr<cc::SolidColorLayer> new_layer = |
636 cc::SolidColorLayer::Create(UILayerSettings()); | |
614 SwitchToLayer(new_layer); | 637 SwitchToLayer(new_layer); |
615 solid_color_layer_ = new_layer; | 638 solid_color_layer_ = new_layer; |
616 | 639 |
617 mailbox_ = cc::TextureMailbox(); | 640 mailbox_ = cc::TextureMailbox(); |
618 if (mailbox_release_callback_) { | 641 if (mailbox_release_callback_) { |
619 mailbox_release_callback_->Run(0, false); | 642 mailbox_release_callback_->Run(0, false); |
620 mailbox_release_callback_.reset(); | 643 mailbox_release_callback_.reset(); |
621 } | 644 } |
622 RecomputeDrawsContentAndUVRect(); | 645 RecomputeDrawsContentAndUVRect(); |
623 } | 646 } |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1012 cc_layer_->AddAnimation(pending_threaded_animations_.take(it)); | 1035 cc_layer_->AddAnimation(pending_threaded_animations_.take(it)); |
1013 | 1036 |
1014 pending_threaded_animations_.clear(); | 1037 pending_threaded_animations_.clear(); |
1015 | 1038 |
1016 for (size_t i = 0; i < children_.size(); ++i) | 1039 for (size_t i = 0; i < children_.size(); ++i) |
1017 children_[i]->SendPendingThreadedAnimations(); | 1040 children_[i]->SendPendingThreadedAnimations(); |
1018 } | 1041 } |
1019 | 1042 |
1020 void Layer::CreateCcLayer() { | 1043 void Layer::CreateCcLayer() { |
1021 if (type_ == LAYER_SOLID_COLOR) { | 1044 if (type_ == LAYER_SOLID_COLOR) { |
1022 solid_color_layer_ = cc::SolidColorLayer::Create(); | 1045 solid_color_layer_ = cc::SolidColorLayer::Create(UILayerSettings()); |
1023 cc_layer_ = solid_color_layer_.get(); | 1046 cc_layer_ = solid_color_layer_.get(); |
1024 } else if (type_ == LAYER_NINE_PATCH) { | 1047 } else if (type_ == LAYER_NINE_PATCH) { |
1025 nine_patch_layer_ = cc::NinePatchLayer::Create(); | 1048 nine_patch_layer_ = cc::NinePatchLayer::Create(UILayerSettings()); |
1026 cc_layer_ = nine_patch_layer_.get(); | 1049 cc_layer_ = nine_patch_layer_.get(); |
1027 } else { | 1050 } else { |
1028 if (Layer::UsingPictureLayer()) | 1051 if (Layer::UsingPictureLayer()) |
1029 content_layer_ = cc::PictureLayer::Create(this); | 1052 content_layer_ = cc::PictureLayer::Create(UILayerSettings(), this); |
1030 else | 1053 else |
1031 content_layer_ = cc::ContentLayer::Create(this); | 1054 content_layer_ = cc::ContentLayer::Create(UILayerSettings(), this); |
1032 cc_layer_ = content_layer_.get(); | 1055 cc_layer_ = content_layer_.get(); |
1033 } | 1056 } |
1034 cc_layer_->SetTransformOrigin(gfx::Point3F()); | 1057 cc_layer_->SetTransformOrigin(gfx::Point3F()); |
1035 cc_layer_->SetContentsOpaque(true); | 1058 cc_layer_->SetContentsOpaque(true); |
1036 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); | 1059 cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); |
1037 cc_layer_->AddLayerAnimationEventObserver(this); | 1060 cc_layer_->AddLayerAnimationEventObserver(this); |
1038 cc_layer_->SetLayerClient(this); | 1061 cc_layer_->SetLayerClient(this); |
1039 RecomputePosition(); | 1062 RecomputePosition(); |
1040 } | 1063 } |
1041 | 1064 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1085 children_.end(), | 1108 children_.end(), |
1086 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), | 1109 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), |
1087 collection)); | 1110 collection)); |
1088 } | 1111 } |
1089 | 1112 |
1090 bool Layer::IsAnimating() const { | 1113 bool Layer::IsAnimating() const { |
1091 return animator_.get() && animator_->is_animating(); | 1114 return animator_.get() && animator_->is_animating(); |
1092 } | 1115 } |
1093 | 1116 |
1094 } // namespace ui | 1117 } // namespace ui |
OLD | NEW |