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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 void Layer::OnTransformAnimated(const gfx::Transform& transform) { | 1333 void Layer::OnTransformAnimated(const gfx::Transform& transform) { |
1334 inputs_.transform = transform; | 1334 inputs_.transform = transform; |
1335 } | 1335 } |
1336 | 1336 |
1337 void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) { | 1337 void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) { |
1338 // Do nothing. Scroll deltas will be sent from the compositor thread back | 1338 // Do nothing. Scroll deltas will be sent from the compositor thread back |
1339 // to the main thread in the same manner as during non-animated | 1339 // to the main thread in the same manner as during non-animated |
1340 // compositor-driven scrolling. | 1340 // compositor-driven scrolling. |
1341 } | 1341 } |
1342 | 1342 |
1343 void Layer::OnIsAnimatingChanged(const PropertyAnimationState& mask, | |
1344 const PropertyAnimationState& state) { | |
1345 DCHECK(layer_tree_host_); | |
1346 PropertyTrees* property_trees = layer_tree_host_->property_trees(); | |
1347 | |
1348 for (int property = TargetProperty::FIRST_TARGET_PROPERTY; | |
1349 property <= TargetProperty::LAST_TARGET_PROPERTY; ++property) { | |
1350 if (!mask.currently_running[property] && | |
1351 !mask.potentially_animating[property]) | |
1352 continue; | |
1353 | |
1354 switch (property) { | |
1355 case TargetProperty::TRANSFORM: | |
1356 if (TransformNode* transform_node = | |
1357 property_trees->transform_tree.UpdateNodeFromOwningLayerId( | |
1358 id())) { | |
1359 DCHECK_EQ(transform_node->id, transform_tree_index()); | |
1360 if (mask.currently_running[property]) | |
1361 transform_node->is_currently_animating = | |
1362 state.currently_running[property]; | |
1363 if (mask.potentially_animating[property]) { | |
1364 transform_node->has_potential_animation = | |
1365 state.potentially_animating[property]; | |
1366 if (state.potentially_animating[property]) { | |
1367 transform_node->has_only_translation_animations = | |
1368 HasOnlyTranslationTransforms(); | |
1369 } else { | |
1370 transform_node->has_only_translation_animations = true; | |
1371 } | |
1372 property_trees->transform_tree.set_needs_update(true); | |
1373 } | |
1374 } else { | |
1375 DCHECK(property_trees->needs_rebuild) | |
1376 << "Attempting to animate non existent transform node"; | |
1377 } | |
1378 break; | |
1379 case TargetProperty::OPACITY: | |
1380 if (EffectNode* effect_node = | |
1381 property_trees->effect_tree.UpdateNodeFromOwningLayerId(id())) { | |
1382 if (mask.currently_running[property]) | |
1383 effect_node->is_currently_animating_opacity = | |
1384 state.currently_running[property]; | |
1385 if (mask.potentially_animating[property]) { | |
1386 effect_node->has_potential_opacity_animation = | |
1387 state.potentially_animating[property] || | |
1388 OpacityCanAnimateOnImplThread(); | |
1389 property_trees->effect_tree.set_needs_update(true); | |
1390 } | |
1391 } else { | |
1392 DCHECK(property_trees->needs_rebuild) | |
1393 << "Attempting to animate opacity on non existent effect node"; | |
1394 } | |
1395 break; | |
1396 case TargetProperty::FILTER: | |
1397 if (EffectNode* effect_node = | |
1398 property_trees->effect_tree.UpdateNodeFromOwningLayerId(id())) { | |
1399 if (mask.currently_running[property]) | |
1400 effect_node->is_currently_animating_filter = | |
1401 state.currently_running[property]; | |
1402 if (mask.potentially_animating[property]) | |
1403 effect_node->has_potential_filter_animation = | |
1404 state.potentially_animating[property]; | |
1405 } else { | |
1406 DCHECK(property_trees->needs_rebuild) | |
1407 << "Attempting to animate filter on non existent effect node"; | |
1408 } | |
1409 break; | |
1410 default: | |
1411 break; | |
1412 } | |
1413 } | |
1414 } | |
1415 | |
1416 bool Layer::HasTickingAnimationForTesting() const { | 1343 bool Layer::HasTickingAnimationForTesting() const { |
1417 return layer_tree_host_ | 1344 return layer_tree_host_ |
1418 ? GetMutatorHost()->HasTickingAnimationForTesting(element_id()) | 1345 ? GetMutatorHost()->HasTickingAnimationForTesting(element_id()) |
1419 : false; | 1346 : false; |
1420 } | 1347 } |
1421 | 1348 |
1422 void Layer::SetHasWillChangeTransformHint(bool has_will_change) { | 1349 void Layer::SetHasWillChangeTransformHint(bool has_will_change) { |
1423 if (inputs_.has_will_change_transform_hint == has_will_change) | 1350 if (inputs_.has_will_change_transform_hint == has_will_change) |
1424 return; | 1351 return; |
1425 inputs_.has_will_change_transform_hint = has_will_change; | 1352 inputs_.has_will_change_transform_hint = has_will_change; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 ->num_copy_requests_in_subtree; | 1439 ->num_copy_requests_in_subtree; |
1513 } | 1440 } |
1514 | 1441 |
1515 gfx::Transform Layer::screen_space_transform() const { | 1442 gfx::Transform Layer::screen_space_transform() const { |
1516 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1443 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
1517 return draw_property_utils::ScreenSpaceTransform( | 1444 return draw_property_utils::ScreenSpaceTransform( |
1518 this, layer_tree_host_->property_trees()->transform_tree); | 1445 this, layer_tree_host_->property_trees()->transform_tree); |
1519 } | 1446 } |
1520 | 1447 |
1521 } // namespace cc | 1448 } // namespace cc |
OLD | NEW |