Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: cc/trees/layer_tree_host_common.cc

Issue 336793003: cc: Move CalculateContentsScale from LayerImpl to LayerTreeHostCommon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 layer->draw_properties().contents_scale_x = layer->contents_scale_x();
danakj 2014/06/13 15:00:27 This is just setting x=x; which we don't need to d
sohanjg 2014/06/13 15:36:06 Done.
943 layer->draw_properties().contents_scale_y = layer->contents_scale_y();
944 layer->draw_properties().content_bounds = layer->content_bounds();
945
946 LayerImpl* mask_layer = layer->mask_layer();
947 if (mask_layer) {
948 mask_layer->draw_properties().contents_scale_x =
949 mask_layer->contents_scale_x();
950 mask_layer->draw_properties().contents_scale_y =
951 mask_layer->contents_scale_y();
952 mask_layer->draw_properties().content_bounds = mask_layer->content_bounds();
953 }
954
955 LayerImpl* replica_mask_layer =
956 layer->replica_layer() ? layer->replica_layer()->mask_layer() : NULL;
957 if (replica_mask_layer) {
958 replica_mask_layer->draw_properties().contents_scale_x =
959 replica_mask_layer->contents_scale_x();
960 replica_mask_layer->draw_properties().contents_scale_y =
961 replica_mask_layer->contents_scale_y();
962 replica_mask_layer->draw_properties().content_bounds =
963 replica_mask_layer->content_bounds();
964 }
965 }
966 static inline void CalculateContentsScale(
danakj 2014/06/13 15:00:27 blank line between methods
sohanjg 2014/06/13 15:36:06 Done.
967 Layer* layer,
968 float contents_scale,
969 float device_scale_factor,
970 float page_scale_factor,
941 float maximum_animation_contents_scale, 971 float maximum_animation_contents_scale,
942 bool animating_transform_to_screen) { 972 bool animating_transform_to_screen) {
943 layer->CalculateContentsScale(contents_scale, 973 layer->CalculateContentsScale(contents_scale,
944 device_scale_factor, 974 device_scale_factor,
945 page_scale_factor, 975 page_scale_factor,
946 maximum_animation_contents_scale, 976 maximum_animation_contents_scale,
947 animating_transform_to_screen, 977 animating_transform_to_screen,
948 &layer->draw_properties().contents_scale_x, 978 &layer->draw_properties().contents_scale_x,
949 &layer->draw_properties().contents_scale_y, 979 &layer->draw_properties().contents_scale_y,
950 &layer->draw_properties().content_bounds); 980 &layer->draw_properties().content_bounds);
951 981
952 LayerType* mask_layer = layer->mask_layer(); 982 Layer* mask_layer = layer->mask_layer();
953 if (mask_layer) { 983 if (mask_layer) {
954 mask_layer->CalculateContentsScale( 984 mask_layer->CalculateContentsScale(
955 contents_scale, 985 contents_scale,
956 device_scale_factor, 986 device_scale_factor,
957 page_scale_factor, 987 page_scale_factor,
958 maximum_animation_contents_scale, 988 maximum_animation_contents_scale,
959 animating_transform_to_screen, 989 animating_transform_to_screen,
960 &mask_layer->draw_properties().contents_scale_x, 990 &mask_layer->draw_properties().contents_scale_x,
961 &mask_layer->draw_properties().contents_scale_y, 991 &mask_layer->draw_properties().contents_scale_y,
962 &mask_layer->draw_properties().content_bounds); 992 &mask_layer->draw_properties().content_bounds);
963 } 993 }
964 994
965 LayerType* replica_mask_layer = 995 Layer* replica_mask_layer =
966 layer->replica_layer() ? layer->replica_layer()->mask_layer() : NULL; 996 layer->replica_layer() ? layer->replica_layer()->mask_layer() : NULL;
967 if (replica_mask_layer) { 997 if (replica_mask_layer) {
968 replica_mask_layer->CalculateContentsScale( 998 replica_mask_layer->CalculateContentsScale(
969 contents_scale, 999 contents_scale,
970 device_scale_factor, 1000 device_scale_factor,
971 page_scale_factor, 1001 page_scale_factor,
972 maximum_animation_contents_scale, 1002 maximum_animation_contents_scale,
973 animating_transform_to_screen, 1003 animating_transform_to_screen,
974 &replica_mask_layer->draw_properties().contents_scale_x, 1004 &replica_mask_layer->draw_properties().contents_scale_x,
975 &replica_mask_layer->draw_properties().contents_scale_y, 1005 &replica_mask_layer->draw_properties().contents_scale_y,
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 inputs->current_render_surface_layer_list_id); 2505 inputs->current_render_surface_layer_list_id);
2476 2506
2477 // The dummy layer list should not have been used. 2507 // The dummy layer list should not have been used.
2478 DCHECK_EQ(0u, dummy_layer_list.size()); 2508 DCHECK_EQ(0u, dummy_layer_list.size());
2479 // A root layer render_surface should always exist after 2509 // A root layer render_surface should always exist after
2480 // CalculateDrawProperties. 2510 // CalculateDrawProperties.
2481 DCHECK(inputs->root_layer->render_surface()); 2511 DCHECK(inputs->root_layer->render_surface());
2482 } 2512 }
2483 2513
2484 } // namespace cc 2514 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698