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 #include "cc/layers/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 } | 587 } |
588 | 588 |
589 void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) { | 589 void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) { |
590 DCHECK(IsPropertyChangeAllowed()); | 590 DCHECK(IsPropertyChangeAllowed()); |
591 if (transform_origin_ == transform_origin) | 591 if (transform_origin_ == transform_origin) |
592 return; | 592 return; |
593 transform_origin_ = transform_origin; | 593 transform_origin_ = transform_origin; |
594 SetNeedsCommit(); | 594 SetNeedsCommit(); |
595 } | 595 } |
596 | 596 |
| 597 bool Layer::AnimationsPreserveAxisAlignment() const { |
| 598 return layer_animation_controller_->AnimationsPreserveAxisAlignment(); |
| 599 } |
| 600 |
597 bool Layer::TransformIsAnimating() const { | 601 bool Layer::TransformIsAnimating() const { |
598 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); | 602 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); |
599 } | 603 } |
600 | 604 |
601 void Layer::SetScrollParent(Layer* parent) { | 605 void Layer::SetScrollParent(Layer* parent) { |
602 DCHECK(IsPropertyChangeAllowed()); | 606 DCHECK(IsPropertyChangeAllowed()); |
603 if (scroll_parent_ == parent) | 607 if (scroll_parent_ == parent) |
604 return; | 608 return; |
605 | 609 |
606 if (scroll_parent_) | 610 if (scroll_parent_) |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 TRACE_EVENT_CATEGORY_GROUP_ENABLED( | 878 TRACE_EVENT_CATEGORY_GROUP_ENABLED( |
875 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( | 879 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( |
876 "devtools.timeline.layers"), | 880 "devtools.timeline.layers"), |
877 &is_tracing); | 881 &is_tracing); |
878 if (is_tracing) | 882 if (is_tracing) |
879 layer->SetDebugInfo(TakeDebugInfo()); | 883 layer->SetDebugInfo(TakeDebugInfo()); |
880 | 884 |
881 layer->SetDoubleSided(double_sided_); | 885 layer->SetDoubleSided(double_sided_); |
882 layer->SetDrawCheckerboardForMissingTiles( | 886 layer->SetDrawCheckerboardForMissingTiles( |
883 draw_checkerboard_for_missing_tiles_); | 887 draw_checkerboard_for_missing_tiles_); |
884 layer->SetForceRenderSurface(force_render_surface_); | |
885 layer->SetDrawsContent(DrawsContent()); | 888 layer->SetDrawsContent(DrawsContent()); |
886 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 889 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
| 890 layer->SetHasRenderSurface(has_render_surface_); |
887 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) | 891 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) |
888 layer->SetFilters(filters_); | 892 layer->SetFilters(filters_); |
889 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); | 893 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); |
890 layer->SetBackgroundFilters(background_filters()); | 894 layer->SetBackgroundFilters(background_filters()); |
891 layer->SetMasksToBounds(masks_to_bounds_); | 895 layer->SetMasksToBounds(masks_to_bounds_); |
892 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 896 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
893 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | 897 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); |
894 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); | 898 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); |
895 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 899 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
896 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 900 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 return true; | 1081 return true; |
1078 } | 1082 } |
1079 | 1083 |
1080 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() { | 1084 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() { |
1081 if (client_) | 1085 if (client_) |
1082 return client_->TakeDebugInfo(); | 1086 return client_->TakeDebugInfo(); |
1083 else | 1087 else |
1084 return nullptr; | 1088 return nullptr; |
1085 } | 1089 } |
1086 | 1090 |
| 1091 void Layer::SetHasRenderSurface(bool has_render_surface) { |
| 1092 if (has_render_surface_ == has_render_surface) |
| 1093 return; |
| 1094 has_render_surface_ = has_render_surface; |
| 1095 // We do not need SetNeedsCommit here, since this is only ever called |
| 1096 // during a commit, from CalculateDrawProperties. |
| 1097 SetNeedsPushProperties(); |
| 1098 } |
| 1099 |
1087 void Layer::CreateRenderSurface() { | 1100 void Layer::CreateRenderSurface() { |
1088 DCHECK(!draw_properties_.render_surface); | 1101 DCHECK(!render_surface_); |
1089 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); | 1102 render_surface_ = make_scoped_ptr(new RenderSurface(this)); |
1090 draw_properties_.render_target = this; | |
1091 } | 1103 } |
1092 | 1104 |
1093 void Layer::ClearRenderSurface() { | 1105 void Layer::ClearRenderSurface() { |
1094 draw_properties_.render_surface = nullptr; | 1106 render_surface_ = nullptr; |
1095 } | 1107 } |
1096 | 1108 |
1097 void Layer::ClearRenderSurfaceLayerList() { | 1109 void Layer::ClearRenderSurfaceLayerList() { |
1098 if (draw_properties_.render_surface) | 1110 if (render_surface_) |
1099 draw_properties_.render_surface->layer_list().clear(); | 1111 render_surface_->ClearLayerLists(); |
1100 } | 1112 } |
1101 | 1113 |
1102 gfx::ScrollOffset Layer::ScrollOffsetForAnimation() const { | 1114 gfx::ScrollOffset Layer::ScrollOffsetForAnimation() const { |
1103 return TotalScrollOffset(); | 1115 return TotalScrollOffset(); |
1104 } | 1116 } |
1105 | 1117 |
1106 // On<Property>Animated is called due to an ongoing accelerated animation. | 1118 // On<Property>Animated is called due to an ongoing accelerated animation. |
1107 // Since this animation is also being run on the compositor thread, there | 1119 // Since this animation is also being run on the compositor thread, there |
1108 // is no need to request a commit to push this value over, so the value is | 1120 // is no need to request a commit to push this value over, so the value is |
1109 // set directly rather than by calling Set<Property>. | 1121 // set directly rather than by calling Set<Property>. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 const TransformNode* node = tree.Node(transform_tree_index()); | 1277 const TransformNode* node = tree.Node(transform_tree_index()); |
1266 gfx::Transform ssxform; | 1278 gfx::Transform ssxform; |
1267 tree.ComputeTransform(node->id, node->data.target_id, &ssxform); | 1279 tree.ComputeTransform(node->id, node->data.target_id, &ssxform); |
1268 xform.ConcatTransform(ssxform); | 1280 xform.ConcatTransform(ssxform); |
1269 } | 1281 } |
1270 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); | 1282 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); |
1271 return xform; | 1283 return xform; |
1272 } | 1284 } |
1273 | 1285 |
1274 } // namespace cc | 1286 } // namespace cc |
OLD | NEW |