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