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

Side by Side Diff: cc/layers/layer.cc

Issue 1715973002: cc: Move tracking of layer_property_changed to main thread (3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: transform and invertibility Created 4 years, 10 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
« no previous file with comments | « no previous file | cc/layers/layer_impl.cc » ('j') | cc/layers/layer_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "cc/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 InsertChild(child, children_.size()); 285 InsertChild(child, children_.size());
286 } 286 }
287 287
288 void Layer::InsertChild(scoped_refptr<Layer> child, size_t index) { 288 void Layer::InsertChild(scoped_refptr<Layer> child, size_t index) {
289 DCHECK(IsPropertyChangeAllowed()); 289 DCHECK(IsPropertyChangeAllowed());
290 child->RemoveFromParent(); 290 child->RemoveFromParent();
291 AddDrawableDescendants(child->NumDescendantsThatDrawContent() + 291 AddDrawableDescendants(child->NumDescendantsThatDrawContent() +
292 (child->DrawsContent() ? 1 : 0)); 292 (child->DrawsContent() ? 1 : 0));
293 child->SetParent(this); 293 child->SetParent(this);
294 child->stacking_order_changed_ = true; 294 child->stacking_order_changed_ = true;
295 child->SetSubtreePropertyChanged();
295 296
296 index = std::min(index, children_.size()); 297 index = std::min(index, children_.size());
297 children_.insert(children_.begin() + index, child); 298 children_.insert(children_.begin() + index, child);
298 SetNeedsFullTreeSync(); 299 SetNeedsFullTreeSync();
299 } 300 }
300 301
301 void Layer::RemoveFromParent() { 302 void Layer::RemoveFromParent() {
302 DCHECK(IsPropertyChangeAllowed()); 303 DCHECK(IsPropertyChangeAllowed());
303 if (parent_) 304 if (parent_)
304 parent_->RemoveChildOrDependent(this); 305 parent_->RemoveChildOrDependent(this);
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 678
678 inverse *= a; 679 inverse *= a;
679 return inverse.Preserves2dAxisAlignment(); 680 return inverse.Preserves2dAxisAlignment();
680 } 681 }
681 682
682 void Layer::SetTransform(const gfx::Transform& transform) { 683 void Layer::SetTransform(const gfx::Transform& transform) {
683 DCHECK(IsPropertyChangeAllowed()); 684 DCHECK(IsPropertyChangeAllowed());
684 if (transform_ == transform) 685 if (transform_ == transform)
685 return; 686 return;
686 687
688 SetSubtreePropertyChanged();
687 if (layer_tree_host_) { 689 if (layer_tree_host_) {
688 if (TransformNode* transform_node = 690 if (TransformNode* transform_node =
689 layer_tree_host_->property_trees()->transform_tree.Node( 691 layer_tree_host_->property_trees()->transform_tree.Node(
690 transform_tree_index())) { 692 transform_tree_index())) {
691 if (transform_node->owner_id == id()) { 693 if (transform_node->owner_id == id()) {
692 // We need to trigger a rebuild if we could have affected 2d axis 694 // We need to trigger a rebuild if we could have affected 2d axis
693 // alignment. We'll check to see if transform and transform_ are axis 695 // alignment. We'll check to see if transform and transform_ are axis
694 // align with respect to one another. 696 // align with respect to one another.
695 bool invertible = false; 697 bool invertible = false;
696 bool preserves_2d_axis_alignment = 698 bool preserves_2d_axis_alignment =
697 Are2dAxisAligned(transform_, transform, &invertible); 699 Are2dAxisAligned(transform_, transform, &invertible);
698 transform_node->data.local = transform; 700 transform_node->data.local = transform;
699 transform_node->data.needs_local_transform_update = true; 701 transform_node->data.needs_local_transform_update = true;
702 transform_node->data.transform_changed = true;
700 layer_tree_host_->property_trees()->transform_tree.set_needs_update( 703 layer_tree_host_->property_trees()->transform_tree.set_needs_update(
701 true); 704 true);
702 if (preserves_2d_axis_alignment) 705 if (preserves_2d_axis_alignment)
703 SetNeedsCommitNoRebuild(); 706 SetNeedsCommitNoRebuild();
704 else 707 else
705 SetNeedsCommit(); 708 SetNeedsCommit();
706 transform_ = transform; 709 transform_ = transform;
707 transform_is_invertible_ = invertible; 710 transform_is_invertible_ = invertible;
708 return; 711 return;
709 } 712 }
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 this, layer_tree_host_->property_trees()->transform_tree); 2073 this, layer_tree_host_->property_trees()->transform_tree);
2071 } 2074 }
2072 2075
2073 gfx::Transform Layer::screen_space_transform() const { 2076 gfx::Transform Layer::screen_space_transform() const {
2074 DCHECK_NE(transform_tree_index_, -1); 2077 DCHECK_NE(transform_tree_index_, -1);
2075 return ScreenSpaceTransformFromPropertyTrees( 2078 return ScreenSpaceTransformFromPropertyTrees(
2076 this, layer_tree_host_->property_trees()->transform_tree); 2079 this, layer_tree_host_->property_trees()->transform_tree);
2077 } 2080 }
2078 2081
2079 } // namespace cc 2082 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/layer_impl.cc » ('j') | cc/layers/layer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698