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..020a4add82ae9418765392ec09c169491546796b 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,9 @@ 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()); |
+ impl->set_video_rotation(video_rotation_); |
+ return scoped_ptr<LayerImpl>(impl); |
} |
void VideoLayerImpl::PushPropertiesTo(LayerImpl* layer) { |
@@ -134,10 +138,31 @@ void VideoLayerImpl::AppendQuads( |
render_pass->CreateAndAppendSharedQuadState(); |
PopulateSharedQuadState(shared_quad_state); |
danakj
2014/07/11 21:04:29
replace this with a call to SetAll (do this after
|
+ gfx::Size bounds = content_bounds(); |
danakj
2014/07/11 21:04:29
rotated_content_bounds
|
+ gfx::Transform transform = shared_quad_state->content_to_target_transform; |
+ switch (video_rotation_) { |
+ case media::VIDEO_ROTATION_90: |
+ transform.Rotate(90); |
+ transform.Translate(0, -bounds.width()); |
+ bounds = gfx::Size(bounds.height(), bounds.width()); |
+ break; |
+ case media::VIDEO_ROTATION_180: |
+ transform.Rotate(180); |
+ transform.Translate(-bounds.width(), -bounds.height()); |
+ break; |
+ case media::VIDEO_ROTATION_270: |
+ transform.Rotate(270); |
+ transform.Translate(-bounds.height(), 0); |
+ bounds = gfx::Size(bounds.height(), bounds.width()); |
+ default: |
scherkus (not reviewing)
2014/07/11 18:54:07
try to avoid default where possible and instead ex
danakj
2014/07/11 21:04:29
+1
|
+ break; |
+ } |
+ shared_quad_state->content_to_target_transform = transform; |
danakj
2014/07/11 21:04:29
You want to Preconcat your transform onto the exis
|
+ |
AppendDebugBorderQuad( |
- render_pass, content_bounds(), shared_quad_state, append_quads_data); |
+ render_pass, bounds, shared_quad_state, append_quads_data); |
- gfx::Rect quad_rect(content_bounds()); |
+ gfx::Rect quad_rect(bounds); |
gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); |
gfx::Rect visible_rect = frame_->visible_rect(); |
gfx::Size coded_size = frame_->coded_size(); |
@@ -329,6 +354,10 @@ void VideoLayerImpl::SetNeedsRedraw() { |
layer_tree_impl()->SetNeedsRedraw(); |
} |
+void VideoLayerImpl::set_video_rotation(media::VideoRotation video_rotation) { |
danakj
2014/07/11 21:04:29
SetVideoRotation, this isn't inline
|
+ video_rotation_ = video_rotation; |
+} |
danakj
2014/07/11 21:04:29
You need to call NoteLayerPropertyChanged()
|
+ |
void VideoLayerImpl::SetProviderClientImpl( |
scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { |
provider_client_impl_ = provider_client_impl; |