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

Side by Side Diff: cc/animation/property_animation_state.cc

Issue 2349643003: CC Animation: Extract PropertyAnimationState as a non-nested struct. (Closed)
Patch Set: Reparent to master to make it independent. Created 4 years, 2 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
« no previous file with comments | « cc/animation/property_animation_state.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 return currently_running_for_active_elements <=
67 potentially_animating_for_active_elements &&
68 currently_running_for_pending_elements <=
69 potentially_animating_for_pending_elements;
70 }
71
72 void PropertyAnimationState::Clear() {
73 currently_running_for_active_elements = false;
74 currently_running_for_pending_elements = false;
75 potentially_animating_for_active_elements = false;
76 potentially_animating_for_pending_elements = false;
77 }
78
79 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/property_animation_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698