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