| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 filter_effect.drop_shadow_offset = operation.drop_shadow_offset(); | 96 filter_effect.drop_shadow_offset = operation.drop_shadow_offset(); |
| 97 filter_effect.drop_shadow_color = operation.drop_shadow_color(); | 97 filter_effect.drop_shadow_color = operation.drop_shadow_color(); |
| 98 } | 98 } |
| 99 filter_effects->push_back(filter_effect); | 99 filter_effects->push_back(filter_effect); |
| 100 return true; | 100 return true; |
| 101 } | 101 } |
| 102 | 102 |
| 103 CALayerResult FromRenderPassQuad(ResourceProvider* resource_provider, | 103 CALayerResult FromRenderPassQuad(ResourceProvider* resource_provider, |
| 104 const RenderPassDrawQuad* quad, | 104 const RenderPassDrawQuad* quad, |
| 105 CALayerOverlay* ca_layer_overlay) { | 105 CALayerOverlay* ca_layer_overlay) { |
| 106 if (quad->filters_scale != gfx::Vector2dF(1, 1)) | |
| 107 return CA_LAYER_FAILED_RENDER_PASS_FILTER_SCALE; | |
| 108 if (quad->background_filters.size() != 0) | 106 if (quad->background_filters.size() != 0) |
| 109 return CA_LAYER_FAILED_RENDER_PASS_BACKGROUND_FILTERS; | 107 return CA_LAYER_FAILED_RENDER_PASS_BACKGROUND_FILTERS; |
| 110 if (quad->mask_resource_id() != 0) | 108 if (quad->mask_resource_id() != 0) |
| 111 return CA_LAYER_FAILED_RENDER_PASS_MASK; | 109 return CA_LAYER_FAILED_RENDER_PASS_MASK; |
| 112 | 110 |
| 113 for (const FilterOperation& operation : quad->filters.operations()) { | 111 for (const FilterOperation& operation : quad->filters.operations()) { |
| 114 bool success = ConvertAndAppendFilterOperation( | 112 bool success = ConvertAndAppendFilterOperation( |
| 115 operation, &ca_layer_overlay->filter_effects); | 113 operation, &ca_layer_overlay->filter_effects); |
| 116 if (!success) | 114 if (!success) |
| 117 return CA_LAYER_FAILED_RENDER_PASS_FILTER_OPERATION; | 115 return CA_LAYER_FAILED_RENDER_PASS_FILTER_OPERATION; |
| 118 } | 116 } |
| 119 | 117 |
| 118 if (quad->filters_scale != gfx::Vector2dF(1, 1)) { |
| 119 for (const ui::CARendererLayerParams::FilterEffect& effect : |
| 120 ca_layer_overlay->filter_effects) { |
| 121 using FilterEffectType = ui::CARendererLayerParams::FilterEffectType; |
| 122 if (effect.type == FilterEffectType::BLUR || |
| 123 effect.type == FilterEffectType::DROP_SHADOW) { |
| 124 return CA_LAYER_FAILED_RENDER_PASS_FILTER_SCALE; |
| 125 } |
| 126 } |
| 127 } |
| 128 |
| 120 ca_layer_overlay->render_pass_id = quad->render_pass_id; | 129 ca_layer_overlay->render_pass_id = quad->render_pass_id; |
| 121 ca_layer_overlay->contents_rect = gfx::RectF(0, 0, 1, 1); | 130 ca_layer_overlay->contents_rect = gfx::RectF(0, 0, 1, 1); |
| 122 | 131 |
| 123 return CA_LAYER_SUCCESS; | 132 return CA_LAYER_SUCCESS; |
| 124 } | 133 } |
| 125 | 134 |
| 126 CALayerResult FromStreamVideoQuad(ResourceProvider* resource_provider, | 135 CALayerResult FromStreamVideoQuad(ResourceProvider* resource_provider, |
| 127 const StreamVideoDrawQuad* quad, | 136 const StreamVideoDrawQuad* quad, |
| 128 CALayerOverlay* ca_layer_overlay) { | 137 CALayerOverlay* ca_layer_overlay) { |
| 129 unsigned resource_id = quad->resource_id(); | 138 unsigned resource_id = quad->resource_id(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 CA_LAYER_FAILED_COUNT); | 339 CA_LAYER_FAILED_COUNT); |
| 331 | 340 |
| 332 if (result != CA_LAYER_SUCCESS) { | 341 if (result != CA_LAYER_SUCCESS) { |
| 333 ca_layer_overlays->clear(); | 342 ca_layer_overlays->clear(); |
| 334 return false; | 343 return false; |
| 335 } | 344 } |
| 336 return true; | 345 return true; |
| 337 } | 346 } |
| 338 | 347 |
| 339 } // namespace cc | 348 } // namespace cc |
| OLD | NEW |