Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/CompositorMutableState.cpp

Issue 2762123004: cc: LayerTreeHostImpl uses element id to tick animations (Closed)
Patch Set: review comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/property_tree.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/CompositorMutableState.h" 5 #include "platform/graphics/CompositorMutableState.h"
6 6
7 #include "cc/layers/layer_impl.h" 7 #include "cc/layers/layer_impl.h"
8 #include "cc/trees/layer_tree_impl.h" 8 #include "cc/trees/layer_tree_impl.h"
9 #include "platform/graphics/CompositorMutation.h" 9 #include "platform/graphics/CompositorMutation.h"
10 10
11 namespace blink { 11 namespace blink {
12 CompositorMutableState::CompositorMutableState(CompositorMutation* mutation, 12 CompositorMutableState::CompositorMutableState(CompositorMutation* mutation,
13 cc::LayerImpl* main, 13 cc::LayerImpl* main,
14 cc::LayerImpl* scroll) 14 cc::LayerImpl* scroll)
15 : m_mutation(mutation), m_mainLayer(main), m_scrollLayer(scroll) {} 15 : m_mutation(mutation), m_mainLayer(main), m_scrollLayer(scroll) {}
16 16
17 CompositorMutableState::~CompositorMutableState() {} 17 CompositorMutableState::~CompositorMutableState() {}
18 18
19 double CompositorMutableState::opacity() const { 19 double CompositorMutableState::opacity() const {
20 return m_mainLayer->Opacity(); 20 return m_mainLayer->Opacity();
21 } 21 }
22 22
23 void CompositorMutableState::setOpacity(double opacity) { 23 void CompositorMutableState::setOpacity(double opacity) {
24 if (!m_mainLayer) 24 if (!m_mainLayer)
25 return; 25 return;
26 m_mainLayer->layer_tree_impl() 26 m_mainLayer->layer_tree_impl()->SetOpacityMutated(m_mainLayer->element_id(),
27 ->property_trees() 27 opacity);
28 ->effect_tree.OnOpacityAnimated(opacity, m_mainLayer->effect_tree_index(),
29 m_mainLayer->layer_tree_impl());
30 m_mutation->setOpacity(opacity); 28 m_mutation->setOpacity(opacity);
31 } 29 }
32 30
33 const SkMatrix44& CompositorMutableState::transform() const { 31 const SkMatrix44& CompositorMutableState::transform() const {
34 return m_mainLayer ? m_mainLayer->Transform().matrix() : SkMatrix44::I(); 32 return m_mainLayer ? m_mainLayer->Transform().matrix() : SkMatrix44::I();
35 } 33 }
36 34
37 void CompositorMutableState::setTransform(const SkMatrix44& matrix) { 35 void CompositorMutableState::setTransform(const SkMatrix44& matrix) {
38 if (!m_mainLayer) 36 if (!m_mainLayer)
39 return; 37 return;
40 m_mainLayer->layer_tree_impl() 38 m_mainLayer->layer_tree_impl()->SetTransformMutated(m_mainLayer->element_id(),
41 ->property_trees() 39 gfx::Transform(matrix));
42 ->transform_tree.OnTransformAnimated(gfx::Transform(matrix),
43 m_mainLayer->transform_tree_index(),
44 m_mainLayer->layer_tree_impl());
45 m_mutation->setTransform(matrix); 40 m_mutation->setTransform(matrix);
46 } 41 }
47 42
48 float CompositorMutableState::scrollLeft() const { 43 float CompositorMutableState::scrollLeft() const {
49 return m_scrollLayer ? m_scrollLayer->CurrentScrollOffset().x() : 0.0; 44 return m_scrollLayer ? m_scrollLayer->CurrentScrollOffset().x() : 0.0;
50 } 45 }
51 46
52 void CompositorMutableState::setScrollLeft(float scrollLeft) { 47 void CompositorMutableState::setScrollLeft(float scrollLeft) {
53 if (!m_scrollLayer) 48 if (!m_scrollLayer)
54 return; 49 return;
(...skipping 19 matching lines...) Expand all
74 offset.set_y(scrollTop); 69 offset.set_y(scrollTop);
75 m_scrollLayer->layer_tree_impl() 70 m_scrollLayer->layer_tree_impl()
76 ->property_trees() 71 ->property_trees()
77 ->scroll_tree.OnScrollOffsetAnimated( 72 ->scroll_tree.OnScrollOffsetAnimated(
78 m_scrollLayer->id(), m_scrollLayer->scroll_tree_index(), offset, 73 m_scrollLayer->id(), m_scrollLayer->scroll_tree_index(), offset,
79 m_scrollLayer->layer_tree_impl()); 74 m_scrollLayer->layer_tree_impl());
80 m_mutation->setScrollTop(scrollTop); 75 m_mutation->setScrollTop(scrollTop);
81 } 76 }
82 77
83 } // namespace blink 78 } // namespace blink
OLDNEW
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/property_tree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698