Chromium Code Reviews| Index: cc/animation/layer_tree_mutation.h |
| diff --git a/cc/animation/layer_tree_mutation.h b/cc/animation/layer_tree_mutation.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9b745ae02843f168baaa9ddb4f4628ab3f51c696 |
| --- /dev/null |
| +++ b/cc/animation/layer_tree_mutation.h |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_ANIMATION_LAYER_TREE_MUTATION_H_ |
| +#define CC_ANIMATION_LAYER_TREE_MUTATION_H_ |
| + |
| +#include "base/containers/hash_tables.h" |
| +#include "cc/animation/mutable_properties.h" |
| +#include "third_party/skia/include/utils/SkMatrix44.h" |
| + |
| +namespace cc { |
| + |
| +struct LayerTreeMutation { |
|
esprehn
2016/01/06 19:48:37
class ? You have public: and all the state is priv
Ian Vollick
2016/01/08 03:01:53
Done.
|
| + public: |
| + void SetOpacity(float opacity) { |
| + mutated_flags_ |= kMutablePropertyOpacity; |
| + opacity_ = opacity; |
| + } |
| + void SetScrollLeft(float scroll_left) { |
| + mutated_flags_ |= kMutablePropertyScrollLeft; |
| + scroll_left_ = scroll_left; |
| + } |
| + void SetScrollTop(float scroll_top) { |
| + mutated_flags_ |= kMutablePropertyScrollTop; |
| + scroll_top_ = scroll_top; |
| + } |
| + void SetTransform(const SkMatrix44& transform) { |
| + mutated_flags_ |= kMutablePropertyTransform; |
| + transform_ = transform; |
| + } |
| + |
| + bool is_opacity_mutated() const { |
| + return !!(mutated_flags_ & kMutablePropertyOpacity); |
| + } |
| + bool is_scroll_left_mutated() const { |
| + return !!(mutated_flags_ & kMutablePropertyScrollLeft); |
| + } |
| + bool is_scroll_top_mutated() const { |
| + return !!(mutated_flags_ & kMutablePropertyScrollTop); |
| + } |
| + bool is_transform_mutated() const { |
| + return !!(mutated_flags_ & kMutablePropertyTransform); |
| + } |
| + |
| + float opacity() const { return opacity_; } |
| + float scroll_left() const { return scroll_left_; } |
| + float scroll_top() const { return scroll_top_; } |
| + SkMatrix44 transform() const { return transform_; } |
| + |
| + private: |
| + uint32_t mutated_flags_ = 0; |
| + float opacity_ = 0; |
| + float scroll_left_ = 0; |
| + float scroll_top_ = 0; |
| + SkMatrix44 transform_; |
| +}; |
| + |
| +typedef base::hash_map<uint64_t, LayerTreeMutation> LayerTreeMutationMap; |
|
esprehn
2016/01/06 19:48:37
note that LayerTreeMutation objects are pretty big
Ian Vollick
2016/01/08 03:01:53
That's true. You could have one of these for every
|
| + |
| +} // namespace cc |
| + |
| +#endif // CC_ANIMATION_LAYER_TREE_MUTATION_H_ |