| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/output/overlay_strategy_common.h" | 5 #include "cc/output/overlay_strategy_common.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "cc/quads/solid_color_draw_quad.h" | 9 #include "cc/quads/solid_color_draw_quad.h" |
| 10 #include "cc/quads/stream_video_draw_quad.h" | 10 #include "cc/quads/stream_video_draw_quad.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return solid_quad->ShouldDrawWithBlending() && | 43 return solid_quad->ShouldDrawWithBlending() && |
| 44 alpha < std::numeric_limits<float>::epsilon(); | 44 alpha < std::numeric_limits<float>::epsilon(); |
| 45 } | 45 } |
| 46 return false; | 46 return false; |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool OverlayStrategyCommon::GetTextureQuadInfo(const TextureDrawQuad& quad, | 49 bool OverlayStrategyCommon::GetTextureQuadInfo(const TextureDrawQuad& quad, |
| 50 OverlayCandidate* quad_info) { | 50 OverlayCandidate* quad_info) { |
| 51 gfx::OverlayTransform overlay_transform = | 51 gfx::OverlayTransform overlay_transform = |
| 52 OverlayCandidate::GetOverlayTransform( | 52 OverlayCandidate::GetOverlayTransform( |
| 53 quad.shared_quad_state->content_to_target_transform, quad.y_flipped); | 53 quad.shared_quad_state->quad_to_target_transform, quad.y_flipped); |
| 54 if (quad.background_color != SK_ColorTRANSPARENT || | 54 if (quad.background_color != SK_ColorTRANSPARENT || |
| 55 quad.premultiplied_alpha || | 55 quad.premultiplied_alpha || |
| 56 overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID) | 56 overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID) |
| 57 return false; | 57 return false; |
| 58 quad_info->resource_id = quad.resource_id(); | 58 quad_info->resource_id = quad.resource_id(); |
| 59 quad_info->resource_size_in_pixels = quad.resource_size_in_pixels(); | 59 quad_info->resource_size_in_pixels = quad.resource_size_in_pixels(); |
| 60 quad_info->transform = overlay_transform; | 60 quad_info->transform = overlay_transform; |
| 61 quad_info->uv_rect = BoundingRect(quad.uv_top_left, quad.uv_bottom_right); | 61 quad_info->uv_rect = BoundingRect(quad.uv_top_left, quad.uv_bottom_right); |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool OverlayStrategyCommon::GetVideoQuadInfo(const StreamVideoDrawQuad& quad, | 65 bool OverlayStrategyCommon::GetVideoQuadInfo(const StreamVideoDrawQuad& quad, |
| 66 OverlayCandidate* quad_info) { | 66 OverlayCandidate* quad_info) { |
| 67 gfx::OverlayTransform overlay_transform = | 67 gfx::OverlayTransform overlay_transform = |
| 68 OverlayCandidate::GetOverlayTransform( | 68 OverlayCandidate::GetOverlayTransform( |
| 69 quad.shared_quad_state->content_to_target_transform, false); | 69 quad.shared_quad_state->quad_to_target_transform, false); |
| 70 if (overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID) | 70 if (overlay_transform == gfx::OVERLAY_TRANSFORM_INVALID) |
| 71 return false; | 71 return false; |
| 72 if (!quad.matrix.IsScaleOrTranslation()) { | 72 if (!quad.matrix.IsScaleOrTranslation()) { |
| 73 // We cannot handle anything other than scaling & translation for texture | 73 // We cannot handle anything other than scaling & translation for texture |
| 74 // coordinates yet. | 74 // coordinates yet. |
| 75 return false; | 75 return false; |
| 76 } | 76 } |
| 77 quad_info->resource_id = quad.resource_id(); | 77 quad_info->resource_id = quad.resource_id(); |
| 78 quad_info->resource_size_in_pixels = quad.resource_size_in_pixels(); | 78 quad_info->resource_size_in_pixels = quad.resource_size_in_pixels(); |
| 79 quad_info->transform = overlay_transform; | 79 quad_info->transform = overlay_transform; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return false; | 118 return false; |
| 119 } else if (draw_quad.material == DrawQuad::STREAM_VIDEO_CONTENT) { | 119 } else if (draw_quad.material == DrawQuad::STREAM_VIDEO_CONTENT) { |
| 120 const StreamVideoDrawQuad& quad = | 120 const StreamVideoDrawQuad& quad = |
| 121 *StreamVideoDrawQuad::MaterialCast(&draw_quad); | 121 *StreamVideoDrawQuad::MaterialCast(&draw_quad); |
| 122 if (!GetVideoQuadInfo(quad, quad_info)) | 122 if (!GetVideoQuadInfo(quad, quad_info)) |
| 123 return false; | 123 return false; |
| 124 } | 124 } |
| 125 | 125 |
| 126 quad_info->format = RGBA_8888; | 126 quad_info->format = RGBA_8888; |
| 127 quad_info->display_rect = OverlayCandidate::GetOverlayRect( | 127 quad_info->display_rect = OverlayCandidate::GetOverlayRect( |
| 128 draw_quad.shared_quad_state->content_to_target_transform, draw_quad.rect); | 128 draw_quad.shared_quad_state->quad_to_target_transform, draw_quad.rect); |
| 129 return true; | 129 return true; |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace cc | 132 } // namespace cc |
| OLD | NEW |