OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 } | 593 } |
594 | 594 |
595 layer->PassCopyRequests(©_requests_); | 595 layer->PassCopyRequests(©_requests_); |
596 | 596 |
597 // If the main thread commits multiple times before the impl thread actually | 597 // If the main thread commits multiple times before the impl thread actually |
598 // draws, then damage tracking will become incorrect if we simply clobber the | 598 // draws, then damage tracking will become incorrect if we simply clobber the |
599 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 599 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
600 // union) any update changes that have occurred on the main thread. | 600 // union) any update changes that have occurred on the main thread. |
601 update_rect_.Union(layer->update_rect()); | 601 update_rect_.Union(layer->update_rect()); |
602 layer->SetUpdateRect(update_rect_); | 602 layer->SetUpdateRect(update_rect_); |
| 603 overlay_update_rect_.Union(layer->overlay_update_rect()); |
| 604 layer->SetOverlayUpdateRect(overlay_update_rect_); |
603 | 605 |
604 layer->SetStackingOrderChanged(stacking_order_changed_); | 606 layer->SetStackingOrderChanged(stacking_order_changed_); |
605 layer->SetDebugInfo(debug_info_); | 607 layer->SetDebugInfo(debug_info_); |
606 | 608 |
607 if (frame_timing_requests_dirty_) { | 609 if (frame_timing_requests_dirty_) { |
608 layer->PassFrameTimingRequests(&frame_timing_requests_); | 610 layer->PassFrameTimingRequests(&frame_timing_requests_); |
609 frame_timing_requests_dirty_ = false; | 611 frame_timing_requests_dirty_ = false; |
610 } | 612 } |
611 | 613 |
612 // Reset any state that should be cleared for the next update. | 614 // Reset any state that should be cleared for the next update. |
613 stacking_order_changed_ = false; | 615 stacking_order_changed_ = false; |
614 update_rect_ = gfx::Rect(); | 616 update_rect_ = gfx::Rect(); |
| 617 overlay_update_rect_ = gfx::Rect(); |
615 needs_push_properties_ = false; | 618 needs_push_properties_ = false; |
616 num_dependents_need_push_properties_ = 0; | 619 num_dependents_need_push_properties_ = 0; |
617 } | 620 } |
618 | 621 |
619 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const { | 622 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const { |
620 if (!scroll_clip_layer_) | 623 if (!scroll_clip_layer_) |
621 return gfx::Vector2dF(); | 624 return gfx::Vector2dF(); |
622 | 625 |
623 gfx::Vector2dF delta_from_scroll = scroll_clip_layer_->bounds_delta(); | 626 gfx::Vector2dF delta_from_scroll = scroll_clip_layer_->bounds_delta(); |
624 | 627 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 } | 744 } |
742 | 745 |
743 const char* LayerImpl::LayerTypeAsString() const { | 746 const char* LayerImpl::LayerTypeAsString() const { |
744 return "cc::LayerImpl"; | 747 return "cc::LayerImpl"; |
745 } | 748 } |
746 | 749 |
747 void LayerImpl::ResetAllChangeTrackingForSubtree() { | 750 void LayerImpl::ResetAllChangeTrackingForSubtree() { |
748 layer_property_changed_ = false; | 751 layer_property_changed_ = false; |
749 | 752 |
750 update_rect_ = gfx::Rect(); | 753 update_rect_ = gfx::Rect(); |
| 754 overlay_update_rect_ = gfx::Rect(); |
751 damage_rect_ = gfx::RectF(); | 755 damage_rect_ = gfx::RectF(); |
752 | 756 |
753 if (render_surface_) | 757 if (render_surface_) |
754 render_surface_->ResetPropertyChangedFlag(); | 758 render_surface_->ResetPropertyChangedFlag(); |
755 | 759 |
756 if (mask_layer_) | 760 if (mask_layer_) |
757 mask_layer_->ResetAllChangeTrackingForSubtree(); | 761 mask_layer_->ResetAllChangeTrackingForSubtree(); |
758 | 762 |
759 if (replica_layer_) { | 763 if (replica_layer_) { |
760 // This also resets the replica mask, if it exists. | 764 // This also resets the replica mask, if it exists. |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 Animation* transform_animation = | 1077 Animation* transform_animation = |
1074 layer_animation_controller_->GetAnimation(Animation::TRANSFORM); | 1078 layer_animation_controller_->GetAnimation(Animation::TRANSFORM); |
1075 return transform_animation && transform_animation->is_impl_only(); | 1079 return transform_animation && transform_animation->is_impl_only(); |
1076 } | 1080 } |
1077 | 1081 |
1078 void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) { | 1082 void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) { |
1079 update_rect_ = update_rect; | 1083 update_rect_ = update_rect; |
1080 SetNeedsPushProperties(); | 1084 SetNeedsPushProperties(); |
1081 } | 1085 } |
1082 | 1086 |
| 1087 void LayerImpl::SetOverlayUpdateRect(const gfx::Rect& overlay_update_rect) { |
| 1088 overlay_update_rect_ = overlay_update_rect; |
| 1089 SetNeedsPushProperties(); |
| 1090 } |
| 1091 |
1083 void LayerImpl::AddDamageRect(const gfx::RectF& damage_rect) { | 1092 void LayerImpl::AddDamageRect(const gfx::RectF& damage_rect) { |
1084 damage_rect_ = gfx::UnionRects(damage_rect_, damage_rect); | 1093 damage_rect_ = gfx::UnionRects(damage_rect_, damage_rect); |
1085 } | 1094 } |
1086 | 1095 |
1087 void LayerImpl::SetContentBounds(const gfx::Size& content_bounds) { | 1096 void LayerImpl::SetContentBounds(const gfx::Size& content_bounds) { |
1088 if (this->content_bounds() == content_bounds) | 1097 if (this->content_bounds() == content_bounds) |
1089 return; | 1098 return; |
1090 | 1099 |
1091 draw_properties_.content_bounds = content_bounds; | 1100 draw_properties_.content_bounds = content_bounds; |
1092 NoteLayerPropertyChanged(); | 1101 NoteLayerPropertyChanged(); |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 gfx::Transform scaled_draw_transform = | 1613 gfx::Transform scaled_draw_transform = |
1605 draw_properties_.target_space_transform; | 1614 draw_properties_.target_space_transform; |
1606 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); | 1615 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); |
1607 gfx::Size scaled_content_bounds = | 1616 gfx::Size scaled_content_bounds = |
1608 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); | 1617 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); |
1609 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, | 1618 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, |
1610 gfx::Rect(scaled_content_bounds)); | 1619 gfx::Rect(scaled_content_bounds)); |
1611 } | 1620 } |
1612 | 1621 |
1613 } // namespace cc | 1622 } // namespace cc |
OLD | NEW |