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

Side by Side 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: Updated layer{impl} tests 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/video_layer.h" 5 #include "cc/layers/video_layer.h"
6 6
7 #include "cc/layers/video_layer_impl.h" 7 #include "cc/layers/video_layer_impl.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 18 matching lines...) Expand all
29 // Video layer doesn't update any resources from the main thread side, 29 // Video layer doesn't update any resources from the main thread side,
30 // but repaint rects need to be sent to the VideoLayerImpl via commit. 30 // but repaint rects need to be sent to the VideoLayerImpl via commit.
31 // 31 //
32 // This is the inefficient legacy redraw path for videos. It's better to 32 // This is the inefficient legacy redraw path for videos. It's better to
33 // communicate this directly to the VideoLayerImpl. 33 // communicate this directly to the VideoLayerImpl.
34 updated |= !update_rect_.IsEmpty(); 34 updated |= !update_rect_.IsEmpty();
35 35
36 return updated; 36 return updated;
37 } 37 }
38 38
39 void VideoLayer::PushPropertiesTo(LayerImpl* impl) {
40 Layer::PushPropertiesTo(impl);
41 gfx::Transform transform = impl->transform();
42 bool transform_is_invertible = impl->transform_is_invertible();
43 gfx::Size content_bounds = impl->content_bounds();
44
45 switch (video_rotation_) {
46 case media::VIDEO_ROTATION_90:
47 transform.Rotate(90.0);
48 transform.Translate(0.0, -content_bounds.width());
49 content_bounds =
enne (OOO) 2014/07/23 21:46:52 I think content bounds shouldn't be modified here.
suderman 2014/07/23 23:27:01 The content bounds are used to construct the video
enne (OOO) 2014/07/23 23:39:26 Thanks! That was not obvious at all to me. So, Bl
50 gfx::Size(content_bounds.height(), content_bounds.width());
51 break;
52 case media::VIDEO_ROTATION_180:
53 transform.Rotate(180.0);
54 transform.Translate(-content_bounds.width(), -content_bounds.height());
55 break;
56 case media::VIDEO_ROTATION_270:
57 transform.Rotate(270.0);
58 transform.Translate(-content_bounds.height(), 0);
59 content_bounds =
60 gfx::Size(content_bounds.height(), content_bounds.width());
61 case media::VIDEO_ROTATION_0:
62 break;
63 }
64
65 impl->draw_properties().content_bounds = content_bounds;
66 impl->SetTransformAndInvertibility(transform, transform_is_invertible);
67 }
68
39 } // namespace cc 69 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698