Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/CompositorMutation.h |
| diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutation.h b/third_party/WebKit/Source/platform/graphics/CompositorMutation.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f8b32a9008ccc24348798b69598e1811b384ecc3 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutation.h |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2016 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 CompositorMutation_h |
| +#define CompositorMutation_h |
| + |
| +#include "platform/graphics/CompositorMutableProperties.h" |
| +#include "third_party/skia/include/utils/SkMatrix44.h" |
| + |
| +#include <map> |
| + |
| +namespace blink { |
| + |
| +class CompositorMutation { |
| +public: |
| + void setOpacity(float opacity) |
| + { |
| + m_mutatedFlags |= CompositorMutablePropertyOpacity; |
| + m_opacity = opacity; |
| + } |
| + void setScrollLeft(float scrollLeft) |
| + { |
| + m_mutatedFlags |= CompositorMutablePropertyScrollLeft; |
| + m_scrollLeft = scrollLeft; |
| + } |
| + void setScrollTop(float scrollTop) |
| + { |
| + m_mutatedFlags |= CompositorMutablePropertyScrollTop; |
| + m_scrollTop = scrollTop; |
| + } |
| + void setTransform(const SkMatrix44& transform) |
| + { |
| + m_mutatedFlags |= CompositorMutablePropertyTransform; |
| + m_transform = transform; |
| + } |
| + |
| + bool isOpacityMutated() const { return !!(m_mutatedFlags & CompositorMutablePropertyOpacity); } |
|
jbroman
2016/01/18 19:07:22
nit: In Blink, I've seen "return foo & mask;" with
Ian Vollick
2016/01/18 21:25:04
Done.
|
| + bool isScrollLeftMutated() const { return !!(m_mutatedFlags & CompositorMutablePropertyScrollLeft); } |
| + bool isScrollTopMutated() const { return !!(m_mutatedFlags & CompositorMutablePropertyScrollTop); } |
| + bool isTransformMutated() const { return !!(m_mutatedFlags & CompositorMutablePropertyTransform); } |
| + |
| + float opacity() const { return m_opacity; } |
| + float scrollLeft() const { return m_scrollLeft; } |
| + float scrollTop() const { return m_scrollTop; } |
| + SkMatrix44 transform() const { return m_transform; } |
| + |
| +private: |
| + uint32_t m_mutatedFlags = 0; |
| + float m_opacity = 0; |
| + float m_scrollLeft = 0; |
| + float m_scrollTop = 0; |
| + SkMatrix44 m_transform; |
| +}; |
| + |
| +struct CompositorMutations { |
| + virtual ~CompositorMutations() {} |
|
jbroman
2016/01/18 19:07:22
Why the virtual destructor? This doesn't seem to h
Ian Vollick
2016/01/18 21:25:04
The virtual won't be needed until later in the ups
|
| + std::map<uint64_t, CompositorMutation> map; |
|
jbroman
2016/01/18 19:07:22
nit: In Blink, we'd probably default to HashMap<>,
Ian Vollick
2016/01/18 21:25:04
Done.
|
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // CompositorMutation_h |