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

Unified Diff: cc/animation/property_animation_state.cc

Issue 2357533002: CC Animation: Use std::bitset to update animation state. (Closed)
Patch Set: Reparent. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/property_animation_state.h ('k') | cc/animation/target_property.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/property_animation_state.cc
diff --git a/cc/animation/property_animation_state.cc b/cc/animation/property_animation_state.cc
index 7933001e1af7fef1cdbe8f0f16b2608e59530818..bda251c6b8f12d5aba7eb1acc4050f1447bd7d73 100644
--- a/cc/animation/property_animation_state.cc
+++ b/cc/animation/property_animation_state.cc
@@ -8,16 +8,19 @@
namespace cc {
+PropertyAnimationState::PropertyAnimationState() {}
+
+PropertyAnimationState::PropertyAnimationState(
+ const PropertyAnimationState& rhs)
+ : currently_running(rhs.currently_running),
+ potentially_animating(rhs.potentially_animating) {}
+
+PropertyAnimationState::~PropertyAnimationState() {}
+
bool PropertyAnimationState::operator==(
const PropertyAnimationState& other) const {
- return currently_running_for_active_elements ==
- other.currently_running_for_active_elements &&
- currently_running_for_pending_elements ==
- other.currently_running_for_pending_elements &&
- potentially_animating_for_active_elements ==
- other.potentially_animating_for_active_elements &&
- potentially_animating_for_pending_elements ==
- other.potentially_animating_for_pending_elements;
+ return currently_running == other.currently_running &&
+ potentially_animating == other.potentially_animating;
}
bool PropertyAnimationState::operator!=(
@@ -27,28 +30,24 @@ bool PropertyAnimationState::operator!=(
PropertyAnimationState& PropertyAnimationState::operator|=(
const PropertyAnimationState& other) {
- currently_running_for_active_elements |=
- other.currently_running_for_active_elements;
- currently_running_for_pending_elements |=
- other.currently_running_for_pending_elements;
- potentially_animating_for_active_elements |=
- other.potentially_animating_for_active_elements;
- potentially_animating_for_pending_elements |=
- other.potentially_animating_for_pending_elements;
+ currently_running |= other.currently_running;
+ potentially_animating |= other.potentially_animating;
return *this;
}
PropertyAnimationState& PropertyAnimationState::operator^=(
const PropertyAnimationState& other) {
- currently_running_for_active_elements ^=
- other.currently_running_for_active_elements;
- currently_running_for_pending_elements ^=
- other.currently_running_for_pending_elements;
- potentially_animating_for_active_elements ^=
- other.potentially_animating_for_active_elements;
- potentially_animating_for_pending_elements ^=
- other.potentially_animating_for_pending_elements;
+ currently_running ^= other.currently_running;
+ potentially_animating ^= other.potentially_animating;
+
+ return *this;
+}
+
+PropertyAnimationState& PropertyAnimationState::operator&=(
+ const PropertyAnimationState& other) {
+ currently_running &= other.currently_running;
+ potentially_animating &= other.potentially_animating;
return *this;
}
@@ -62,18 +61,14 @@ PropertyAnimationState operator^(const PropertyAnimationState& lhs,
bool PropertyAnimationState::IsValid() const {
// currently_running must be a subset for potentially_animating.
- // currently <= potentially.
- return currently_running_for_active_elements <=
- potentially_animating_for_active_elements &&
- currently_running_for_pending_elements <=
- potentially_animating_for_pending_elements;
+ // currently <= potentially i.e. potentially || !currently.
+ TargetProperties result = potentially_animating | ~currently_running;
+ return result.all();
}
void PropertyAnimationState::Clear() {
- currently_running_for_active_elements = false;
- currently_running_for_pending_elements = false;
- potentially_animating_for_active_elements = false;
- potentially_animating_for_pending_elements = false;
+ currently_running.reset();
+ potentially_animating.reset();
}
} // namespace cc
« no previous file with comments | « cc/animation/property_animation_state.h ('k') | cc/animation/target_property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698