Chromium Code Reviews| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 Occlusion occlusion_in_video_space = | 178 Occlusion occlusion_in_video_space = |
| 179 draw_properties() | 179 draw_properties() |
| 180 .occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( | 180 .occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( |
| 181 transform); | 181 transform); |
| 182 gfx::Rect visible_quad_rect = | 182 gfx::Rect visible_quad_rect = |
| 183 occlusion_in_video_space.GetUnoccludedContentRect(quad_rect); | 183 occlusion_in_video_space.GetUnoccludedContentRect(quad_rect); |
| 184 if (visible_quad_rect.IsEmpty()) | 184 if (visible_quad_rect.IsEmpty()) |
| 185 return; | 185 return; |
| 186 | 186 |
| 187 // Pixels for macroblocked formats. | 187 // Pixels for macroblocked formats. |
| 188 const float tex_width_scale = | 188 float visible_width = static_cast<float>(visible_rect.width()); |
|
enne (OOO)
2016/02/01 21:00:03
Please leave these as ints and put the static cast
wuchengli
2016/02/02 05:37:27
Done.
| |
| 189 static_cast<float>(visible_rect.width()) / coded_size.width(); | 189 float visible_height = static_cast<float>(visible_rect.height()); |
| 190 const float tex_height_scale = | 190 // To prevent sampling outside the visible rect, stretch the video if needed. |
| 191 static_cast<float>(visible_rect.height()) / coded_size.height(); | 191 if (visible_rect.width() < coded_size.width() && visible_rect.width() > 1) |
| 192 visible_width -= 1.f; | |
|
wuchengli
2016/02/01 03:29:51
Do we want this for RGB_RESOURCE only or for all f
enne (OOO)
2016/02/01 21:00:03
If you do this here, it will be for all formats bu
wuchengli
2016/02/02 05:37:27
Done.
| |
| 193 if (visible_rect.height() < coded_size.height() && visible_rect.height() > 1) | |
| 194 visible_height -= 1.f; | |
| 195 const float tex_width_scale = visible_width / coded_size.width(); | |
| 196 const float tex_height_scale = visible_height / coded_size.height(); | |
| 192 | 197 |
| 193 switch (frame_resource_type_) { | 198 switch (frame_resource_type_) { |
| 194 // TODO(danakj): Remove this, hide it in the hardware path. | 199 // TODO(danakj): Remove this, hide it in the hardware path. |
| 195 case VideoFrameExternalResources::SOFTWARE_RESOURCE: { | 200 case VideoFrameExternalResources::SOFTWARE_RESOURCE: { |
| 196 DCHECK_EQ(frame_resources_.size(), 0u); | 201 DCHECK_EQ(frame_resources_.size(), 0u); |
| 197 DCHECK_EQ(software_resources_.size(), 1u); | 202 DCHECK_EQ(software_resources_.size(), 1u); |
| 198 if (software_resources_.size() < 1u) | 203 if (software_resources_.size() < 1u) |
| 199 break; | 204 break; |
| 200 bool premultiplied_alpha = true; | 205 bool premultiplied_alpha = true; |
| 201 gfx::PointF uv_top_left(0.f, 0.f); | 206 gfx::PointF uv_top_left(0.f, 0.f); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 void VideoLayerImpl::SetNeedsRedraw() { | 404 void VideoLayerImpl::SetNeedsRedraw() { |
| 400 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); | 405 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); |
| 401 layer_tree_impl()->SetNeedsRedraw(); | 406 layer_tree_impl()->SetNeedsRedraw(); |
| 402 } | 407 } |
| 403 | 408 |
| 404 const char* VideoLayerImpl::LayerTypeAsString() const { | 409 const char* VideoLayerImpl::LayerTypeAsString() const { |
| 405 return "cc::VideoLayerImpl"; | 410 return "cc::VideoLayerImpl"; |
| 406 } | 411 } |
| 407 | 412 |
| 408 } // namespace cc | 413 } // namespace cc |
| OLD | NEW |