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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 TextureDrawQuad* texture_quad = | 302 TextureDrawQuad* texture_quad = |
303 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 303 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
304 texture_quad->SetNew(shared_quad_state, quad_rect, opaque_rect, | 304 texture_quad->SetNew(shared_quad_state, quad_rect, opaque_rect, |
305 visible_quad_rect, frame_resources_[0].id, | 305 visible_quad_rect, frame_resources_[0].id, |
306 premultiplied_alpha, uv_top_left, uv_bottom_right, | 306 premultiplied_alpha, uv_top_left, uv_bottom_right, |
307 SK_ColorTRANSPARENT, opacity, flipped, | 307 SK_ColorTRANSPARENT, opacity, flipped, |
308 nearest_neighbor, false); | 308 nearest_neighbor, false); |
309 ValidateQuadResources(texture_quad); | 309 ValidateQuadResources(texture_quad); |
310 break; | 310 break; |
311 } | 311 } |
| 312 case VideoFrameExternalResources::Y_RESOURCE: { |
| 313 DCHECK_EQ(frame_resources_.size(), 1u); |
| 314 if (frame_resources_.size() < 1u) |
| 315 break; |
| 316 bool premultiplied_alpha = true; |
| 317 gfx::PointF uv_top_left(0.f, 0.f); |
| 318 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); |
| 319 float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 320 bool flipped = false; |
| 321 bool nearest_neighbor = true; |
| 322 TextureDrawQuad* texture_quad = |
| 323 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 324 texture_quad->SetNew(shared_quad_state, quad_rect, opaque_rect, |
| 325 visible_quad_rect, frame_resources_[0].id, |
| 326 premultiplied_alpha, uv_top_left, uv_bottom_right, |
| 327 SK_ColorTRANSPARENT, opacity, flipped, |
| 328 nearest_neighbor, false); |
| 329 ValidateQuadResources(texture_quad); |
| 330 break; |
| 331 } |
312 case VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE: { | 332 case VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE: { |
313 DCHECK_EQ(frame_resources_.size(), 1u); | 333 DCHECK_EQ(frame_resources_.size(), 1u); |
314 if (frame_resources_.size() < 1u) | 334 if (frame_resources_.size() < 1u) |
315 break; | 335 break; |
316 gfx::Transform scale; | 336 gfx::Transform scale; |
317 scale.Scale(tex_width_scale, tex_height_scale); | 337 scale.Scale(tex_width_scale, tex_height_scale); |
318 StreamVideoDrawQuad* stream_video_quad = | 338 StreamVideoDrawQuad* stream_video_quad = |
319 render_pass->CreateAndAppendDrawQuad<StreamVideoDrawQuad>(); | 339 render_pass->CreateAndAppendDrawQuad<StreamVideoDrawQuad>(); |
320 stream_video_quad->SetNew( | 340 stream_video_quad->SetNew( |
321 shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, | 341 shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 void VideoLayerImpl::SetNeedsRedraw() { | 417 void VideoLayerImpl::SetNeedsRedraw() { |
398 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); | 418 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); |
399 layer_tree_impl()->SetNeedsRedraw(); | 419 layer_tree_impl()->SetNeedsRedraw(); |
400 } | 420 } |
401 | 421 |
402 const char* VideoLayerImpl::LayerTypeAsString() const { | 422 const char* VideoLayerImpl::LayerTypeAsString() const { |
403 return "cc::VideoLayerImpl"; | 423 return "cc::VideoLayerImpl"; |
404 } | 424 } |
405 | 425 |
406 } // namespace cc | 426 } // namespace cc |
OLD | NEW |