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

Unified Diff: ui/compositor/layer.cc

Issue 11418040: gfx::Transform API clean-up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index e05372c26faf45b50cbe45894b0459658e65888f..725e382577753ab415777a69a402d17b1512c9bd 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -615,10 +615,13 @@ bool Layer::GetTransformRelativeTo(const Layer* ancestor,
gfx::Transform* transform) const {
const Layer* p = this;
for (; p && p != ancestor; p = p->parent()) {
+ gfx::Transform translation;
+ translation.Translate(static_cast<float>(p->bounds().x()),
+ static_cast<float>(p->bounds().y()));
if (p->transform().HasChange())
- transform->ConcatTransform(p->transform());
- transform->ConcatTranslate(static_cast<float>(p->bounds().x()),
- static_cast<float>(p->bounds().y()));
+ *transform = translation * p->transform() * *transform;
+ else
+ *transform = translation * *transform;
}
return p == ancestor;
}
@@ -781,7 +784,9 @@ void Layer::RecomputeTransform() {
0, 1.0f / device_scale_factor_, 0,
0, 0, 1);
transform.ConcatTransform(transform_);
- transform.ConcatTranslate(bounds_.x(), bounds_.y());
+ gfx::Transform translate;
+ translate.Translate(bounds_.x(), bounds_.y());
+ transform.ConcatTransform(translate);
transform.ConcatTransform(scale_translate);
web_layer_->setTransform(transform.matrix());
}

Powered by Google App Engine
This is Rietveld 408576698