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

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

Issue 2191983002: cc : Use dynamically calculated target space transforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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
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 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 1.0 / effect_node->surface_contents_scale.y()); 1979 1.0 / effect_node->surface_contents_scale.y());
1980 return screen_space_transform; 1980 return screen_space_transform;
1981 } 1981 }
1982 1982
1983 bool PropertyTrees::ComputeTransformToTarget(int transform_id, 1983 bool PropertyTrees::ComputeTransformToTarget(int transform_id,
1984 int effect_id, 1984 int effect_id,
1985 gfx::Transform* transform) const { 1985 gfx::Transform* transform) const {
1986 transform->MakeIdentity(); 1986 transform->MakeIdentity();
1987 1987
1988 int target_transform_id; 1988 int target_transform_id;
1989 const EffectNode* effect_node = effect_tree.Node(effect_id);
1989 if (effect_id == EffectTree::kInvalidNodeId) { 1990 if (effect_id == EffectTree::kInvalidNodeId) {
1990 // This can happen when PaintArtifactCompositor builds property trees as 1991 // This can happen when PaintArtifactCompositor builds property trees as
1991 // it doesn't set effect ids on clip nodes. We want to compute transform 1992 // it doesn't set effect ids on clip nodes. We want to compute transform
1992 // to the root in this case. 1993 // to the root in this case.
1993 target_transform_id = TransformTree::kRootNodeId; 1994 target_transform_id = TransformTree::kRootNodeId;
1994 } else { 1995 } else {
1995 const EffectNode* effect_node = effect_tree.Node(effect_id);
1996 DCHECK(effect_node->has_render_surface || 1996 DCHECK(effect_node->has_render_surface ||
1997 effect_node->id == EffectTree::kRootNodeId); 1997 effect_node->id == EffectTree::kRootNodeId);
1998 target_transform_id = effect_node->transform_id; 1998 target_transform_id = effect_node->transform_id;
1999 } 1999 }
2000 2000
2001 return transform_tree.ComputeTransform(transform_id, target_transform_id, 2001 if (!verify_transform_tree_calculations || transform_id < target_transform_id)
2002 transform); 2002 return transform_tree.ComputeTransform(transform_id, target_transform_id,
2003 transform);
2004 transform->ConcatTransform(
2005 GetDrawTransforms(transform_id, effect_id).to_target);
2006 if (effect_node->surface_contents_scale.x() != 0.f &&
2007 effect_node->surface_contents_scale.y() != 0.f)
2008 transform->matrix().postScale(
2009 1.0f / effect_node->surface_contents_scale.x(),
2010 1.0f / effect_node->surface_contents_scale.y(), 1.0f);
2011 return true;
2003 } 2012 }
2004 2013
2005 bool PropertyTrees::ComputeTransformFromTarget( 2014 bool PropertyTrees::ComputeTransformFromTarget(
2006 int transform_id, 2015 int transform_id,
2007 int effect_id, 2016 int effect_id,
2008 gfx::Transform* transform) const { 2017 gfx::Transform* transform) const {
2009 transform->MakeIdentity(); 2018 transform->MakeIdentity();
2010 2019
2011 int target_transform_id; 2020 int target_transform_id;
2021 const EffectNode* effect_node = effect_tree.Node(effect_id);
2012 if (effect_id == EffectTree::kInvalidNodeId) { 2022 if (effect_id == EffectTree::kInvalidNodeId) {
2013 // This can happen when PaintArtifactCompositor builds property trees as 2023 // This can happen when PaintArtifactCompositor builds property trees as
2014 // it doesn't set effect ids on clip nodes. We want to compute transform 2024 // it doesn't set effect ids on clip nodes. We want to compute transform
2015 // to the root in this case. 2025 // to the root in this case.
2016 target_transform_id = TransformTree::kRootNodeId; 2026 target_transform_id = TransformTree::kRootNodeId;
2017 } else { 2027 } else {
2018 const EffectNode* effect_node = effect_tree.Node(effect_id);
2019 DCHECK(effect_node->has_render_surface || 2028 DCHECK(effect_node->has_render_surface ||
2020 effect_node->id == EffectTree::kRootNodeId); 2029 effect_node->id == EffectTree::kRootNodeId);
2021 target_transform_id = effect_node->transform_id; 2030 target_transform_id = effect_node->transform_id;
2022 } 2031 }
2023 2032
2024 return transform_tree.ComputeTransform(target_transform_id, transform_id, 2033 if (!verify_transform_tree_calculations || transform_id > target_transform_id)
2025 transform); 2034 return transform_tree.ComputeTransform(target_transform_id, transform_id,
2035 transform);
2036
2037 auto draw_transforms = GetDrawTransforms(transform_id, effect_id);
2038 transform->ConcatTransform(draw_transforms.from_target);
2039 transform->Scale(effect_node->surface_contents_scale.x(),
2040 effect_node->surface_contents_scale.y());
2041 return draw_transforms.invertible;
2026 } 2042 }
2027 2043
2028 } // namespace cc 2044 } // namespace cc
OLDNEW
« cc/trees/draw_property_utils.cc ('K') | « cc/trees/layer_tree_host_common_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698