Chromium Code Reviews| 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 <map> | |
| 9 | |
| 10 #include "cc/animation/mutable_properties.h" | |
| 11 #include "third_party/skia/include/utils/SkMatrix44.h" | |
| 12 | |
| 13 namespace cc { | |
| 14 | |
| 15 struct LayerTreeMutation { | |
| 16 public: | |
| 17 void SetOpacity(float opacity) { | |
| 18 mutated_flags_ |= kMutablePropertyOpacity; | |
| 19 opacity_ = opacity; | |
| 20 } | |
| 21 void SetScrollLeft(float scroll_left) { | |
| 22 mutated_flags_ |= kMutablePropertyScrollLeft; | |
| 23 scroll_left_ = scroll_left; | |
| 24 } | |
| 25 void SetScrollTop(float scroll_top) { | |
| 26 mutated_flags_ |= kMutablePropertyScrollTop; | |
| 27 scroll_top_ = scroll_top; | |
| 28 } | |
| 29 void SetTransform(const SkMatrix44& transform) { | |
| 30 mutated_flags_ |= kMutablePropertyTransform; | |
| 31 transform_ = transform; | |
| 32 } | |
| 33 | |
| 34 bool is_opacity_mutated() const { | |
| 35 return !!(mutated_flags_ & kMutablePropertyOpacity); | |
| 36 } | |
| 37 bool is_scroll_left_mutated() const { | |
| 38 return !!(mutated_flags_ & kMutablePropertyScrollLeft); | |
| 39 } | |
| 40 bool is_scroll_top_mutated() const { | |
| 41 return !!(mutated_flags_ & kMutablePropertyScrollTop); | |
| 42 } | |
| 43 bool is_transform_mutated() const { | |
| 44 return !!(mutated_flags_ & kMutablePropertyTransform); | |
| 45 } | |
| 46 | |
| 47 float opacity() const { return opacity_; } | |
| 48 float scroll_left() const { return scroll_left_; } | |
| 49 float scroll_top() const { return scroll_top_; } | |
| 50 SkMatrix44 transform() const { return transform_; } | |
| 51 | |
| 52 private: | |
| 53 uint32_t mutated_flags_ = 0; | |
| 54 float opacity_ = 0; | |
| 55 float scroll_left_ = 0; | |
| 56 float scroll_top_ = 0; | |
| 57 SkMatrix44 transform_; | |
| 58 }; | |
| 59 | |
| 60 typedef std::map<uint64_t, LayerTreeMutation> LayerTreeMutationMap; | |
|
esprehn
2015/11/16 20:01:03
why not hash map? Is the ordering actually importa
Ian Vollick
2015/11/18 17:20:33
Done.
| |
| 61 | |
| 62 } // namespace cc | |
| 63 | |
| 64 #endif // CC_ANIMATION_LAYER_TREE_MUTATION_H_ | |
| OLD | NEW |