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 #include "wtf/HashMap.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class CompositorMutation { | |
15 public: | |
16 void setOpacity(float opacity) | |
17 { | |
18 m_mutatedFlags |= CompositorMutablePropertyOpacity; | |
19 m_opacity = opacity; | |
20 } | |
21 void setScrollLeft(float scrollLeft) | |
22 { | |
23 m_mutatedFlags |= CompositorMutablePropertyScrollLeft; | |
24 m_scrollLeft = scrollLeft; | |
25 } | |
26 void setScrollTop(float scrollTop) | |
27 { | |
28 m_mutatedFlags |= CompositorMutablePropertyScrollTop; | |
29 m_scrollTop = scrollTop; | |
30 } | |
31 void setTransform(const SkMatrix44& transform) | |
32 { | |
33 m_mutatedFlags |= CompositorMutablePropertyTransform; | |
34 m_transform = transform; | |
35 } | |
36 | |
37 bool isOpacityMutated() const { return m_mutatedFlags & CompositorMutablePro pertyOpacity; } | |
38 bool isScrollLeftMutated() const { return m_mutatedFlags & CompositorMutable PropertyScrollLeft; } | |
39 bool isScrollTopMutated() const { return m_mutatedFlags & CompositorMutableP ropertyScrollTop; } | |
40 bool isTransformMutated() const { return m_mutatedFlags & CompositorMutableP ropertyTransform; } | |
41 | |
42 float opacity() const { return m_opacity; } | |
43 float scrollLeft() const { return m_scrollLeft; } | |
44 float scrollTop() const { return m_scrollTop; } | |
45 SkMatrix44 transform() const { return m_transform; } | |
46 | |
47 private: | |
48 uint32_t m_mutatedFlags = 0; | |
49 float m_opacity = 0; | |
50 float m_scrollLeft = 0; | |
51 float m_scrollTop = 0; | |
52 SkMatrix44 m_transform; | |
53 }; | |
54 | |
55 struct CompositorMutations { | |
56 ~CompositorMutations() {} | |
jbroman
2016/01/18 21:40:26
super-nit: you don't need to write the implicit de
Ian Vollick
2016/01/18 21:56:40
Done.
| |
57 HashMap<uint64_t, CompositorMutation> map; | |
58 }; | |
59 | |
60 } // namespace blink | |
61 | |
62 #endif // CompositorMutation_h | |
OLD | NEW |