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/location.h" | 9 #include "base/location.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 scoped_ptr<CopyOutputResult> result) { | 723 scoped_ptr<CopyOutputResult> result) { |
724 main_thread_task_runner->PostTask(FROM_HERE, | 724 main_thread_task_runner->PostTask(FROM_HERE, |
725 base::Bind(&RunCopyCallbackOnMainThread, | 725 base::Bind(&RunCopyCallbackOnMainThread, |
726 base::Passed(&request), | 726 base::Passed(&request), |
727 base::Passed(&result))); | 727 base::Passed(&result))); |
728 } | 728 } |
729 | 729 |
730 void Layer::PushPropertiesTo(LayerImpl* layer) { | 730 void Layer::PushPropertiesTo(LayerImpl* layer) { |
731 DCHECK(layer_tree_host_); | 731 DCHECK(layer_tree_host_); |
732 | 732 |
| 733 // If we did not SavePaintProperties() for the layer this frame, then push the |
| 734 // real property values, not the paint property values. |
| 735 bool use_paint_properties = paint_properties_.source_frame_number == |
| 736 layer_tree_host_->source_frame_number(); |
| 737 |
733 layer->SetAnchorPoint(anchor_point_); | 738 layer->SetAnchorPoint(anchor_point_); |
734 layer->SetAnchorPointZ(anchor_point_z_); | 739 layer->SetAnchorPointZ(anchor_point_z_); |
735 layer->SetBackgroundColor(background_color_); | 740 layer->SetBackgroundColor(background_color_); |
736 layer->SetBounds(paint_properties_.bounds); | 741 layer->SetBounds(use_paint_properties ? paint_properties_.bounds |
| 742 : bounds_); |
737 layer->SetContentBounds(content_bounds()); | 743 layer->SetContentBounds(content_bounds()); |
738 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 744 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
739 layer->SetDebugName(debug_name_); | 745 layer->SetDebugName(debug_name_); |
740 layer->SetCompositingReasons(compositing_reasons_); | 746 layer->SetCompositingReasons(compositing_reasons_); |
741 layer->SetDoubleSided(double_sided_); | 747 layer->SetDoubleSided(double_sided_); |
742 layer->SetDrawCheckerboardForMissingTiles( | 748 layer->SetDrawCheckerboardForMissingTiles( |
743 draw_checkerboard_for_missing_tiles_); | 749 draw_checkerboard_for_missing_tiles_); |
744 layer->SetForceRenderSurface(force_render_surface_); | 750 layer->SetForceRenderSurface(force_render_surface_); |
745 layer->SetDrawsContent(DrawsContent()); | 751 layer->SetDrawsContent(DrawsContent()); |
746 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 752 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 bool Layer::DrawsContent() const { | 844 bool Layer::DrawsContent() const { |
839 return is_drawable_; | 845 return is_drawable_; |
840 } | 846 } |
841 | 847 |
842 void Layer::SavePaintProperties() { | 848 void Layer::SavePaintProperties() { |
843 DCHECK(layer_tree_host_); | 849 DCHECK(layer_tree_host_); |
844 | 850 |
845 // TODO(reveman): Save all layer properties that we depend on not | 851 // TODO(reveman): Save all layer properties that we depend on not |
846 // changing until PushProperties() has been called. crbug.com/231016 | 852 // changing until PushProperties() has been called. crbug.com/231016 |
847 paint_properties_.bounds = bounds_; | 853 paint_properties_.bounds = bounds_; |
| 854 paint_properties_.source_frame_number = |
| 855 layer_tree_host_->source_frame_number(); |
848 } | 856 } |
849 | 857 |
850 bool Layer::Update(ResourceUpdateQueue* queue, | 858 bool Layer::Update(ResourceUpdateQueue* queue, |
851 const OcclusionTracker* occlusion) { | 859 const OcclusionTracker* occlusion) { |
852 DCHECK(layer_tree_host_); | 860 DCHECK(layer_tree_host_); |
| 861 DCHECK_EQ(layer_tree_host_->source_frame_number(), |
| 862 paint_properties_.source_frame_number) << |
| 863 "SavePaintProperties must be called for any layer that is painted."; |
853 return false; | 864 return false; |
854 } | 865 } |
855 | 866 |
856 bool Layer::NeedMoreUpdates() { | 867 bool Layer::NeedMoreUpdates() { |
857 return false; | 868 return false; |
858 } | 869 } |
859 | 870 |
860 void Layer::SetDebugName(const std::string& debug_name) { | 871 void Layer::SetDebugName(const std::string& debug_name) { |
861 debug_name_ = debug_name; | 872 debug_name_ = debug_name; |
862 SetNeedsCommit(); | 873 SetNeedsCommit(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 | 973 |
963 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 974 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
964 return layer_tree_host_->rendering_stats_instrumentation(); | 975 return layer_tree_host_->rendering_stats_instrumentation(); |
965 } | 976 } |
966 | 977 |
967 bool Layer::SupportsLCDText() const { | 978 bool Layer::SupportsLCDText() const { |
968 return false; | 979 return false; |
969 } | 980 } |
970 | 981 |
971 } // namespace cc | 982 } // namespace cc |
OLD | NEW |