OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/video_layer_impl.h" | 5 #include "cc/video_layer_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "cc/io_surface_draw_quad.h" | 8 #include "cc/io_surface_draw_quad.h" |
9 #include "cc/layer_tree_impl.h" | 9 #include "cc/layer_tree_impl.h" |
10 #include "cc/math_util.h" | 10 #include "cc/math_util.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* treeImpl, int id, VideoFrameProvid
er* provider) | 24 VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* treeImpl, int id, VideoFrameProvid
er* provider) |
25 : LayerImpl(treeImpl, id) | 25 : LayerImpl(treeImpl, id) |
26 , m_provider(provider) | 26 , m_provider(provider) |
27 , m_frame(0) | 27 , m_frame(0) |
28 , m_format(GL_INVALID_VALUE) | 28 , m_format(GL_INVALID_VALUE) |
29 , m_convertYUV(false) | 29 , m_convertYUV(false) |
30 , m_externalTextureResource(0) | 30 , m_externalTextureResource(0) |
31 { | 31 { |
32 // This matrix is the default transformation for stream textures, and flips
on the Y axis. | 32 // This matrix is the default transformation for stream textures, and flips
on the Y axis. |
33 m_streamTextureMatrix = MathUtil::createGfxTransform( | 33 m_streamTextureMatrix = gfx::Transform( |
34 1, 0, 0, 0, | 34 1.0, 0.0, 0.0, 0.0, |
35 0, -1, 0, 0, | 35 0.0, -1.0, 0.0, 1.0, |
36 0, 0, 1, 0, | 36 0.0, 0.0, 1.0, 0.0, |
37 0, 1, 0, 1); | 37 0.0, 0.0, 0.0, 1.0); |
38 | 38 |
39 // This only happens during a commit on the compositor thread while the main | 39 // This only happens during a commit on the compositor thread while the main |
40 // thread is blocked. That makes this a thread-safe call to set the video | 40 // thread is blocked. That makes this a thread-safe call to set the video |
41 // frame provider client that does not require a lock. The same is true of | 41 // frame provider client that does not require a lock. The same is true of |
42 // the call in the destructor. | 42 // the call in the destructor. |
43 m_provider->SetVideoFrameProviderClient(this); | 43 m_provider->SetVideoFrameProviderClient(this); |
44 } | 44 } |
45 | 45 |
46 VideoLayerImpl::~VideoLayerImpl() | 46 VideoLayerImpl::~VideoLayerImpl() |
47 { | 47 { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 m_framePlanes[i].freeData(resourceProvider); | 395 m_framePlanes[i].freeData(resourceProvider); |
396 } | 396 } |
397 | 397 |
398 void VideoLayerImpl::DidReceiveFrame() | 398 void VideoLayerImpl::DidReceiveFrame() |
399 { | 399 { |
400 setNeedsRedraw(); | 400 setNeedsRedraw(); |
401 } | 401 } |
402 | 402 |
403 void VideoLayerImpl::DidUpdateMatrix(const float matrix[16]) | 403 void VideoLayerImpl::DidUpdateMatrix(const float matrix[16]) |
404 { | 404 { |
405 m_streamTextureMatrix = MathUtil::createGfxTransform( | 405 m_streamTextureMatrix = gfx::Transform( |
406 matrix[0], matrix[1], matrix[2], matrix[3], | 406 matrix[0], matrix[4], matrix[8], matrix[12], |
407 matrix[4], matrix[5], matrix[6], matrix[7], | 407 matrix[1], matrix[5], matrix[9], matrix[13], |
408 matrix[8], matrix[9], matrix[10], matrix[11], | 408 matrix[2], matrix[6], matrix[10], matrix[14], |
409 matrix[12], matrix[13], matrix[14], matrix[15]); | 409 matrix[3], matrix[7], matrix[11], matrix[15]); |
410 setNeedsRedraw(); | 410 setNeedsRedraw(); |
411 } | 411 } |
412 | 412 |
413 void VideoLayerImpl::didLoseOutputSurface() | 413 void VideoLayerImpl::didLoseOutputSurface() |
414 { | 414 { |
415 freePlaneData(layerTreeImpl()->resource_provider()); | 415 freePlaneData(layerTreeImpl()->resource_provider()); |
416 } | 416 } |
417 | 417 |
418 void VideoLayerImpl::setNeedsRedraw() | 418 void VideoLayerImpl::setNeedsRedraw() |
419 { | 419 { |
420 layerTreeImpl()->SetNeedsRedraw(); | 420 layerTreeImpl()->SetNeedsRedraw(); |
421 } | 421 } |
422 | 422 |
423 const char* VideoLayerImpl::layerTypeAsString() const | 423 const char* VideoLayerImpl::layerTypeAsString() const |
424 { | 424 { |
425 return "VideoLayer"; | 425 return "VideoLayer"; |
426 } | 426 } |
427 | 427 |
428 } // namespace cc | 428 } // namespace cc |
OLD | NEW |