| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 case VideoFrameExternalResources::SOFTWARE_RESOURCE: { | 198 case VideoFrameExternalResources::SOFTWARE_RESOURCE: { |
| 199 DCHECK_EQ(frame_resources_.size(), 0u); | 199 DCHECK_EQ(frame_resources_.size(), 0u); |
| 200 DCHECK_EQ(software_resources_.size(), 1u); | 200 DCHECK_EQ(software_resources_.size(), 1u); |
| 201 if (software_resources_.size() < 1u) | 201 if (software_resources_.size() < 1u) |
| 202 break; | 202 break; |
| 203 bool premultiplied_alpha = true; | 203 bool premultiplied_alpha = true; |
| 204 gfx::PointF uv_top_left(0.f, 0.f); | 204 gfx::PointF uv_top_left(0.f, 0.f); |
| 205 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); | 205 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); |
| 206 float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 206 float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 207 bool flipped = false; | 207 bool flipped = false; |
| 208 bool nearest_neighbor = false; |
| 208 TextureDrawQuad* texture_quad = | 209 TextureDrawQuad* texture_quad = |
| 209 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 210 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 210 texture_quad->SetNew(shared_quad_state, | 211 texture_quad->SetNew(shared_quad_state, |
| 211 quad_rect, | 212 quad_rect, |
| 212 opaque_rect, | 213 opaque_rect, |
| 213 visible_quad_rect, | 214 visible_quad_rect, |
| 214 software_resources_[0], | 215 software_resources_[0], |
| 215 premultiplied_alpha, | 216 premultiplied_alpha, |
| 216 uv_top_left, | 217 uv_top_left, |
| 217 uv_bottom_right, | 218 uv_bottom_right, |
| 218 SK_ColorTRANSPARENT, | 219 SK_ColorTRANSPARENT, |
| 219 opacity, | 220 opacity, |
| 220 flipped); | 221 flipped, |
| 222 nearest_neighbor); |
| 221 break; | 223 break; |
| 222 } | 224 } |
| 223 case VideoFrameExternalResources::YUV_RESOURCE: { | 225 case VideoFrameExternalResources::YUV_RESOURCE: { |
| 224 DCHECK_GE(frame_resources_.size(), 3u); | 226 DCHECK_GE(frame_resources_.size(), 3u); |
| 225 if (frame_resources_.size() < 3u) | 227 if (frame_resources_.size() < 3u) |
| 226 break; | 228 break; |
| 227 YUVVideoDrawQuad::ColorSpace color_space = | 229 YUVVideoDrawQuad::ColorSpace color_space = |
| 228 frame_->format() == media::VideoFrame::YV12J | 230 frame_->format() == media::VideoFrame::YV12J |
| 229 ? YUVVideoDrawQuad::REC_601_JPEG | 231 ? YUVVideoDrawQuad::REC_601_JPEG |
| 230 : YUVVideoDrawQuad::REC_601; | 232 : YUVVideoDrawQuad::REC_601; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 247 } | 249 } |
| 248 case VideoFrameExternalResources::RGB_RESOURCE: { | 250 case VideoFrameExternalResources::RGB_RESOURCE: { |
| 249 DCHECK_EQ(frame_resources_.size(), 1u); | 251 DCHECK_EQ(frame_resources_.size(), 1u); |
| 250 if (frame_resources_.size() < 1u) | 252 if (frame_resources_.size() < 1u) |
| 251 break; | 253 break; |
| 252 bool premultiplied_alpha = true; | 254 bool premultiplied_alpha = true; |
| 253 gfx::PointF uv_top_left(0.f, 0.f); | 255 gfx::PointF uv_top_left(0.f, 0.f); |
| 254 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); | 256 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); |
| 255 float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 257 float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 256 bool flipped = false; | 258 bool flipped = false; |
| 259 bool nearest_neighbor = false; |
| 257 TextureDrawQuad* texture_quad = | 260 TextureDrawQuad* texture_quad = |
| 258 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 261 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 259 texture_quad->SetNew(shared_quad_state, | 262 texture_quad->SetNew(shared_quad_state, |
| 260 quad_rect, | 263 quad_rect, |
| 261 opaque_rect, | 264 opaque_rect, |
| 262 visible_quad_rect, | 265 visible_quad_rect, |
| 263 frame_resources_[0], | 266 frame_resources_[0], |
| 264 premultiplied_alpha, | 267 premultiplied_alpha, |
| 265 uv_top_left, | 268 uv_top_left, |
| 266 uv_bottom_right, | 269 uv_bottom_right, |
| 267 SK_ColorTRANSPARENT, | 270 SK_ColorTRANSPARENT, |
| 268 opacity, | 271 opacity, |
| 269 flipped); | 272 flipped, |
| 273 nearest_neighbor); |
| 270 break; | 274 break; |
| 271 } | 275 } |
| 272 case VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE: { | 276 case VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE: { |
| 273 DCHECK_EQ(frame_resources_.size(), 1u); | 277 DCHECK_EQ(frame_resources_.size(), 1u); |
| 274 if (frame_resources_.size() < 1u) | 278 if (frame_resources_.size() < 1u) |
| 275 break; | 279 break; |
| 276 gfx::Transform scale; | 280 gfx::Transform scale; |
| 277 scale.Scale(tex_width_scale, tex_height_scale); | 281 scale.Scale(tex_width_scale, tex_height_scale); |
| 278 StreamVideoDrawQuad* stream_video_quad = | 282 StreamVideoDrawQuad* stream_video_quad = |
| 279 render_pass->CreateAndAppendDrawQuad<StreamVideoDrawQuad>(); | 283 render_pass->CreateAndAppendDrawQuad<StreamVideoDrawQuad>(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 void VideoLayerImpl::SetProviderClientImpl( | 374 void VideoLayerImpl::SetProviderClientImpl( |
| 371 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { | 375 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { |
| 372 provider_client_impl_ = provider_client_impl; | 376 provider_client_impl_ = provider_client_impl; |
| 373 } | 377 } |
| 374 | 378 |
| 375 const char* VideoLayerImpl::LayerTypeAsString() const { | 379 const char* VideoLayerImpl::LayerTypeAsString() const { |
| 376 return "cc::VideoLayerImpl"; | 380 return "cc::VideoLayerImpl"; |
| 377 } | 381 } |
| 378 | 382 |
| 379 } // namespace cc | 383 } // namespace cc |
| OLD | NEW |