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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 if (frame_->metadata()->GetInteger(media::VideoFrameMetadata::COLOR_SPACE, | 226 if (frame_->metadata()->GetInteger(media::VideoFrameMetadata::COLOR_SPACE, |
227 &videoframe_color_space)) { | 227 &videoframe_color_space)) { |
228 if (videoframe_color_space == media::COLOR_SPACE_JPEG) { | 228 if (videoframe_color_space == media::COLOR_SPACE_JPEG) { |
229 color_space = YUVVideoDrawQuad::JPEG; | 229 color_space = YUVVideoDrawQuad::JPEG; |
230 } else if (videoframe_color_space == media::COLOR_SPACE_HD_REC709) { | 230 } else if (videoframe_color_space == media::COLOR_SPACE_HD_REC709) { |
231 color_space = YUVVideoDrawQuad::REC_709; | 231 color_space = YUVVideoDrawQuad::REC_709; |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 const gfx::Size ya_tex_size = coded_size; | 235 const gfx::Size ya_tex_size = coded_size; |
236 gfx::Size uv_tex_size; | 236 gfx::Size uv_tex_size = media::VideoFrame::PlaneSize( |
| 237 frame_->format(), media::VideoFrame::kUPlane, coded_size); |
237 | 238 |
238 if (frame_->HasTextures()) { | 239 if (frame_->HasTextures()) { |
239 DCHECK_EQ(media::PIXEL_FORMAT_I420, frame_->format()); | 240 DCHECK_EQ(media::PIXEL_FORMAT_I420, frame_->format()); |
240 DCHECK_EQ(3u, frame_resources_.size()); // Alpha is not supported yet. | 241 DCHECK_EQ(3u, frame_resources_.size()); // Alpha is not supported yet. |
241 DCHECK(visible_rect.origin().IsOrigin()); | |
242 DCHECK(visible_rect.size() == coded_size); | |
243 uv_tex_size.SetSize((ya_tex_size.width() + 1) / 2, | |
244 (ya_tex_size.height() + 1) / 2); | |
245 } else { | 242 } else { |
246 uv_tex_size = media::VideoFrame::PlaneSize( | |
247 frame_->format(), media::VideoFrame::kUPlane, coded_size); | |
248 DCHECK(uv_tex_size == | 243 DCHECK(uv_tex_size == |
249 media::VideoFrame::PlaneSize( | 244 media::VideoFrame::PlaneSize( |
250 frame_->format(), media::VideoFrame::kVPlane, coded_size)); | 245 frame_->format(), media::VideoFrame::kVPlane, coded_size)); |
251 DCHECK_IMPLIES( | 246 DCHECK_IMPLIES( |
252 frame_resources_.size() > 3, | 247 frame_resources_.size() > 3, |
253 ya_tex_size == | 248 ya_tex_size == |
254 media::VideoFrame::PlaneSize( | 249 media::VideoFrame::PlaneSize( |
255 frame_->format(), media::VideoFrame::kAPlane, coded_size)); | 250 frame_->format(), media::VideoFrame::kAPlane, coded_size)); |
256 } | 251 } |
257 | 252 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 void VideoLayerImpl::SetNeedsRedraw() { | 398 void VideoLayerImpl::SetNeedsRedraw() { |
404 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); | 399 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); |
405 layer_tree_impl()->SetNeedsRedraw(); | 400 layer_tree_impl()->SetNeedsRedraw(); |
406 } | 401 } |
407 | 402 |
408 const char* VideoLayerImpl::LayerTypeAsString() const { | 403 const char* VideoLayerImpl::LayerTypeAsString() const { |
409 return "cc::VideoLayerImpl"; | 404 return "cc::VideoLayerImpl"; |
410 } | 405 } |
411 | 406 |
412 } // namespace cc | 407 } // namespace cc |
OLD | NEW |