| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "cc/layers/video_frame_provider_client_impl.h" | 9 #include "cc/layers/video_frame_provider_client_impl.h" |
| 10 #include "cc/quads/io_surface_draw_quad.h" | 10 #include "cc/quads/io_surface_draw_quad.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 DCHECK_GE(frame_resources_.size(), 3u); | 222 DCHECK_GE(frame_resources_.size(), 3u); |
| 223 if (frame_resources_.size() < 3u) | 223 if (frame_resources_.size() < 3u) |
| 224 break; | 224 break; |
| 225 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601; | 225 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601; |
| 226 if (frame_->format() == media::VideoFrame::YV12J) { | 226 if (frame_->format() == media::VideoFrame::YV12J) { |
| 227 color_space = YUVVideoDrawQuad::JPEG; | 227 color_space = YUVVideoDrawQuad::JPEG; |
| 228 } else if (frame_->format() == media::VideoFrame::YV12HD) { | 228 } else if (frame_->format() == media::VideoFrame::YV12HD) { |
| 229 color_space = YUVVideoDrawQuad::REC_709; | 229 color_space = YUVVideoDrawQuad::REC_709; |
| 230 } | 230 } |
| 231 | 231 |
| 232 gfx::Size min_tex_size = coded_size; | |
| 233 for (size_t plane = 0; plane < 3u; ++plane) { | |
| 234 min_tex_size.SetToMin( | |
| 235 media::VideoFrame::PlaneSize(frame_->format(), plane, coded_size)); | |
| 236 } | |
| 237 | |
| 238 gfx::RectF tex_coord_rect( | 232 gfx::RectF tex_coord_rect( |
| 239 tex_x_offset, tex_y_offset, tex_width_scale, tex_height_scale); | 233 tex_x_offset, tex_y_offset, tex_width_scale, tex_height_scale); |
| 240 YUVVideoDrawQuad* yuv_video_quad = | 234 YUVVideoDrawQuad* yuv_video_quad = |
| 241 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); | 235 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); |
| 242 yuv_video_quad->SetNew( | 236 yuv_video_quad->SetNew( |
| 243 shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, | 237 shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, |
| 244 tex_coord_rect, min_tex_size, frame_resources_[0], | 238 tex_coord_rect, coded_size, frame_resources_[0], frame_resources_[1], |
| 245 frame_resources_[1], frame_resources_[2], | 239 frame_resources_[2], |
| 246 frame_resources_.size() > 3 ? frame_resources_[3] : 0, color_space); | 240 frame_resources_.size() > 3 ? frame_resources_[3] : 0, color_space); |
| 247 break; | 241 break; |
| 248 } | 242 } |
| 249 case VideoFrameExternalResources::RGB_RESOURCE: { | 243 case VideoFrameExternalResources::RGB_RESOURCE: { |
| 250 DCHECK_EQ(frame_resources_.size(), 1u); | 244 DCHECK_EQ(frame_resources_.size(), 1u); |
| 251 if (frame_resources_.size() < 1u) | 245 if (frame_resources_.size() < 1u) |
| 252 break; | 246 break; |
| 253 bool premultiplied_alpha = true; | 247 bool premultiplied_alpha = true; |
| 254 gfx::PointF uv_top_left(0.f, 0.f); | 248 gfx::PointF uv_top_left(0.f, 0.f); |
| 255 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); | 249 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 void VideoLayerImpl::SetProviderClientImpl( | 367 void VideoLayerImpl::SetProviderClientImpl( |
| 374 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { | 368 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { |
| 375 provider_client_impl_ = provider_client_impl; | 369 provider_client_impl_ = provider_client_impl; |
| 376 } | 370 } |
| 377 | 371 |
| 378 const char* VideoLayerImpl::LayerTypeAsString() const { | 372 const char* VideoLayerImpl::LayerTypeAsString() const { |
| 379 return "cc::VideoLayerImpl"; | 373 return "cc::VideoLayerImpl"; |
| 380 } | 374 } |
| 381 | 375 |
| 382 } // namespace cc | 376 } // namespace cc |
| OLD | NEW |