| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 float maximum_animation_contents_scale, | 925 float maximum_animation_contents_scale, |
| 926 float page_scale_factor, | 926 float page_scale_factor, |
| 927 float device_scale_factor) { | 927 float device_scale_factor) { |
| 928 layer->draw_properties().ideal_contents_scale = ideal_contents_scale; | 928 layer->draw_properties().ideal_contents_scale = ideal_contents_scale; |
| 929 layer->draw_properties().maximum_animation_contents_scale = | 929 layer->draw_properties().maximum_animation_contents_scale = |
| 930 maximum_animation_contents_scale; | 930 maximum_animation_contents_scale; |
| 931 layer->draw_properties().page_scale_factor = page_scale_factor; | 931 layer->draw_properties().page_scale_factor = page_scale_factor; |
| 932 layer->draw_properties().device_scale_factor = device_scale_factor; | 932 layer->draw_properties().device_scale_factor = device_scale_factor; |
| 933 } | 933 } |
| 934 | 934 |
| 935 template <typename LayerType> | |
| 936 static inline void CalculateContentsScale( | 935 static inline void CalculateContentsScale( |
| 937 LayerType* layer, | 936 LayerImpl* layer, |
| 938 float contents_scale, | 937 float contents_scale, |
| 939 float device_scale_factor, | 938 float device_scale_factor, |
| 940 float page_scale_factor, | 939 float page_scale_factor, |
| 940 float maximum_animation_contents_scale, |
| 941 bool animating_transform_to_screen) { |
| 942 // LayerImpl has all of its content scales and bounds pushed from the Main |
| 943 // thread during commit and just uses those values as-is. |
| 944 } |
| 945 |
| 946 static inline void CalculateContentsScale( |
| 947 Layer* layer, |
| 948 float contents_scale, |
| 949 float device_scale_factor, |
| 950 float page_scale_factor, |
| 941 float maximum_animation_contents_scale, | 951 float maximum_animation_contents_scale, |
| 942 bool animating_transform_to_screen) { | 952 bool animating_transform_to_screen) { |
| 943 layer->CalculateContentsScale(contents_scale, | 953 layer->CalculateContentsScale(contents_scale, |
| 944 device_scale_factor, | 954 device_scale_factor, |
| 945 page_scale_factor, | 955 page_scale_factor, |
| 946 maximum_animation_contents_scale, | 956 maximum_animation_contents_scale, |
| 947 animating_transform_to_screen, | 957 animating_transform_to_screen, |
| 948 &layer->draw_properties().contents_scale_x, | 958 &layer->draw_properties().contents_scale_x, |
| 949 &layer->draw_properties().contents_scale_y, | 959 &layer->draw_properties().contents_scale_y, |
| 950 &layer->draw_properties().content_bounds); | 960 &layer->draw_properties().content_bounds); |
| 951 | 961 |
| 952 LayerType* mask_layer = layer->mask_layer(); | 962 Layer* mask_layer = layer->mask_layer(); |
| 953 if (mask_layer) { | 963 if (mask_layer) { |
| 954 mask_layer->CalculateContentsScale( | 964 mask_layer->CalculateContentsScale( |
| 955 contents_scale, | 965 contents_scale, |
| 956 device_scale_factor, | 966 device_scale_factor, |
| 957 page_scale_factor, | 967 page_scale_factor, |
| 958 maximum_animation_contents_scale, | 968 maximum_animation_contents_scale, |
| 959 animating_transform_to_screen, | 969 animating_transform_to_screen, |
| 960 &mask_layer->draw_properties().contents_scale_x, | 970 &mask_layer->draw_properties().contents_scale_x, |
| 961 &mask_layer->draw_properties().contents_scale_y, | 971 &mask_layer->draw_properties().contents_scale_y, |
| 962 &mask_layer->draw_properties().content_bounds); | 972 &mask_layer->draw_properties().content_bounds); |
| 963 } | 973 } |
| 964 | 974 |
| 965 LayerType* replica_mask_layer = | 975 Layer* replica_mask_layer = |
| 966 layer->replica_layer() ? layer->replica_layer()->mask_layer() : NULL; | 976 layer->replica_layer() ? layer->replica_layer()->mask_layer() : NULL; |
| 967 if (replica_mask_layer) { | 977 if (replica_mask_layer) { |
| 968 replica_mask_layer->CalculateContentsScale( | 978 replica_mask_layer->CalculateContentsScale( |
| 969 contents_scale, | 979 contents_scale, |
| 970 device_scale_factor, | 980 device_scale_factor, |
| 971 page_scale_factor, | 981 page_scale_factor, |
| 972 maximum_animation_contents_scale, | 982 maximum_animation_contents_scale, |
| 973 animating_transform_to_screen, | 983 animating_transform_to_screen, |
| 974 &replica_mask_layer->draw_properties().contents_scale_x, | 984 &replica_mask_layer->draw_properties().contents_scale_x, |
| 975 &replica_mask_layer->draw_properties().contents_scale_y, | 985 &replica_mask_layer->draw_properties().contents_scale_y, |
| (...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2475 inputs->current_render_surface_layer_list_id); | 2485 inputs->current_render_surface_layer_list_id); |
| 2476 | 2486 |
| 2477 // The dummy layer list should not have been used. | 2487 // The dummy layer list should not have been used. |
| 2478 DCHECK_EQ(0u, dummy_layer_list.size()); | 2488 DCHECK_EQ(0u, dummy_layer_list.size()); |
| 2479 // A root layer render_surface should always exist after | 2489 // A root layer render_surface should always exist after |
| 2480 // CalculateDrawProperties. | 2490 // CalculateDrawProperties. |
| 2481 DCHECK(inputs->root_layer->render_surface()); | 2491 DCHECK(inputs->root_layer->render_surface()); |
| 2482 } | 2492 } |
| 2483 | 2493 |
| 2484 } // namespace cc | 2494 } // namespace cc |
| OLD | NEW |