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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 case FilterOperation::BLUR: | 60 case FilterOperation::BLUR: |
| 61 case FilterOperation::DROP_SHADOW: | 61 case FilterOperation::DROP_SHADOW: |
| 62 return true; | 62 return true; |
| 63 default: | 63 default: |
| 64 return false; | 64 return false; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 CALayerResult FromRenderPassQuad(ResourceProvider* resource_provider, | 68 CALayerResult FromRenderPassQuad(ResourceProvider* resource_provider, |
| 69 const RenderPassDrawQuad* quad, | 69 const RenderPassDrawQuad* quad, |
| 70 CALayerOverlay* ca_layer_overlay) { | 70 CALayerOverlay* ca_layer_overlay) { |
|
ccameron
2016/08/08 21:48:09
Cause we're messing with the 3D transforms, we can
| |
| 71 if (quad->background_filters.size() != 0) | 71 if (quad->background_filters.size() != 0) |
| 72 return CA_LAYER_FAILED_RENDER_PASS_BACKGROUND_FILTERS; | 72 return CA_LAYER_FAILED_RENDER_PASS_BACKGROUND_FILTERS; |
| 73 if (quad->mask_resource_id() != 0) | |
| 74 return CA_LAYER_FAILED_RENDER_PASS_MASK; | |
| 75 | 73 |
| 76 for (const FilterOperation& operation : quad->filters.operations()) { | 74 for (const FilterOperation& operation : quad->filters.operations()) { |
| 77 bool success = FilterOperationSupported(operation); | 75 bool success = FilterOperationSupported(operation); |
| 78 if (!success) | 76 if (!success) |
| 79 return CA_LAYER_FAILED_RENDER_PASS_FILTER_OPERATION; | 77 return CA_LAYER_FAILED_RENDER_PASS_FILTER_OPERATION; |
| 80 } | 78 } |
| 81 | 79 |
| 82 if (quad->filters_scale != gfx::Vector2dF(1, 1)) { | 80 ca_layer_overlay->rpdq = quad; |
| 83 for (const FilterOperation& operation : quad->filters.operations()) { | |
| 84 if (operation.type() == FilterOperation::BLUR || | |
| 85 operation.type() == FilterOperation::DROP_SHADOW) { | |
| 86 return CA_LAYER_FAILED_RENDER_PASS_FILTER_SCALE; | |
| 87 } | |
| 88 } | |
| 89 } | |
| 90 | |
| 91 ca_layer_overlay->contents_rect = gfx::RectF(0, 0, 1, 1); | 81 ca_layer_overlay->contents_rect = gfx::RectF(0, 0, 1, 1); |
| 92 | 82 |
| 93 // TODO(erikchen): Enable this when RenderPassDrawQuad promotion to CALayer | 83 // TODO(erikchen): Enable this when RenderPassDrawQuad promotion to CALayer |
| 94 // is fully functional. https://crbug.com/581526. | 84 // is fully functional. https://crbug.com/581526. |
| 95 if (g_allow_rpdq_quad_conversion) | 85 if (g_allow_rpdq_quad_conversion) |
| 96 return CA_LAYER_SUCCESS; | 86 return CA_LAYER_SUCCESS; |
| 97 return CA_LAYER_FAILED_RENDER_PASS; | 87 return CA_LAYER_FAILED_RENDER_PASS; |
| 98 } | 88 } |
| 99 | 89 |
| 100 CALayerResult FromStreamVideoQuad(ResourceProvider* resource_provider, | 90 CALayerResult FromStreamVideoQuad(ResourceProvider* resource_provider, |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 return false; | 298 return false; |
| 309 } | 299 } |
| 310 return true; | 300 return true; |
| 311 } | 301 } |
| 312 | 302 |
| 313 void EnableRenderPassDrawQuadForTesting() { | 303 void EnableRenderPassDrawQuadForTesting() { |
| 314 g_allow_rpdq_quad_conversion = true; | 304 g_allow_rpdq_quad_conversion = true; |
| 315 } | 305 } |
| 316 | 306 |
| 317 } // namespace cc | 307 } // namespace cc |
| OLD | NEW |