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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 DCHECK(visible_rect.origin().IsOrigin()); | 242 DCHECK(visible_rect.origin().IsOrigin()); |
243 DCHECK(visible_rect.size() == coded_size); | 243 DCHECK(visible_rect.size() == coded_size); |
244 uv_tex_size.SetSize((ya_tex_size.width() + 1) / 2, | 244 uv_tex_size.SetSize((ya_tex_size.width() + 1) / 2, |
245 (ya_tex_size.height() + 1) / 2); | 245 (ya_tex_size.height() + 1) / 2); |
246 } else { | 246 } else { |
247 uv_tex_size = media::VideoFrame::PlaneSize( | 247 uv_tex_size = media::VideoFrame::PlaneSize( |
248 frame_->format(), media::VideoFrame::kUPlane, coded_size); | 248 frame_->format(), media::VideoFrame::kUPlane, coded_size); |
249 DCHECK(uv_tex_size == | 249 DCHECK(uv_tex_size == |
250 media::VideoFrame::PlaneSize( | 250 media::VideoFrame::PlaneSize( |
251 frame_->format(), media::VideoFrame::kVPlane, coded_size)); | 251 frame_->format(), media::VideoFrame::kVPlane, coded_size)); |
252 DCHECK_IMPLIES( | 252 DCHECK(frame_resources_.size() <= 3 || |
253 frame_resources_.size() > 3, | 253 ya_tex_size == media::VideoFrame::PlaneSize( |
254 ya_tex_size == | 254 frame_->format(), media::VideoFrame::kAPlane, |
255 media::VideoFrame::PlaneSize( | 255 coded_size)); |
256 frame_->format(), media::VideoFrame::kAPlane, coded_size)); | |
257 } | 256 } |
258 | 257 |
259 // Compute the UV sub-sampling factor based on the ratio between | 258 // Compute the UV sub-sampling factor based on the ratio between |
260 // |ya_tex_size| and |uv_tex_size|. | 259 // |ya_tex_size| and |uv_tex_size|. |
261 float uv_subsampling_factor_x = | 260 float uv_subsampling_factor_x = |
262 static_cast<float>(ya_tex_size.width()) / uv_tex_size.width(); | 261 static_cast<float>(ya_tex_size.width()) / uv_tex_size.width(); |
263 float uv_subsampling_factor_y = | 262 float uv_subsampling_factor_y = |
264 static_cast<float>(ya_tex_size.height()) / uv_tex_size.height(); | 263 static_cast<float>(ya_tex_size.height()) / uv_tex_size.height(); |
265 gfx::RectF ya_tex_coord_rect(visible_rect); | 264 gfx::RectF ya_tex_coord_rect(visible_rect); |
266 gfx::RectF uv_tex_coord_rect( | 265 gfx::RectF uv_tex_coord_rect( |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 void VideoLayerImpl::SetNeedsRedraw() { | 402 void VideoLayerImpl::SetNeedsRedraw() { |
404 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); | 403 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); |
405 layer_tree_impl()->SetNeedsRedraw(); | 404 layer_tree_impl()->SetNeedsRedraw(); |
406 } | 405 } |
407 | 406 |
408 const char* VideoLayerImpl::LayerTypeAsString() const { | 407 const char* VideoLayerImpl::LayerTypeAsString() const { |
409 return "cc::VideoLayerImpl"; | 408 return "cc::VideoLayerImpl"; |
410 } | 409 } |
411 | 410 |
412 } // namespace cc | 411 } // namespace cc |
OLD | NEW |