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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 if (external_resources.type == | 114 if (external_resources.type == |
115 VideoFrameExternalResources::SOFTWARE_RESOURCE) { | 115 VideoFrameExternalResources::SOFTWARE_RESOURCE) { |
116 software_resources_ = external_resources.software_resources; | 116 software_resources_ = external_resources.software_resources; |
117 software_release_callback_ = | 117 software_release_callback_ = |
118 external_resources.software_release_callback; | 118 external_resources.software_release_callback; |
119 return true; | 119 return true; |
120 } | 120 } |
121 frame_resource_offset_ = external_resources.offset; | 121 frame_resource_offset_ = external_resources.offset; |
122 frame_resource_multiplier_ = external_resources.multiplier; | 122 frame_resource_multiplier_ = external_resources.multiplier; |
| 123 frame_bits_per_channel_ = external_resources.bits_per_channel; |
123 | 124 |
124 DCHECK_EQ(external_resources.mailboxes.size(), | 125 DCHECK_EQ(external_resources.mailboxes.size(), |
125 external_resources.release_callbacks.size()); | 126 external_resources.release_callbacks.size()); |
126 ResourceProvider::ResourceIdArray resource_ids; | 127 ResourceProvider::ResourceIdArray resource_ids; |
127 resource_ids.reserve(external_resources.mailboxes.size()); | 128 resource_ids.reserve(external_resources.mailboxes.size()); |
128 for (size_t i = 0; i < external_resources.mailboxes.size(); ++i) { | 129 for (size_t i = 0; i < external_resources.mailboxes.size(); ++i) { |
129 unsigned resource_id = resource_provider->CreateResourceFromTextureMailbox( | 130 unsigned resource_id = resource_provider->CreateResourceFromTextureMailbox( |
130 external_resources.mailboxes[i], | 131 external_resources.mailboxes[i], |
131 SingleReleaseCallbackImpl::Create( | 132 SingleReleaseCallbackImpl::Create( |
132 external_resources.release_callbacks[i]), | 133 external_resources.release_callbacks[i]), |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 275 |
275 YUVVideoDrawQuad* yuv_video_quad = | 276 YUVVideoDrawQuad* yuv_video_quad = |
276 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); | 277 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); |
277 yuv_video_quad->SetNew( | 278 yuv_video_quad->SetNew( |
278 shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, | 279 shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, |
279 ya_tex_coord_rect, uv_tex_coord_rect, ya_tex_size, uv_tex_size, | 280 ya_tex_coord_rect, uv_tex_coord_rect, ya_tex_size, uv_tex_size, |
280 frame_resources_[0].id, frame_resources_[1].id, | 281 frame_resources_[0].id, frame_resources_[1].id, |
281 frame_resources_.size() > 2 ? frame_resources_[2].id | 282 frame_resources_.size() > 2 ? frame_resources_[2].id |
282 : frame_resources_[1].id, | 283 : frame_resources_[1].id, |
283 frame_resources_.size() > 3 ? frame_resources_[3].id : 0, color_space, | 284 frame_resources_.size() > 3 ? frame_resources_[3].id : 0, color_space, |
284 frame_resource_offset_, frame_resource_multiplier_); | 285 frame_resource_offset_, frame_resource_multiplier_, |
| 286 frame_bits_per_channel_); |
285 ValidateQuadResources(yuv_video_quad); | 287 ValidateQuadResources(yuv_video_quad); |
286 break; | 288 break; |
287 } | 289 } |
288 case VideoFrameExternalResources::RGBA_RESOURCE: | 290 case VideoFrameExternalResources::RGBA_RESOURCE: |
289 case VideoFrameExternalResources::RGBA_PREMULTIPLIED_RESOURCE: | 291 case VideoFrameExternalResources::RGBA_PREMULTIPLIED_RESOURCE: |
290 case VideoFrameExternalResources::RGB_RESOURCE: { | 292 case VideoFrameExternalResources::RGB_RESOURCE: { |
291 DCHECK_EQ(frame_resources_.size(), 1u); | 293 DCHECK_EQ(frame_resources_.size(), 1u); |
292 if (frame_resources_.size() < 1u) | 294 if (frame_resources_.size() < 1u) |
293 break; | 295 break; |
294 bool premultiplied_alpha = | 296 bool premultiplied_alpha = |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 void VideoLayerImpl::SetNeedsRedraw() { | 399 void VideoLayerImpl::SetNeedsRedraw() { |
398 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); | 400 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); |
399 layer_tree_impl()->SetNeedsRedraw(); | 401 layer_tree_impl()->SetNeedsRedraw(); |
400 } | 402 } |
401 | 403 |
402 const char* VideoLayerImpl::LayerTypeAsString() const { | 404 const char* VideoLayerImpl::LayerTypeAsString() const { |
403 return "cc::VideoLayerImpl"; | 405 return "cc::VideoLayerImpl"; |
404 } | 406 } |
405 | 407 |
406 } // namespace cc | 408 } // namespace cc |
OLD | NEW |