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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 if (software_resources_.size() < 1u) | 210 if (software_resources_.size() < 1u) |
211 break; | 211 break; |
212 bool premultiplied_alpha = true; | 212 bool premultiplied_alpha = true; |
213 gfx::PointF uv_top_left(0.f, 0.f); | 213 gfx::PointF uv_top_left(0.f, 0.f); |
214 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); | 214 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); |
215 float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 215 float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
216 bool flipped = false; | 216 bool flipped = false; |
217 bool nearest_neighbor = false; | 217 bool nearest_neighbor = false; |
218 TextureDrawQuad* texture_quad = | 218 TextureDrawQuad* texture_quad = |
219 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 219 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
220 texture_quad->SetNew(shared_quad_state, | 220 texture_quad->SetNew(shared_quad_state, quad_rect, opaque_rect, |
221 quad_rect, | 221 visible_quad_rect, software_resources_[0], |
222 opaque_rect, | 222 premultiplied_alpha, uv_top_left, uv_bottom_right, |
223 visible_quad_rect, | 223 SK_ColorTRANSPARENT, opacity, flipped, |
224 software_resources_[0], | 224 nearest_neighbor, false); |
225 premultiplied_alpha, | |
226 uv_top_left, | |
227 uv_bottom_right, | |
228 SK_ColorTRANSPARENT, | |
229 opacity, | |
230 flipped, | |
231 nearest_neighbor); | |
232 ValidateQuadResources(texture_quad); | 225 ValidateQuadResources(texture_quad); |
233 break; | 226 break; |
234 } | 227 } |
235 case VideoFrameExternalResources::YUV_RESOURCE: { | 228 case VideoFrameExternalResources::YUV_RESOURCE: { |
236 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601; | 229 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601; |
237 int videoframe_color_space; | 230 int videoframe_color_space; |
238 if (frame_->metadata()->GetInteger(media::VideoFrameMetadata::COLOR_SPACE, | 231 if (frame_->metadata()->GetInteger(media::VideoFrameMetadata::COLOR_SPACE, |
239 &videoframe_color_space)) { | 232 &videoframe_color_space)) { |
240 if (videoframe_color_space == media::COLOR_SPACE_JPEG) { | 233 if (videoframe_color_space == media::COLOR_SPACE_JPEG) { |
241 color_space = YUVVideoDrawQuad::JPEG; | 234 color_space = YUVVideoDrawQuad::JPEG; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); | 299 gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); |
307 float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 300 float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
308 bool flipped = false; | 301 bool flipped = false; |
309 bool nearest_neighbor = false; | 302 bool nearest_neighbor = false; |
310 TextureDrawQuad* texture_quad = | 303 TextureDrawQuad* texture_quad = |
311 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 304 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
312 texture_quad->SetNew(shared_quad_state, quad_rect, opaque_rect, | 305 texture_quad->SetNew(shared_quad_state, quad_rect, opaque_rect, |
313 visible_quad_rect, frame_resources_[0].id, | 306 visible_quad_rect, frame_resources_[0].id, |
314 premultiplied_alpha, uv_top_left, uv_bottom_right, | 307 premultiplied_alpha, uv_top_left, uv_bottom_right, |
315 SK_ColorTRANSPARENT, opacity, flipped, | 308 SK_ColorTRANSPARENT, opacity, flipped, |
316 nearest_neighbor); | 309 nearest_neighbor, false); |
317 ValidateQuadResources(texture_quad); | 310 ValidateQuadResources(texture_quad); |
318 break; | 311 break; |
319 } | 312 } |
320 case VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE: { | 313 case VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE: { |
321 DCHECK_EQ(frame_resources_.size(), 1u); | 314 DCHECK_EQ(frame_resources_.size(), 1u); |
322 if (frame_resources_.size() < 1u) | 315 if (frame_resources_.size() < 1u) |
323 break; | 316 break; |
324 gfx::Transform scale; | 317 gfx::Transform scale; |
325 scale.Scale(tex_width_scale, tex_height_scale); | 318 scale.Scale(tex_width_scale, tex_height_scale); |
326 StreamVideoDrawQuad* stream_video_quad = | 319 StreamVideoDrawQuad* stream_video_quad = |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 void VideoLayerImpl::SetNeedsRedraw() { | 398 void VideoLayerImpl::SetNeedsRedraw() { |
406 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); | 399 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); |
407 layer_tree_impl()->SetNeedsRedraw(); | 400 layer_tree_impl()->SetNeedsRedraw(); |
408 } | 401 } |
409 | 402 |
410 const char* VideoLayerImpl::LayerTypeAsString() const { | 403 const char* VideoLayerImpl::LayerTypeAsString() const { |
411 return "cc::VideoLayerImpl"; | 404 return "cc::VideoLayerImpl"; |
412 } | 405 } |
413 | 406 |
414 } // namespace cc | 407 } // namespace cc |
OLD | NEW |