| 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, | 719 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, |
| 720 scoped_ptr<CopyOutputRequest> request, | 720 scoped_ptr<CopyOutputRequest> request, |
| 721 scoped_ptr<CopyOutputResult> result) { | 721 scoped_ptr<CopyOutputResult> result) { |
| 722 main_thread_task_runner->PostTask(FROM_HERE, | 722 main_thread_task_runner->PostTask(FROM_HERE, |
| 723 base::Bind(&RunCopyCallbackOnMainThread, | 723 base::Bind(&RunCopyCallbackOnMainThread, |
| 724 base::Passed(&request), | 724 base::Passed(&request), |
| 725 base::Passed(&result))); | 725 base::Passed(&result))); |
| 726 } | 726 } |
| 727 | 727 |
| 728 void Layer::PushPropertiesTo(LayerImpl* layer) { | 728 void Layer::PushPropertiesTo(LayerImpl* layer) { |
| 729 // If we did not SavePaintProperties() for the layer this frame, then push the |
| 730 // real property values, not the paint property values. |
| 731 bool use_paint_properties = paint_properties_.source_frame_number == |
| 732 layer_tree_host_->source_frame_number(); |
| 733 |
| 729 layer->SetAnchorPoint(anchor_point_); | 734 layer->SetAnchorPoint(anchor_point_); |
| 730 layer->SetAnchorPointZ(anchor_point_z_); | 735 layer->SetAnchorPointZ(anchor_point_z_); |
| 731 layer->SetBackgroundColor(background_color_); | 736 layer->SetBackgroundColor(background_color_); |
| 732 layer->SetBounds(paint_properties_.bounds); | 737 layer->SetBounds(use_paint_properties ? paint_properties_.bounds |
| 738 : bounds_); |
| 733 layer->SetContentBounds(content_bounds()); | 739 layer->SetContentBounds(content_bounds()); |
| 734 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 740 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
| 735 layer->SetDebugName(debug_name_); | 741 layer->SetDebugName(debug_name_); |
| 736 layer->SetCompositingReasons(compositing_reasons_); | 742 layer->SetCompositingReasons(compositing_reasons_); |
| 737 layer->SetDoubleSided(double_sided_); | 743 layer->SetDoubleSided(double_sided_); |
| 738 layer->SetDrawCheckerboardForMissingTiles( | 744 layer->SetDrawCheckerboardForMissingTiles( |
| 739 draw_checkerboard_for_missing_tiles_); | 745 draw_checkerboard_for_missing_tiles_); |
| 740 layer->SetForceRenderSurface(force_render_surface_); | 746 layer->SetForceRenderSurface(force_render_surface_); |
| 741 layer->SetDrawsContent(DrawsContent()); | 747 layer->SetDrawsContent(DrawsContent()); |
| 742 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 748 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 } | 838 } |
| 833 | 839 |
| 834 bool Layer::DrawsContent() const { | 840 bool Layer::DrawsContent() const { |
| 835 return is_drawable_; | 841 return is_drawable_; |
| 836 } | 842 } |
| 837 | 843 |
| 838 void Layer::SavePaintProperties() { | 844 void Layer::SavePaintProperties() { |
| 839 // TODO(reveman): Save all layer properties that we depend on not | 845 // TODO(reveman): Save all layer properties that we depend on not |
| 840 // changing until PushProperties() has been called. crbug.com/231016 | 846 // changing until PushProperties() has been called. crbug.com/231016 |
| 841 paint_properties_.bounds = bounds_; | 847 paint_properties_.bounds = bounds_; |
| 848 paint_properties_.source_frame_number = |
| 849 layer_tree_host_->source_frame_number(); |
| 842 } | 850 } |
| 843 | 851 |
| 844 bool Layer::Update(ResourceUpdateQueue* queue, | 852 bool Layer::Update(ResourceUpdateQueue* queue, |
| 845 const OcclusionTracker* occlusion) { | 853 const OcclusionTracker* occlusion) { |
| 854 DCHECK_EQ(layer_tree_host_->source_frame_number(), |
| 855 paint_properties_.source_frame_number); |
| 846 return false; | 856 return false; |
| 847 } | 857 } |
| 848 | 858 |
| 849 bool Layer::NeedMoreUpdates() { | 859 bool Layer::NeedMoreUpdates() { |
| 850 return false; | 860 return false; |
| 851 } | 861 } |
| 852 | 862 |
| 853 void Layer::SetDebugName(const std::string& debug_name) { | 863 void Layer::SetDebugName(const std::string& debug_name) { |
| 854 debug_name_ = debug_name; | 864 debug_name_ = debug_name; |
| 855 SetNeedsCommit(); | 865 SetNeedsCommit(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 | 965 |
| 956 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 966 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
| 957 return layer_tree_host_->rendering_stats_instrumentation(); | 967 return layer_tree_host_->rendering_stats_instrumentation(); |
| 958 } | 968 } |
| 959 | 969 |
| 960 bool Layer::SupportsLCDText() const { | 970 bool Layer::SupportsLCDText() const { |
| 961 return false; | 971 return false; |
| 962 } | 972 } |
| 963 | 973 |
| 964 } // namespace cc | 974 } // namespace cc |
| OLD | NEW |