Chromium Code Reviews| 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 #ifndef CompositorMutation_h | |
| 6 #define CompositorMutation_h | |
| 7 | |
| 8 #include "platform/graphics/CompositorMutableProperties.h" | |
| 9 #include "third_party/skia/include/utils/SkMatrix44.h" | |
| 10 | |
| 11 #include <map> | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 class CompositorMutation { | |
| 16 public: | |
| 17 void setOpacity(float opacity) | |
| 18 { | |
| 19 m_mutatedFlags |= CompositorMutablePropertyOpacity; | |
| 20 m_opacity = opacity; | |
| 21 } | |
| 22 void setScrollLeft(float scrollLeft) | |
| 23 { | |
| 24 m_mutatedFlags |= CompositorMutablePropertyScrollLeft; | |
| 25 m_scrollLeft = scrollLeft; | |
| 26 } | |
| 27 void setScrollTop(float scrollTop) | |
| 28 { | |
| 29 m_mutatedFlags |= CompositorMutablePropertyScrollTop; | |
| 30 m_scrollTop = scrollTop; | |
| 31 } | |
| 32 void setTransform(const SkMatrix44& transform) | |
| 33 { | |
| 34 m_mutatedFlags |= CompositorMutablePropertyTransform; | |
| 35 m_transform = transform; | |
| 36 } | |
| 37 | |
| 38 bool isOpacityMutated() const { return !!(m_mutatedFlags & CompositorMutable PropertyOpacity); } | |
|
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.
| |
| 39 bool isScrollLeftMutated() const { return !!(m_mutatedFlags & CompositorMuta blePropertyScrollLeft); } | |
| 40 bool isScrollTopMutated() const { return !!(m_mutatedFlags & CompositorMutab lePropertyScrollTop); } | |
| 41 bool isTransformMutated() const { return !!(m_mutatedFlags & CompositorMutab lePropertyTransform); } | |
| 42 | |
| 43 float opacity() const { return m_opacity; } | |
| 44 float scrollLeft() const { return m_scrollLeft; } | |
| 45 float scrollTop() const { return m_scrollTop; } | |
| 46 SkMatrix44 transform() const { return m_transform; } | |
| 47 | |
| 48 private: | |
| 49 uint32_t m_mutatedFlags = 0; | |
| 50 float m_opacity = 0; | |
| 51 float m_scrollLeft = 0; | |
| 52 float m_scrollTop = 0; | |
| 53 SkMatrix44 m_transform; | |
| 54 }; | |
| 55 | |
| 56 struct CompositorMutations { | |
| 57 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
| |
| 58 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.
| |
| 59 }; | |
| 60 | |
| 61 } // namespace blink | |
| 62 | |
| 63 #endif // CompositorMutation_h | |
| OLD | NEW |