| 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 PropertyAnimationState::PropertyAnimationState() {} | |
| 12 | |
| 13 PropertyAnimationState::PropertyAnimationState( | |
| 14 const PropertyAnimationState& rhs) | |
| 15 : currently_running(rhs.currently_running), | |
| 16 potentially_animating(rhs.potentially_animating) {} | |
| 17 | |
| 18 PropertyAnimationState::~PropertyAnimationState() {} | |
| 19 | |
| 20 bool PropertyAnimationState::operator==( | |
| 21 const PropertyAnimationState& other) const { | |
| 22 return currently_running == other.currently_running && | |
| 23 potentially_animating == other.potentially_animating; | |
| 24 } | |
| 25 | |
| 26 bool PropertyAnimationState::operator!=( | |
| 27 const PropertyAnimationState& other) const { | |
| 28 return !operator==(other); | |
| 29 } | |
| 30 | |
| 31 PropertyAnimationState& PropertyAnimationState::operator|=( | |
| 32 const PropertyAnimationState& other) { | |
| 33 currently_running |= other.currently_running; | |
| 34 potentially_animating |= other.potentially_animating; | |
| 35 | |
| 36 return *this; | |
| 37 } | |
| 38 | |
| 39 PropertyAnimationState& PropertyAnimationState::operator^=( | |
| 40 const PropertyAnimationState& other) { | |
| 41 currently_running ^= other.currently_running; | |
| 42 potentially_animating ^= other.potentially_animating; | |
| 43 | |
| 44 return *this; | |
| 45 } | |
| 46 | |
| 47 PropertyAnimationState& PropertyAnimationState::operator&=( | |
| 48 const PropertyAnimationState& other) { | |
| 49 currently_running &= other.currently_running; | |
| 50 potentially_animating &= other.potentially_animating; | |
| 51 | |
| 52 return *this; | |
| 53 } | |
| 54 | |
| 55 PropertyAnimationState operator^(const PropertyAnimationState& lhs, | |
| 56 const PropertyAnimationState& rhs) { | |
| 57 PropertyAnimationState result = lhs; | |
| 58 result ^= rhs; | |
| 59 return result; | |
| 60 } | |
| 61 | |
| 62 bool PropertyAnimationState::IsValid() const { | |
| 63 // currently_running must be a subset for potentially_animating. | |
| 64 // currently <= potentially i.e. potentially || !currently. | |
| 65 TargetProperties result = potentially_animating | ~currently_running; | |
| 66 return result.all(); | |
| 67 } | |
| 68 | |
| 69 void PropertyAnimationState::Clear() { | |
| 70 currently_running.reset(); | |
| 71 potentially_animating.reset(); | |
| 72 } | |
| 73 | |
| 74 } // namespace cc | |
| OLD | NEW |