OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "cc/animation/property_animation_state.h" | |
6 | |
7 #include "base/logging.h" | |
8 | |
9 namespace cc { | |
10 | |
11 bool PropertyAnimationState::operator==( | |
12 const PropertyAnimationState& other) const { | |
13 return currently_running_for_active_elements == | |
14 other.currently_running_for_active_elements && | |
15 currently_running_for_pending_elements == | |
16 other.currently_running_for_pending_elements && | |
17 potentially_animating_for_active_elements == | |
18 other.potentially_animating_for_active_elements && | |
19 potentially_animating_for_pending_elements == | |
20 other.potentially_animating_for_pending_elements; | |
21 } | |
22 | |
23 bool PropertyAnimationState::operator!=( | |
24 const PropertyAnimationState& other) const { | |
25 return !operator==(other); | |
26 } | |
27 | |
28 PropertyAnimationState& PropertyAnimationState::operator|=( | |
29 const PropertyAnimationState& other) { | |
30 currently_running_for_active_elements |= | |
31 other.currently_running_for_active_elements; | |
32 currently_running_for_pending_elements |= | |
33 other.currently_running_for_pending_elements; | |
34 potentially_animating_for_active_elements |= | |
35 other.potentially_animating_for_active_elements; | |
36 potentially_animating_for_pending_elements |= | |
37 other.potentially_animating_for_pending_elements; | |
38 | |
39 return *this; | |
40 } | |
41 | |
42 PropertyAnimationState& PropertyAnimationState::operator^=( | |
43 const PropertyAnimationState& other) { | |
44 currently_running_for_active_elements ^= | |
45 other.currently_running_for_active_elements; | |
46 currently_running_for_pending_elements ^= | |
47 other.currently_running_for_pending_elements; | |
48 potentially_animating_for_active_elements ^= | |
49 other.potentially_animating_for_active_elements; | |
50 potentially_animating_for_pending_elements ^= | |
51 other.potentially_animating_for_pending_elements; | |
52 | |
53 return *this; | |
54 } | |
55 | |
56 PropertyAnimationState operator^(const PropertyAnimationState& lhs, | |
57 const PropertyAnimationState& rhs) { | |
58 PropertyAnimationState result = lhs; | |
59 result ^= rhs; | |
60 return result; | |
61 } | |
62 | |
63 bool PropertyAnimationState::IsValid() const { | |
64 // currently_running must be a subset for potentially_animating. | |
65 // currently <= potentially. | |
66 DCHECK_LE(currently_running_for_active_elements, | |
67 potentially_animating_for_active_elements); | |
68 DCHECK_LE(currently_running_for_pending_elements, | |
69 potentially_animating_for_pending_elements); | |
70 return currently_running_for_active_elements <= | |
ajuma
2016/09/16 16:50:52
Code after a DCHECK should assume that the DCHECK
loyso (OOO)
2016/09/19 02:45:35
Done.
| |
71 potentially_animating_for_active_elements && | |
72 currently_running_for_pending_elements <= | |
73 potentially_animating_for_pending_elements; | |
74 } | |
75 | |
76 void PropertyAnimationState::Clear() { | |
77 currently_running_for_active_elements = false; | |
78 currently_running_for_pending_elements = false; | |
79 potentially_animating_for_active_elements = false; | |
80 potentially_animating_for_pending_elements = false; | |
81 } | |
82 | |
83 } // namespace cc | |
OLD | NEW |