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

Unified Diff: cc/layers/video_layer_impl.cc

Issue 388643002: Rotation into Video Layer + Content Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Alternative transform 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_impl.cc
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc
index 7b4234c870cc023429578a807918edc4a9739bdf..b0c83533837996dfb1f9938574268f02d778cc6d 100644
--- a/cc/layers/video_layer_impl.cc
+++ b/cc/layers/video_layer_impl.cc
@@ -38,7 +38,9 @@ scoped_ptr<VideoLayerImpl> VideoLayerImpl::Create(
VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* tree_impl, int id)
: LayerImpl(tree_impl, id),
- frame_(NULL) {}
+ frame_(NULL),
+ video_rotation_(media::VIDEO_ROTATION_0) {
+}
VideoLayerImpl::~VideoLayerImpl() {
if (!provider_client_impl_->Stopped()) {
@@ -55,7 +57,8 @@ VideoLayerImpl::~VideoLayerImpl() {
scoped_ptr<LayerImpl> VideoLayerImpl::CreateLayerImpl(
LayerTreeImpl* tree_impl) {
- return scoped_ptr<LayerImpl>(new VideoLayerImpl(tree_impl, id()));
+ VideoLayerImpl* impl = new VideoLayerImpl(tree_impl, id());
+ return scoped_ptr<LayerImpl>(impl);
}
void VideoLayerImpl::PushPropertiesTo(LayerImpl* layer) {
@@ -63,6 +66,7 @@ void VideoLayerImpl::PushPropertiesTo(LayerImpl* layer) {
VideoLayerImpl* other = static_cast<VideoLayerImpl*>(layer);
other->SetProviderClientImpl(provider_client_impl_);
+ other->set_video_rotation(video_rotation_);
}
void VideoLayerImpl::DidBecomeActive() {
@@ -134,16 +138,44 @@ void VideoLayerImpl::AppendQuads(
render_pass->CreateAndAppendSharedQuadState();
PopulateSharedQuadState(shared_quad_state);
+ gfx::Transform transform = draw_transform();
+ transform.Scale(content_bounds().width(), content_bounds().height());
+
+ switch (video_rotation_) {
+ case media::VIDEO_ROTATION_90:
+ transform.Rotate(90);
danakj 2014/07/17 20:19:05 90.0
+ transform.Translate(0, -1.0);
danakj 2014/07/17 20:19:05 0.0, etc. (double literals to methods expecting a
+ break;
+ case media::VIDEO_ROTATION_180:
+ transform.Rotate(180);
+ transform.Translate(-1.0, -1.0);
+ break;
+ case media::VIDEO_ROTATION_270:
+ transform.Rotate(270);
+ transform.Translate(-1.0, 0);
+ case media::VIDEO_ROTATION_0:
+ break;
+ }
+
+ shared_quad_state->SetAll(transform,
+ content_bounds(),
+ visible_content_rect(),
+ clip_rect(),
+ is_clipped(),
+ draw_opacity(),
+ blend_mode(),
+ sorting_context_id());
+
AppendDebugBorderQuad(
render_pass, content_bounds(), shared_quad_state, append_quads_data);
- gfx::Rect quad_rect(content_bounds());
+ gfx::Rect quad_rect(1.0, 1.0);
danakj 2014/07/17 20:19:05 Rect is integer, these should be ints
gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect());
gfx::Rect visible_rect = frame_->visible_rect();
gfx::Size coded_size = frame_->coded_size();
- gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect(
- quad_rect, draw_properties().target_space_transform);
+ gfx::Rect visible_quad_rect =
+ occlusion_tracker.UnoccludedContentRect(quad_rect, transform);
if (visible_quad_rect.IsEmpty())
return;

Powered by Google App Engine
This is Rietveld 408576698