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

Unified Diff: cc/layers/layer.cc

Issue 1848613002: Extract subpixel offsets from composited layer transforms when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 35816ee56e78e1233886feb3d44afc1a628baf5d..8844b9f517ab07ff9f7ba5d2f9ae1098fc525d64 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -614,15 +614,32 @@ bool Are2dAxisAligned(const gfx::Transform& a,
void Layer::SetTransform(const gfx::Transform& transform) {
DCHECK(IsPropertyChangeAllowed());
- if (transform_ == transform)
+ transform_ = transform;
+
+ if (transform.IsIdentityOr2DTranslation()) {
+ gfx::Vector2dF translate = transform.To2dTranslation();
+ // Am I correct? -vmpstr
+ subpixel_offset_.set_x(translate.x() - std::floor(translate.x()));
+ subpixel_offset_.set_y(translate.y() - std::floor(translate.y()));
+ transform_.Translate(-subpixel_offset_.x(), -subpixel_offset_.y());
+ LOG(ERROR) << "Layer::SetTransform with subpixel: " << this << ": " << subpixel_offset_.ToString() << ": " << transform_.To2dTranslation().ToString();
+ }
+
+ if (transform_ == transform) {
+ LOG(ERROR) << "early out";
return;
+ }
SetSubtreePropertyChanged();
if (layer_tree_host_) {
+ LOG(ERROR) << "layer_tree_host_ found";
+
if (TransformNode* transform_node =
layer_tree_host_->property_trees()->transform_tree.Node(
transform_tree_index())) {
+ LOG(ERROR) << "node found";
if (transform_node->owner_id == id()) {
+ LOG(ERROR) << "id found";
// 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.
@@ -630,6 +647,7 @@ void Layer::SetTransform(const gfx::Transform& transform) {
bool preserves_2d_axis_alignment =
Are2dAxisAligned(transform_, transform, &invertible);
transform_node->data.local = transform;
+
transform_node->data.needs_local_transform_update = true;
transform_node->data.transform_changed = true;
layer_tree_host_->property_trees()->transform_tree.set_needs_update(
@@ -643,9 +661,10 @@ void Layer::SetTransform(const gfx::Transform& transform) {
return;
}
}
+ } else {
+ LOG(ERROR) << "no layer tree host???";
}
- transform_ = transform;
transform_is_invertible_ = transform.IsInvertible();
SetNeedsCommit();
@@ -1135,7 +1154,7 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
#else
layer->SetDebugInfo(TakeDebugInfo());
#endif
-
+ layer->SetSubpixelOffset(subpixel_offset_);
layer->SetTransformTreeIndex(transform_tree_index());
layer->SetEffectTreeIndex(effect_tree_index());
layer->SetClipTreeIndex(clip_tree_index());
« 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