OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surface_layer_impl.h" | 5 #include "cc/layers/surface_layer_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/trace_event/trace_event_argument.h" | 9 #include "base/trace_event/trace_event_argument.h" |
10 #include "cc/debug/debug_colors.h" | 10 #include "cc/debug/debug_colors.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 void SurfaceLayerImpl::AppendQuads(RenderPass* render_pass, | 65 void SurfaceLayerImpl::AppendQuads(RenderPass* render_pass, |
66 AppendQuadsData* append_quads_data) { | 66 AppendQuadsData* append_quads_data) { |
67 AppendRainbowDebugBorder(render_pass); | 67 AppendRainbowDebugBorder(render_pass); |
68 SharedQuadState* common_shared_quad_state = nullptr; | 68 SharedQuadState* common_shared_quad_state = nullptr; |
69 auto* primary = | 69 auto* primary = |
70 CreateSurfaceDrawQuad(render_pass, SurfaceDrawQuadType::PRIMARY, | 70 CreateSurfaceDrawQuad(render_pass, SurfaceDrawQuadType::PRIMARY, |
71 primary_surface_info_, &common_shared_quad_state); | 71 primary_surface_info_, &common_shared_quad_state); |
72 // Emitting a fallback SurfaceDrawQuad is unnecessary if the primary and | 72 // Emitting a fallback SurfaceDrawQuad is unnecessary if the primary and |
73 // fallback surface Ids match. | 73 // fallback surface Ids match. |
74 bool needs_fallback = | 74 bool needs_fallback = |
75 fallback_surface_info_.id() != primary_surface_info_.id(); | 75 fallback_surface_info_.is_valid() && |
| 76 (fallback_surface_info_.id() != primary_surface_info_.id()); |
76 if (primary && needs_fallback) { | 77 if (primary && needs_fallback) { |
77 // Add the primary surface ID as a dependency. | 78 // Add the primary surface ID as a dependency. |
78 append_quads_data->activation_dependencies.push_back( | 79 append_quads_data->activation_dependencies.push_back( |
79 primary_surface_info_.id()); | 80 primary_surface_info_.id()); |
80 // We can use the same SharedQuadState as the primary SurfaceDrawQuad if | 81 // We can use the same SharedQuadState as the primary SurfaceDrawQuad if |
81 // we don't need a different transform on the fallback. | 82 // we don't need a different transform on the fallback. |
82 bool use_common_shared_quad_state = | 83 bool use_common_shared_quad_state = |
83 !stretch_content_to_fill_bounds_ && | 84 !stretch_content_to_fill_bounds_ && |
84 primary_surface_info_.device_scale_factor() == | 85 primary_surface_info_.device_scale_factor() == |
85 fallback_surface_info_.device_scale_factor(); | 86 fallback_surface_info_.device_scale_factor(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 dict->SetString("surface_id", primary_surface_info_.id().ToString()); | 246 dict->SetString("surface_id", primary_surface_info_.id().ToString()); |
246 dict->SetString("fallback_surface_id", | 247 dict->SetString("fallback_surface_id", |
247 fallback_surface_info_.id().ToString()); | 248 fallback_surface_info_.id().ToString()); |
248 } | 249 } |
249 | 250 |
250 const char* SurfaceLayerImpl::LayerTypeAsString() const { | 251 const char* SurfaceLayerImpl::LayerTypeAsString() const { |
251 return "cc::SurfaceLayerImpl"; | 252 return "cc::SurfaceLayerImpl"; |
252 } | 253 } |
253 | 254 |
254 } // namespace cc | 255 } // namespace cc |
OLD | NEW |