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/layers/video_layer_impl.h" | 5 #include "cc/layers/video_layer_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/layers/quad_sink.h" | 9 #include "cc/layers/quad_sink.h" |
10 #include "cc/layers/video_frame_provider_client_impl.h" | 10 #include "cc/layers/video_frame_provider_client_impl.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 return dimensions; | 347 return dimensions; |
348 } | 348 } |
349 | 349 |
350 bool VideoLayerImpl::FramePlane::AllocateData( | 350 bool VideoLayerImpl::FramePlane::AllocateData( |
351 ResourceProvider* resource_provider) { | 351 ResourceProvider* resource_provider) { |
352 if (resource_id) | 352 if (resource_id) |
353 return true; | 353 return true; |
354 | 354 |
355 resource_id = resource_provider->CreateResource( | 355 resource_id = resource_provider->CreateResource( |
356 size, format, ResourceProvider::TextureUsageAny); | 356 size, format, ResourceProvider::TextureUsageAny); |
357 return resource_id != 0; | 357 return resource_id; |
358 } | 358 } |
359 | 359 |
360 void VideoLayerImpl::FramePlane::FreeData(ResourceProvider* resource_provider) { | 360 void VideoLayerImpl::FramePlane::FreeData(ResourceProvider* resource_provider) { |
361 if (!resource_id) | 361 if (!resource_id) |
362 return; | 362 return; |
363 | 363 |
364 resource_provider->DeleteResource(resource_id); | 364 resource_provider->DeleteResource(resource_id); |
365 resource_id = 0; | 365 resource_id = 0; |
366 } | 366 } |
367 | 367 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 video_renderer_->Paint(frame_, | 424 video_renderer_->Paint(frame_, |
425 lock.sk_canvas(), | 425 lock.sk_canvas(), |
426 frame_->visible_rect(), | 426 frame_->visible_rect(), |
427 0xff); | 427 0xff); |
428 return true; | 428 return true; |
429 } | 429 } |
430 | 430 |
431 for (size_t plane_index = 0; plane_index < plane_count; ++plane_index) { | 431 for (size_t plane_index = 0; plane_index < plane_count; ++plane_index) { |
432 const VideoLayerImpl::FramePlane& plane = frame_planes_[plane_index]; | 432 const VideoLayerImpl::FramePlane& plane = frame_planes_[plane_index]; |
433 // Only planar formats planes should need upload. | 433 // Only planar formats planes should need upload. |
434 DCHECK_EQ(plane.format, static_cast<unsigned>(GL_LUMINANCE)); | 434 DCHECK_EQ(plane.format, GL_LUMINANCE); |
435 const uint8_t* software_plane_pixels = frame_->data(plane_index); | 435 const uint8_t* software_plane_pixels = frame_->data(plane_index); |
436 gfx::Rect image_rect(0, | 436 gfx::Rect image_rect(0, |
437 0, | 437 0, |
438 frame_->stride(plane_index), | 438 frame_->stride(plane_index), |
439 plane.size.height()); | 439 plane.size.height()); |
440 gfx::Rect source_rect(plane.size); | 440 gfx::Rect source_rect(plane.size); |
441 resource_provider->SetPixels(plane.resource_id, | 441 resource_provider->SetPixels(plane.resource_id, |
442 software_plane_pixels, | 442 software_plane_pixels, |
443 image_rect, | 443 image_rect, |
444 source_rect, | 444 source_rect, |
(...skipping 27 matching lines...) Expand all Loading... |
472 void VideoLayerImpl::SetProviderClientImpl( | 472 void VideoLayerImpl::SetProviderClientImpl( |
473 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { | 473 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { |
474 provider_client_impl_ = provider_client_impl; | 474 provider_client_impl_ = provider_client_impl; |
475 } | 475 } |
476 | 476 |
477 const char* VideoLayerImpl::LayerTypeAsString() const { | 477 const char* VideoLayerImpl::LayerTypeAsString() const { |
478 return "VideoLayer"; | 478 return "VideoLayer"; |
479 } | 479 } |
480 | 480 |
481 } // namespace cc | 481 } // namespace cc |
OLD | NEW |