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

Unified Diff: cc/layers/video_layer.cc

Issue 388643002: Rotation into Video Layer + Content Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/layers/video_layer.cc
diff --git a/cc/layers/video_layer.cc b/cc/layers/video_layer.cc
index 4ddfdae69a64f9f4514b7d18be20d1083ba7a1fe..13bdc0ab4336008b0818174be1090d0e0a5879b4 100644
--- a/cc/layers/video_layer.cc
+++ b/cc/layers/video_layer.cc
@@ -36,4 +36,41 @@ bool VideoLayer::Update(ResourceUpdateQueue* queue,
return updated;
}
+void VideoLayer::PushPropertiesTo(LayerImpl* impl) {
+ Layer::PushPropertiesTo(impl);
+ gfx::Transform transform = impl->transform();
+ bool transform_is_invertible = impl->transform_is_invertible();
+ gfx::Size content_bounds = impl->content_bounds();
+ gfx::Size bounds = impl->bounds();
+
+ // As blink is provided the bounds of the video layer post rotation
+ // for laying out the page, video layer impl's bounds must be transposed
+ // for 90 or 270 degree rotations.
+ switch (video_rotation_) {
+ case media::VIDEO_ROTATION_90:
+ transform.Rotate(90.0);
+ transform.Translate(0.0, -content_bounds.width());
+ content_bounds =
+ gfx::Size(content_bounds.height(), content_bounds.width());
+ bounds = gfx::Size(bounds.height(), bounds.width());
+ break;
+ case media::VIDEO_ROTATION_180:
+ transform.Rotate(180.0);
+ transform.Translate(-content_bounds.width(), -content_bounds.height());
+ break;
+ case media::VIDEO_ROTATION_270:
+ transform.Rotate(270.0);
+ transform.Translate(-content_bounds.height(), 0);
+ content_bounds =
+ gfx::Size(content_bounds.height(), content_bounds.width());
+ bounds = gfx::Size(bounds.height(), bounds.width());
+ case media::VIDEO_ROTATION_0:
+ break;
+ }
+
+ impl->SetBounds(bounds);
+ impl->draw_properties().content_bounds = content_bounds;
+ impl->SetTransformAndInvertibility(transform, transform_is_invertible);
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698