| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 #ifndef CC_ANIMATION_LAYER_TREE_MUTATION_H_ | |
| 6 #define CC_ANIMATION_LAYER_TREE_MUTATION_H_ | |
| 7 | |
| 8 #include "base/containers/hash_tables.h" | |
| 9 #include "cc/animation/mutable_properties.h" | |
| 10 #include "third_party/skia/include/utils/SkMatrix44.h" | |
| 11 | |
| 12 namespace cc { | |
| 13 | |
| 14 class LayerTreeMutation { | |
| 15 public: | |
| 16 void SetOpacity(float opacity) { | |
| 17 mutated_flags_ |= kMutablePropertyOpacity; | |
| 18 opacity_ = opacity; | |
| 19 } | |
| 20 void SetScrollLeft(float scroll_left) { | |
| 21 mutated_flags_ |= kMutablePropertyScrollLeft; | |
| 22 scroll_left_ = scroll_left; | |
| 23 } | |
| 24 void SetScrollTop(float scroll_top) { | |
| 25 mutated_flags_ |= kMutablePropertyScrollTop; | |
| 26 scroll_top_ = scroll_top; | |
| 27 } | |
| 28 void SetTransform(const SkMatrix44& transform) { | |
| 29 mutated_flags_ |= kMutablePropertyTransform; | |
| 30 transform_ = transform; | |
| 31 } | |
| 32 | |
| 33 bool is_opacity_mutated() const { | |
| 34 return !!(mutated_flags_ & kMutablePropertyOpacity); | |
| 35 } | |
| 36 bool is_scroll_left_mutated() const { | |
| 37 return !!(mutated_flags_ & kMutablePropertyScrollLeft); | |
| 38 } | |
| 39 bool is_scroll_top_mutated() const { | |
| 40 return !!(mutated_flags_ & kMutablePropertyScrollTop); | |
| 41 } | |
| 42 bool is_transform_mutated() const { | |
| 43 return !!(mutated_flags_ & kMutablePropertyTransform); | |
| 44 } | |
| 45 | |
| 46 float opacity() const { return opacity_; } | |
| 47 float scroll_left() const { return scroll_left_; } | |
| 48 float scroll_top() const { return scroll_top_; } | |
| 49 SkMatrix44 transform() const { return transform_; } | |
| 50 | |
| 51 private: | |
| 52 uint32_t mutated_flags_ = 0; | |
| 53 float opacity_ = 0; | |
| 54 float scroll_left_ = 0; | |
| 55 float scroll_top_ = 0; | |
| 56 SkMatrix44 transform_; | |
| 57 }; | |
| 58 | |
| 59 typedef base::hash_map<uint64_t, LayerTreeMutation> LayerTreeMutationMap; | |
| 60 | |
| 61 } // namespace cc | |
| 62 | |
| 63 #endif // CC_ANIMATION_LAYER_TREE_MUTATION_H_ | |
| OLD | NEW |