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

Unified Diff: cc/trees/property_tree.cc

Issue 2148383005: cc: Use sublayer scale from effect tree (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/sublayer_scale/surface_contents_scale Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/property_tree.cc
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc
index d2b3783a5724dc82c0c44fadb6e5c24e3e3b5279..b0478e10e165f189e7f280bff9f12b89f2b57b73 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -164,30 +164,11 @@ bool TransformTree::ComputeTransformWithDestinationSublayerScale(
bool success = ComputeTransform(source_id, dest_id, transform);
const TransformNode* dest_node = Node(dest_id);
- if (!dest_node->needs_sublayer_scale)
+ if (!dest_node->needs_surface_contents_scale)
return success;
- transform->matrix().postScale(dest_node->sublayer_scale.x(),
- dest_node->sublayer_scale.y(), 1.f);
- return success;
-}
-
-bool TransformTree::ComputeTransformWithSourceSublayerScale(
- int source_id,
- int dest_id,
- gfx::Transform* transform) const {
- bool success = ComputeTransform(source_id, dest_id, transform);
-
- const TransformNode* source_node = Node(source_id);
- if (!source_node->needs_sublayer_scale)
- return success;
-
- if (source_node->sublayer_scale.x() == 0 ||
- source_node->sublayer_scale.y() == 0)
- return false;
-
- transform->Scale(1.f / source_node->sublayer_scale.x(),
- 1.f / source_node->sublayer_scale.y());
+ transform->matrix().postScale(dest_node->surface_contents_scale.x(),
+ dest_node->surface_contents_scale.y(), 1.f);
return success;
}
@@ -274,12 +255,13 @@ bool TransformTree::CombineTransformsBetween(int source_id,
std::vector<int> source_to_destination;
source_to_destination.push_back(current->id);
current = parent(current);
- bool destination_has_non_zero_sublayer_scale =
- dest->sublayer_scale.x() != 0.f && dest->sublayer_scale.y() != 0.f;
- DCHECK(destination_has_non_zero_sublayer_scale ||
+ bool destination_has_non_zero_surface_contents_scale =
+ dest->surface_contents_scale.x() != 0.f &&
+ dest->surface_contents_scale.y() != 0.f;
+ DCHECK(destination_has_non_zero_surface_contents_scale ||
!dest->ancestors_are_invertible);
for (; current && current->id > dest_id; current = parent(current)) {
- if (destination_has_non_zero_sublayer_scale &&
+ if (destination_has_non_zero_surface_contents_scale &&
TargetId(current->id) == dest_id &&
ContentTargetId(current->id) == dest_id)
break;
@@ -292,7 +274,8 @@ bool TransformTree::CombineTransformsBetween(int source_id,
// The stored target space transform has sublayer scale baked in, but we
// need the unscaled transform.
combined_transform.matrix().postScale(
- 1.0f / dest->sublayer_scale.x(), 1.0f / dest->sublayer_scale.y(), 1.0f);
+ 1.0f / dest->surface_contents_scale.x(),
+ 1.0f / dest->surface_contents_scale.y(), 1.0f);
} else if (current->id < dest_id) {
// We have reached the lowest common ancestor of the source and destination
// nodes. This case can occur when we are transforming between a node
@@ -420,8 +403,8 @@ void TransformTree::UpdateScreenSpaceTransform(TransformNode* node,
void TransformTree::UpdateSublayerScale(TransformNode* node) {
// The sublayer scale depends on the screen space transform, so update it too.
- if (!node->needs_sublayer_scale) {
- node->sublayer_scale = gfx::Vector2dF(1.0f, 1.0f);
+ if (!node->needs_surface_contents_scale) {
+ node->surface_contents_scale = gfx::Vector2dF(1.0f, 1.0f);
return;
}
@@ -429,17 +412,17 @@ void TransformTree::UpdateSublayerScale(TransformNode* node) {
device_scale_factor_ * device_transform_scale_factor_;
if (node->in_subtree_of_page_scale_layer)
layer_scale_factor *= page_scale_factor_;
- node->sublayer_scale = MathUtil::ComputeTransform2dScaleComponents(
+ node->surface_contents_scale = MathUtil::ComputeTransform2dScaleComponents(
ToScreen(node->id), layer_scale_factor);
}
void TransformTree::UpdateTargetSpaceTransform(TransformNode* node,
TransformNode* target_node) {
gfx::Transform target_space_transform;
- if (node->needs_sublayer_scale) {
+ if (node->needs_surface_contents_scale) {
target_space_transform.MakeIdentity();
- target_space_transform.Scale(node->sublayer_scale.x(),
- node->sublayer_scale.y());
+ target_space_transform.Scale(node->surface_contents_scale.x(),
+ node->surface_contents_scale.y());
} else {
// In order to include the root transform for the root surface, we walk up
// to the root of the transform tree in ComputeTransform.
@@ -669,9 +652,10 @@ gfx::Transform TransformTree::ToScreenSpaceTransformWithoutSublayerScale(
}
const TransformNode* node = Node(id);
gfx::Transform screen_space_transform = ToScreen(id);
- if (node->sublayer_scale.x() != 0.0 && node->sublayer_scale.y() != 0.0)
- screen_space_transform.Scale(1.0 / node->sublayer_scale.x(),
- 1.0 / node->sublayer_scale.y());
+ if (node->surface_contents_scale.x() != 0.0 &&
+ node->surface_contents_scale.y() != 0.0)
+ screen_space_transform.Scale(1.0 / node->surface_contents_scale.x(),
+ 1.0 / node->surface_contents_scale.y());
return screen_space_transform;
}
@@ -837,7 +821,7 @@ void EffectTree::UpdateBackfaceVisibility(EffectNode* node,
void EffectTree::UpdateSublayerScale(EffectNode* effect_node) {
if (!effect_node->has_render_surface || effect_node->transform_id == 0) {
- effect_node->sublayer_scale = gfx::Vector2dF(1.0f, 1.0f);
+ effect_node->surface_contents_scale = gfx::Vector2dF(1.0f, 1.0f);
return;
}
@@ -848,8 +832,9 @@ void EffectTree::UpdateSublayerScale(EffectNode* effect_node) {
transform_tree.Node(effect_node->transform_id);
if (transform_node->in_subtree_of_page_scale_layer)
layer_scale_factor *= transform_tree.page_scale_factor();
- effect_node->sublayer_scale = MathUtil::ComputeTransform2dScaleComponents(
- transform_tree.ToScreen(transform_node->id), layer_scale_factor);
+ effect_node->surface_contents_scale =
+ MathUtil::ComputeTransform2dScaleComponents(
+ transform_tree.ToScreen(transform_node->id), layer_scale_factor);
}
void EffectTree::UpdateEffects(int id) {

Powered by Google App Engine
This is Rietveld 408576698