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