 Chromium Code Reviews
 Chromium Code Reviews Issue 1599673002:
  compositor-worker: Remove code from cc_blink  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1599673002:
  compositor-worker: Remove code from cc_blink  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 #include "platform/graphics/CompositorMutableState.h" | |
| 6 | |
| 7 #include "cc/animation/mutable_properties.h" | |
| 8 #include "cc/layers/layer_impl.h" | |
| 9 #include "cc/trees/layer_tree_impl.h" | |
| 10 #include "platform/graphics/CompositorMutableProperties.h" | |
| 11 #include "platform/graphics/CompositorMutation.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 static_assert( | |
| 
jbroman
2016/01/18 21:40:26
nit: I'd weakly prefer this somewhere easier to fi
 
Ian Vollick
2016/01/18 21:56:40
Moved to CompositorMutableProperties.cpp. Much nic
 | |
| 16 static_cast<cc::MutableProperty>(CompositorMutablePropertyNone) == cc::kMuta blePropertyNone, | |
| 17 "MutableProperty and CompositorMutableProperty enums must match"); | |
| 18 | |
| 19 static_assert( | |
| 20 static_cast<cc::MutableProperty>(CompositorMutablePropertyOpacity) == cc::kM utablePropertyOpacity, | |
| 21 "MutableProperty and CompositorMutableProperty enums must match"); | |
| 22 | |
| 23 static_assert( | |
| 24 static_cast<cc::MutableProperty>(CompositorMutablePropertyScrollLeft) == cc: :kMutablePropertyScrollLeft, | |
| 25 "MutableProperty and CompositorMutableProperty enums must match"); | |
| 26 | |
| 27 static_assert( | |
| 28 static_cast<cc::MutableProperty>(CompositorMutablePropertyScrollTop) == cc:: kMutablePropertyScrollTop, | |
| 29 "MutableProperty and CompositorMutableProperty enums must match"); | |
| 30 | |
| 31 static_assert( | |
| 32 static_cast<cc::MutableProperty>(CompositorMutablePropertyTransform) == cc:: kMutablePropertyTransform, | |
| 33 "MutableProperty and CompositorMutableProperty enums must match"); | |
| 34 | |
| 35 CompositorMutableState::CompositorMutableState(CompositorMutation* mutation, cc: :LayerImpl* main, cc::LayerImpl* scroll) | |
| 36 : m_mutation(mutation) | |
| 37 , m_mainLayer(main) | |
| 38 , m_scrollLayer(scroll) | |
| 39 { | |
| 40 } | |
| 41 | |
| 42 CompositorMutableState::~CompositorMutableState() {} | |
| 43 | |
| 44 double CompositorMutableState::opacity() const | |
| 45 { | |
| 46 return m_mainLayer->opacity(); | |
| 47 } | |
| 48 | |
| 49 void CompositorMutableState::setOpacity(double opacity) | |
| 50 { | |
| 51 if (!m_mainLayer) | |
| 52 return; | |
| 53 m_mainLayer->OnOpacityAnimated(opacity); | |
| 54 m_mutation->setOpacity(opacity); | |
| 55 } | |
| 56 | |
| 57 const SkMatrix44& CompositorMutableState::transform() const | |
| 58 { | |
| 59 return m_mainLayer ? m_mainLayer->transform().matrix() : SkMatrix44::I(); | |
| 60 } | |
| 61 | |
| 62 void CompositorMutableState::setTransform(const SkMatrix44& matrix) | |
| 63 { | |
| 64 if (!m_mainLayer) | |
| 65 return; | |
| 66 m_mainLayer->OnTransformAnimated(gfx::Transform(matrix)); | |
| 67 m_mutation->setTransform(matrix); | |
| 68 } | |
| 69 | |
| 70 double CompositorMutableState::scrollLeft() const | |
| 71 { | |
| 72 return m_scrollLayer ? m_scrollLayer->CurrentScrollOffset().x() : 0.0; | |
| 73 } | |
| 74 | |
| 75 void CompositorMutableState::setScrollLeft(double scrollLeft) | |
| 76 { | |
| 77 if (!m_scrollLayer) | |
| 78 return; | |
| 79 | |
| 80 gfx::ScrollOffset offset = m_scrollLayer->CurrentScrollOffset(); | |
| 81 offset.set_x(scrollLeft); | |
| 82 m_scrollLayer->OnScrollOffsetAnimated(offset); | |
| 83 m_mutation->setScrollLeft(scrollLeft); | |
| 84 } | |
| 85 | |
| 86 double CompositorMutableState::scrollTop() const | |
| 87 { | |
| 88 return m_scrollLayer ? m_scrollLayer->CurrentScrollOffset().y() : 0.0; | |
| 89 } | |
| 90 | |
| 91 void CompositorMutableState::setScrollTop(double scrollTop) | |
| 92 { | |
| 93 if (!m_scrollLayer) | |
| 94 return; | |
| 95 gfx::ScrollOffset offset = m_scrollLayer->CurrentScrollOffset(); | |
| 96 offset.set_y(scrollTop); | |
| 97 m_scrollLayer->OnScrollOffsetAnimated(offset); | |
| 98 m_mutation->setScrollTop(scrollTop); | |
| 99 } | |
| 100 | |
| 101 } // namespace blink | |
| OLD | NEW |