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

Unified Diff: cc/layers/layer.cc

Issue 1906003002: cc: Stop cache transform invertibility at Layer and LayerImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 52f0d8a8f676b8068120612d5da35b918389596e..50e0ad474e1407a258a6057d9de9535e0d56ac00 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -78,7 +78,6 @@ Layer::Layer()
use_local_transform_for_backface_visibility_(false),
should_check_backface_visibility_(false),
force_render_surface_(false),
- transform_is_invertible_(true),
has_render_surface_(false),
subtree_property_changed_(false),
background_color_(0),
@@ -594,19 +593,18 @@ bool Layer::IsContainerForFixedPositionLayers() const {
return is_container_for_fixed_position_layers_;
}
-bool Are2dAxisAligned(const gfx::Transform& a,
- const gfx::Transform& b,
- bool* is_invertible) {
+bool Are2dAxisAligned(const gfx::Transform& a, const gfx::Transform& b) {
if (a.IsScaleOrTranslation() && b.IsScaleOrTranslation()) {
- *is_invertible = b.IsInvertible();
return true;
}
gfx::Transform inverse(gfx::Transform::kSkipInitialization);
- *is_invertible = b.GetInverse(&inverse);
-
- inverse *= a;
- return inverse.Preserves2dAxisAlignment();
+ if (b.GetInverse(&inverse)) {
+ inverse *= a;
+ return inverse.Preserves2dAxisAlignment();
+ } else {
+ return a.Preserves2dAxisAlignment();
ajuma 2016/04/21 17:20:10 It seems like we'd want to return false here, sinc
+ }
}
void Layer::SetTransform(const gfx::Transform& transform) {
@@ -623,9 +621,8 @@ void Layer::SetTransform(const gfx::Transform& transform) {
// We need to trigger a rebuild if we could have affected 2d axis
// alignment. We'll check to see if transform and transform_ are axis
// align with respect to one another.
- bool invertible = false;
bool preserves_2d_axis_alignment =
- Are2dAxisAligned(transform_, transform, &invertible);
+ Are2dAxisAligned(transform_, transform);
transform_node->data.local = transform;
transform_node->data.needs_local_transform_update = true;
transform_node->data.transform_changed = true;
@@ -636,14 +633,12 @@ void Layer::SetTransform(const gfx::Transform& transform) {
else
SetNeedsCommit();
transform_ = transform;
- transform_is_invertible_ = invertible;
return;
}
}
}
transform_ = transform;
- transform_is_invertible_ = transform.IsInvertible();
SetNeedsCommit();
}
@@ -1175,7 +1170,7 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
use_local_transform_for_backface_visibility_);
layer->SetShouldCheckBackfaceVisibility(should_check_backface_visibility_);
if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating())
- layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
+ layer->SetTransform(transform_);
DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly()));
layer->Set3dSortingContextId(sorting_context_id_);
layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
@@ -1442,7 +1437,6 @@ void Layer::LayerSpecificPropertiesToProto(proto::LayerProperties* proto) {
base->set_draw_blend_mode(SkXfermodeModeToProto(draw_blend_mode_));
base->set_use_parent_backface_visibility(use_parent_backface_visibility_);
TransformToProto(transform_, base->mutable_transform());
- base->set_transform_is_invertible(transform_is_invertible_);
base->set_sorting_context_id(sorting_context_id_);
base->set_num_descendants_that_draw_content(
num_descendants_that_draw_content_);
@@ -1524,7 +1518,6 @@ void Layer::FromLayerSpecificPropertiesProto(
draw_blend_mode_ = SkXfermodeModeFromProto(base.draw_blend_mode());
use_parent_backface_visibility_ = base.use_parent_backface_visibility();
transform_ = ProtoToTransform(base.transform());
- transform_is_invertible_ = base.transform_is_invertible();
sorting_context_id_ = base.sorting_context_id();
num_descendants_that_draw_content_ = base.num_descendants_that_draw_content();
@@ -1684,7 +1677,6 @@ void Layer::OnTransformAnimated(const gfx::Transform& transform) {
if (transform_ == transform)
return;
transform_ = transform;
- transform_is_invertible_ = transform.IsInvertible();
// Changing the transform may change the visible part of this layer, so a new
// recording may be needed.
SetNeedsUpdate();
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698