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

Side by Side Diff: cc/trees/property_tree.cc

Issue 2172003002: cc: Compute transform to target using effect id. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handlePAC Created 4 years, 4 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 | « cc/trees/property_tree.h ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 TransformNode* transform_node = transform_tree.Node(node->transform_id); 766 TransformNode* transform_node = transform_tree.Node(node->transform_id);
767 if (transform_node->is_invertible && 767 if (transform_node->is_invertible &&
768 transform_node->ancestors_are_invertible) { 768 transform_node->ancestors_are_invertible) {
769 if (transform_node->sorting_context_id) { 769 if (transform_node->sorting_context_id) {
770 const TransformNode* parent_transform_node = 770 const TransformNode* parent_transform_node =
771 transform_tree.parent(transform_node); 771 transform_tree.parent(transform_node);
772 if (parent_transform_node && 772 if (parent_transform_node &&
773 parent_transform_node->sorting_context_id == 773 parent_transform_node->sorting_context_id ==
774 transform_node->sorting_context_id) { 774 transform_node->sorting_context_id) {
775 gfx::Transform surface_draw_transform; 775 gfx::Transform surface_draw_transform;
776 transform_tree.ComputeTransform( 776 property_trees()->ComputeTransformToTarget(
777 transform_node->id, transform_tree.TargetId(transform_node->id), 777 transform_node->id, node->target_id, &surface_draw_transform);
778 &surface_draw_transform);
779 node->hidden_by_backface_visibility = 778 node->hidden_by_backface_visibility =
780 surface_draw_transform.IsBackFaceVisible(); 779 surface_draw_transform.IsBackFaceVisible();
781 } else { 780 } else {
782 node->hidden_by_backface_visibility = 781 node->hidden_by_backface_visibility =
783 transform_node->local.IsBackFaceVisible(); 782 transform_node->local.IsBackFaceVisible();
784 } 783 }
785 return; 784 return;
786 } 785 }
787 } 786 }
788 } 787 }
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 gfx::Transform screen_space_transform = transform_tree.ToScreen(transform_id); 1868 gfx::Transform screen_space_transform = transform_tree.ToScreen(transform_id);
1870 const EffectNode* effect_node = effect_tree.Node(effect_id); 1869 const EffectNode* effect_node = effect_tree.Node(effect_id);
1871 1870
1872 if (effect_node->surface_contents_scale.x() != 0.0 && 1871 if (effect_node->surface_contents_scale.x() != 0.0 &&
1873 effect_node->surface_contents_scale.y() != 0.0) 1872 effect_node->surface_contents_scale.y() != 0.0)
1874 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), 1873 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(),
1875 1.0 / effect_node->surface_contents_scale.y()); 1874 1.0 / effect_node->surface_contents_scale.y());
1876 return screen_space_transform; 1875 return screen_space_transform;
1877 } 1876 }
1878 1877
1878 bool PropertyTrees::ComputeTransformToTarget(int transform_id,
1879 int effect_id,
1880 gfx::Transform* transform) const {
1881 transform->MakeIdentity();
1882
1883 int destination_transform_id;
1884 if (effect_id == -1) {
1885 // This can happen when PaintArtifactCompositor builds property trees as
1886 // it doesn't set effect ids on clip nodes. We want to compute transform
1887 // to the root in this case.
1888 destination_transform_id = 0;
1889 } else {
1890 const EffectNode* effect_node = effect_tree.Node(effect_id);
1891 DCHECK(effect_node->has_render_surface || effect_node->id == 0);
1892 destination_transform_id = effect_node->transform_id;
1893 }
1894
1895 if (transform_id == destination_transform_id)
1896 return true;
1897
1898 if (transform_id > destination_transform_id) {
1899 return transform_tree.CombineTransformsBetween(
1900 transform_id, destination_transform_id, transform);
1901 }
1902
1903 return transform_tree.CombineInversesBetween(
1904 transform_id, destination_transform_id, transform);
1905 }
1906
1879 } // namespace cc 1907 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/property_tree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698