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

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: Fixed android webmediaplayer Created 6 years, 4 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/video_layer_impl.h ('k') | cc/layers/video_layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fc04a266ca835d0d340aa553406e981a81920499 100644
--- a/cc/layers/video_layer_impl.cc
+++ b/cc/layers/video_layer_impl.cc
@@ -28,17 +28,21 @@ namespace cc {
scoped_ptr<VideoLayerImpl> VideoLayerImpl::Create(
LayerTreeImpl* tree_impl,
int id,
- VideoFrameProvider* provider) {
- scoped_ptr<VideoLayerImpl> layer(new VideoLayerImpl(tree_impl, id));
+ VideoFrameProvider* provider,
+ media::VideoRotation video_rotation) {
+ scoped_ptr<VideoLayerImpl> layer(
+ new VideoLayerImpl(tree_impl, id, video_rotation));
layer->SetProviderClientImpl(VideoFrameProviderClientImpl::Create(provider));
DCHECK(tree_impl->proxy()->IsImplThread());
DCHECK(tree_impl->proxy()->IsMainThreadBlocked());
return layer.Pass();
}
-VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* tree_impl, int id)
- : LayerImpl(tree_impl, id),
- frame_(NULL) {}
+VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* tree_impl,
+ int id,
+ media::VideoRotation video_rotation)
+ : LayerImpl(tree_impl, id), frame_(NULL), video_rotation_(video_rotation) {
+}
VideoLayerImpl::~VideoLayerImpl() {
if (!provider_client_impl_->Stopped()) {
@@ -55,7 +59,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(), video_rotation_);
+ return scoped_ptr<LayerImpl>(impl);
}
void VideoLayerImpl::PushPropertiesTo(LayerImpl* layer) {
@@ -130,20 +135,48 @@ void VideoLayerImpl::AppendQuads(
AppendQuadsData* append_quads_data) {
DCHECK(frame_.get());
+ gfx::Transform transform = draw_transform();
+ gfx::Size rotated_size = content_bounds();
+
+ switch (video_rotation_) {
+ case media::VIDEO_ROTATION_90:
+ rotated_size = gfx::Size(rotated_size.height(), rotated_size.width());
+ transform.Rotate(90.0);
+ transform.Translate(0.0, -rotated_size.height());
+ break;
+ case media::VIDEO_ROTATION_180:
+ transform.Rotate(180.0);
+ transform.Translate(-rotated_size.width(), -rotated_size.height());
+ break;
+ case media::VIDEO_ROTATION_270:
+ rotated_size = gfx::Size(rotated_size.height(), rotated_size.width());
+ transform.Rotate(270.0);
+ transform.Translate(-rotated_size.width(), 0);
+ case media::VIDEO_ROTATION_0:
+ break;
+ }
+
SharedQuadState* shared_quad_state =
render_pass->CreateAndAppendSharedQuadState();
- PopulateSharedQuadState(shared_quad_state);
+ shared_quad_state->SetAll(transform,
+ rotated_size,
+ 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);
+ render_pass, rotated_size, shared_quad_state, append_quads_data);
- gfx::Rect quad_rect(content_bounds());
+ gfx::Rect quad_rect(rotated_size);
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;
« no previous file with comments | « cc/layers/video_layer_impl.h ('k') | cc/layers/video_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698