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