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_host_impl.h" | 9 #include "cc/layer_tree_host_impl.h" |
10 #include "cc/quad_sink.h" | 10 #include "cc/quad_sink.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 ResourceProvider::ScopedWriteLockSoftware lock(resourceProvider, plane.r
esourceId); | 365 ResourceProvider::ScopedWriteLockSoftware lock(resourceProvider, plane.r
esourceId); |
366 m_videoRenderer->Paint(m_frame, lock.skCanvas(), m_frame->visible_rect()
, 0xFF); | 366 m_videoRenderer->Paint(m_frame, lock.skCanvas(), m_frame->visible_rect()
, 0xFF); |
367 return true; | 367 return true; |
368 } | 368 } |
369 | 369 |
370 for (size_t planeIndex = 0; planeIndex < planeCount; ++planeIndex) { | 370 for (size_t planeIndex = 0; planeIndex < planeCount; ++planeIndex) { |
371 VideoLayerImpl::FramePlane& plane = m_framePlanes[planeIndex]; | 371 VideoLayerImpl::FramePlane& plane = m_framePlanes[planeIndex]; |
372 // Only non-FormatNativeTexture planes should need upload. | 372 // Only non-FormatNativeTexture planes should need upload. |
373 DCHECK_EQ(plane.format, GL_LUMINANCE); | 373 DCHECK_EQ(plane.format, GL_LUMINANCE); |
374 const uint8_t* softwarePlanePixels = m_frame->data(planeIndex); | 374 const uint8_t* softwarePlanePixels = m_frame->data(planeIndex); |
375 gfx::Rect planeRect(gfx::Point(), plane.size); | 375 gfx::Rect imageRect(0, 0, m_frame->stride(planeIndex), plane.size.height
()); |
376 resourceProvider->setPixels(plane.resourceId, softwarePlanePixels, plane
Rect, planeRect, gfx::Vector2d()); | 376 gfx::Rect sourceRect(gfx::Point(), plane.size); |
| 377 resourceProvider->setPixels(plane.resourceId, softwarePlanePixels, image
Rect, sourceRect, gfx::Vector2d()); |
377 } | 378 } |
378 return true; | 379 return true; |
379 } | 380 } |
380 | 381 |
381 void VideoLayerImpl::freePlaneData(ResourceProvider* resourceProvider) | 382 void VideoLayerImpl::freePlaneData(ResourceProvider* resourceProvider) |
382 { | 383 { |
383 for (size_t i = 0; i < media::VideoFrame::kMaxPlanes; ++i) | 384 for (size_t i = 0; i < media::VideoFrame::kMaxPlanes; ++i) |
384 m_framePlanes[i].freeData(resourceProvider); | 385 m_framePlanes[i].freeData(resourceProvider); |
385 } | 386 } |
386 | 387 |
(...skipping 28 matching lines...) Expand all Loading... |
415 { | 416 { |
416 layerTreeHostImpl()->setNeedsRedraw(); | 417 layerTreeHostImpl()->setNeedsRedraw(); |
417 } | 418 } |
418 | 419 |
419 const char* VideoLayerImpl::layerTypeAsString() const | 420 const char* VideoLayerImpl::layerTypeAsString() const |
420 { | 421 { |
421 return "VideoLayer"; | 422 return "VideoLayer"; |
422 } | 423 } |
423 | 424 |
424 } // namespace cc | 425 } // namespace cc |
OLD | NEW |