| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 gfx::Size uv_tex_size = media::VideoFrame::PlaneSize( | 236 gfx::Size uv_tex_size = media::VideoFrame::PlaneSize( |
| 237 frame_->format(), media::VideoFrame::kUPlane, coded_size); | 237 frame_->format(), media::VideoFrame::kUPlane, coded_size); |
| 238 | 238 |
| 239 if (frame_->HasTextures()) { | 239 if (frame_->HasTextures()) { |
| 240 DCHECK_EQ(media::PIXEL_FORMAT_I420, frame_->format()); | 240 DCHECK_EQ(media::PIXEL_FORMAT_I420, frame_->format()); |
| 241 DCHECK_EQ(3u, frame_resources_.size()); // Alpha is not supported yet. | 241 DCHECK_EQ(3u, frame_resources_.size()); // Alpha is not supported yet. |
| 242 } else { | 242 } else { |
| 243 DCHECK(uv_tex_size == | 243 DCHECK(uv_tex_size == |
| 244 media::VideoFrame::PlaneSize( | 244 media::VideoFrame::PlaneSize( |
| 245 frame_->format(), media::VideoFrame::kVPlane, coded_size)); | 245 frame_->format(), media::VideoFrame::kVPlane, coded_size)); |
| 246 DCHECK_IMPLIES( | 246 DCHECK(frame_resources_.size() <= 3 || |
| 247 frame_resources_.size() > 3, | 247 ya_tex_size == media::VideoFrame::PlaneSize( |
| 248 ya_tex_size == | 248 frame_->format(), media::VideoFrame::kAPlane, |
| 249 media::VideoFrame::PlaneSize( | 249 coded_size)); |
| 250 frame_->format(), media::VideoFrame::kAPlane, coded_size)); | |
| 251 } | 250 } |
| 252 | 251 |
| 253 // Compute the UV sub-sampling factor based on the ratio between | 252 // Compute the UV sub-sampling factor based on the ratio between |
| 254 // |ya_tex_size| and |uv_tex_size|. | 253 // |ya_tex_size| and |uv_tex_size|. |
| 255 float uv_subsampling_factor_x = | 254 float uv_subsampling_factor_x = |
| 256 static_cast<float>(ya_tex_size.width()) / uv_tex_size.width(); | 255 static_cast<float>(ya_tex_size.width()) / uv_tex_size.width(); |
| 257 float uv_subsampling_factor_y = | 256 float uv_subsampling_factor_y = |
| 258 static_cast<float>(ya_tex_size.height()) / uv_tex_size.height(); | 257 static_cast<float>(ya_tex_size.height()) / uv_tex_size.height(); |
| 259 gfx::RectF ya_tex_coord_rect(visible_rect); | 258 gfx::RectF ya_tex_coord_rect(visible_rect); |
| 260 gfx::RectF uv_tex_coord_rect( | 259 gfx::RectF uv_tex_coord_rect( |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 void VideoLayerImpl::SetNeedsRedraw() { | 397 void VideoLayerImpl::SetNeedsRedraw() { |
| 399 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); | 398 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); |
| 400 layer_tree_impl()->SetNeedsRedraw(); | 399 layer_tree_impl()->SetNeedsRedraw(); |
| 401 } | 400 } |
| 402 | 401 |
| 403 const char* VideoLayerImpl::LayerTypeAsString() const { | 402 const char* VideoLayerImpl::LayerTypeAsString() const { |
| 404 return "cc::VideoLayerImpl"; | 403 return "cc::VideoLayerImpl"; |
| 405 } | 404 } |
| 406 | 405 |
| 407 } // namespace cc | 406 } // namespace cc |
| OLD | NEW |