Chromium Code Reviews| 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/ca_layer_overlay.h" | 5 #include "cc/output/ca_layer_overlay.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "cc/quads/render_pass_draw_quad.h" | 8 #include "cc/quads/render_pass_draw_quad.h" |
| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 for (const ui::CARendererLayerParams::FilterEffect& effect : | 121 for (const ui::CARendererLayerParams::FilterEffect& effect : |
| 122 ca_layer_overlay->filter_effects) { | 122 ca_layer_overlay->filter_effects) { |
| 123 using FilterEffectType = ui::CARendererLayerParams::FilterEffectType; | 123 using FilterEffectType = ui::CARendererLayerParams::FilterEffectType; |
| 124 if (effect.type == FilterEffectType::BLUR || | 124 if (effect.type == FilterEffectType::BLUR || |
| 125 effect.type == FilterEffectType::DROP_SHADOW) { | 125 effect.type == FilterEffectType::DROP_SHADOW) { |
| 126 return CA_LAYER_FAILED_RENDER_PASS_FILTER_SCALE; | 126 return CA_LAYER_FAILED_RENDER_PASS_FILTER_SCALE; |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 // The original RenderPassDrawQuad will be destroyed before the GLRenderer has | |
| 132 // a chance to do any copying. Save a new copy. | |
| 133 ca_layer_overlay->rpdq.reset(new RenderPassDrawQuad(*quad)); | |
| 131 ca_layer_overlay->render_pass_id = quad->render_pass_id; | 134 ca_layer_overlay->render_pass_id = quad->render_pass_id; |
| 132 ca_layer_overlay->contents_rect = gfx::RectF(0, 0, 1, 1); | 135 ca_layer_overlay->contents_rect = gfx::RectF(0, 0, 1, 1); |
| 133 | 136 |
| 134 // TODO(erikchen): Enable this when RenderPassDrawQuad promotion to CALayer | 137 // TODO(erikchen): Enable this when RenderPassDrawQuad promotion to CALayer |
| 135 // is fully functional. https://crbug.com/581526. | 138 // is fully functional. https://crbug.com/581526. |
| 136 if (g_allow_rpdq_quad_conversion) | 139 if (g_allow_rpdq_quad_conversion) |
| 137 return CA_LAYER_SUCCESS; | 140 return CA_LAYER_SUCCESS; |
| 138 return CA_LAYER_FAILED_RENDER_PASS; | 141 return CA_LAYER_FAILED_RENDER_PASS; |
| 139 } | 142 } |
| 140 | 143 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 return CA_LAYER_FAILED_UNKNOWN; | 290 return CA_LAYER_FAILED_UNKNOWN; |
| 288 } | 291 } |
| 289 | 292 |
| 290 private: | 293 private: |
| 291 const SharedQuadState* most_recent_shared_quad_state_ = nullptr; | 294 const SharedQuadState* most_recent_shared_quad_state_ = nullptr; |
| 292 scoped_refptr<CALayerOverlaySharedState> most_recent_overlay_shared_state_; | 295 scoped_refptr<CALayerOverlaySharedState> most_recent_overlay_shared_state_; |
| 293 }; | 296 }; |
| 294 | 297 |
| 295 } // namespace | 298 } // namespace |
| 296 | 299 |
| 300 CALayerOverlaySharedState& CALayerOverlaySharedState::operator=( | |
| 301 const CALayerOverlaySharedState& other) { | |
| 302 sorting_context_id = other.sorting_context_id; | |
| 303 is_clipped = other.is_clipped; | |
| 304 clip_rect = other.clip_rect; | |
| 305 opacity = other.opacity; | |
| 306 transform = other.transform; | |
| 307 return *this; | |
|
ccameron
2016/08/04 01:46:01
This can just be =default then, right?
erikchen
2016/08/05 17:15:06
No longer necessary at all.
| |
| 308 } | |
| 309 | |
| 297 CALayerOverlay::CALayerOverlay() : filter(GL_LINEAR) {} | 310 CALayerOverlay::CALayerOverlay() : filter(GL_LINEAR) {} |
| 298 | 311 |
| 299 CALayerOverlay::CALayerOverlay(const CALayerOverlay& other) = default; | 312 CALayerOverlay::CALayerOverlay(const CALayerOverlay& other) = default; |
| 300 | 313 |
| 301 CALayerOverlay::~CALayerOverlay() {} | 314 CALayerOverlay::~CALayerOverlay() {} |
| 302 | 315 |
| 303 bool ProcessForCALayerOverlays(ResourceProvider* resource_provider, | 316 bool ProcessForCALayerOverlays(ResourceProvider* resource_provider, |
| 304 const gfx::RectF& display_rect, | 317 const gfx::RectF& display_rect, |
| 305 const QuadList& quad_list, | 318 const QuadList& quad_list, |
| 306 CALayerOverlayList* ca_layer_overlays) { | 319 CALayerOverlayList* ca_layer_overlays) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 return false; | 362 return false; |
| 350 } | 363 } |
| 351 return true; | 364 return true; |
| 352 } | 365 } |
| 353 | 366 |
| 354 void EnableRenderPassDrawQuadForTesting() { | 367 void EnableRenderPassDrawQuadForTesting() { |
| 355 g_allow_rpdq_quad_conversion = true; | 368 g_allow_rpdq_quad_conversion = true; |
| 356 } | 369 } |
| 357 | 370 |
| 358 } // namespace cc | 371 } // namespace cc |
| OLD | NEW |