Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: cc/output/ca_layer_overlay.cc

Issue 2205133003: Implement new RPDQ copy logic for CALayer promotion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp60_more_refactor
Patch Set: Comments from ccameron. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/ca_layer_overlay.h ('k') | cc/output/gl_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 CA_LAYER_FAILED_PICTURE_CONTENT, 37 CA_LAYER_FAILED_PICTURE_CONTENT,
38 CA_LAYER_FAILED_RENDER_PASS, 38 CA_LAYER_FAILED_RENDER_PASS,
39 CA_LAYER_FAILED_SURFACE_CONTENT, 39 CA_LAYER_FAILED_SURFACE_CONTENT,
40 CA_LAYER_FAILED_YUV_VIDEO_CONTENT, 40 CA_LAYER_FAILED_YUV_VIDEO_CONTENT,
41 CA_LAYER_FAILED_DIFFERENT_CLIP_SETTINGS, 41 CA_LAYER_FAILED_DIFFERENT_CLIP_SETTINGS,
42 CA_LAYER_FAILED_DIFFERENT_VERTEX_OPACITIES, 42 CA_LAYER_FAILED_DIFFERENT_VERTEX_OPACITIES,
43 CA_LAYER_FAILED_RENDER_PASS_FILTER_SCALE, 43 CA_LAYER_FAILED_RENDER_PASS_FILTER_SCALE,
44 CA_LAYER_FAILED_RENDER_PASS_BACKGROUND_FILTERS, 44 CA_LAYER_FAILED_RENDER_PASS_BACKGROUND_FILTERS,
45 CA_LAYER_FAILED_RENDER_PASS_MASK, 45 CA_LAYER_FAILED_RENDER_PASS_MASK,
46 CA_LAYER_FAILED_RENDER_PASS_FILTER_OPERATION, 46 CA_LAYER_FAILED_RENDER_PASS_FILTER_OPERATION,
47 CA_LAYER_FAILED_RENDER_PASS_SORTING_CONTEXT_ID,
47 CA_LAYER_FAILED_COUNT, 48 CA_LAYER_FAILED_COUNT,
48 }; 49 };
49 50
50 bool FilterOperationSupported(const FilterOperation& operation) { 51 bool FilterOperationSupported(const FilterOperation& operation) {
51 switch (operation.type()) { 52 switch (operation.type()) {
52 case FilterOperation::GRAYSCALE: 53 case FilterOperation::GRAYSCALE:
53 case FilterOperation::SEPIA: 54 case FilterOperation::SEPIA:
54 case FilterOperation::SATURATE: 55 case FilterOperation::SATURATE:
55 case FilterOperation::HUE_ROTATE: 56 case FilterOperation::HUE_ROTATE:
56 case FilterOperation::INVERT: 57 case FilterOperation::INVERT:
57 case FilterOperation::BRIGHTNESS: 58 case FilterOperation::BRIGHTNESS:
58 case FilterOperation::CONTRAST: 59 case FilterOperation::CONTRAST:
59 case FilterOperation::OPACITY: 60 case FilterOperation::OPACITY:
60 case FilterOperation::BLUR: 61 case FilterOperation::BLUR:
61 case FilterOperation::DROP_SHADOW: 62 case FilterOperation::DROP_SHADOW:
62 return true; 63 return true;
63 default: 64 default:
64 return false; 65 return false;
65 } 66 }
66 } 67 }
67 68
68 CALayerResult FromRenderPassQuad(ResourceProvider* resource_provider, 69 CALayerResult FromRenderPassQuad(ResourceProvider* resource_provider,
69 const RenderPassDrawQuad* quad, 70 const RenderPassDrawQuad* quad,
70 CALayerOverlay* ca_layer_overlay) { 71 CALayerOverlay* ca_layer_overlay) {
71 if (quad->background_filters.size() != 0) 72 if (quad->background_filters.size() != 0)
72 return CA_LAYER_FAILED_RENDER_PASS_BACKGROUND_FILTERS; 73 return CA_LAYER_FAILED_RENDER_PASS_BACKGROUND_FILTERS;
73 if (quad->mask_resource_id() != 0) 74
74 return CA_LAYER_FAILED_RENDER_PASS_MASK; 75 if (quad->shared_quad_state->sorting_context_id != 0)
76 return CA_LAYER_FAILED_RENDER_PASS_SORTING_CONTEXT_ID;
75 77
76 for (const FilterOperation& operation : quad->filters.operations()) { 78 for (const FilterOperation& operation : quad->filters.operations()) {
77 bool success = FilterOperationSupported(operation); 79 bool success = FilterOperationSupported(operation);
78 if (!success) 80 if (!success)
79 return CA_LAYER_FAILED_RENDER_PASS_FILTER_OPERATION; 81 return CA_LAYER_FAILED_RENDER_PASS_FILTER_OPERATION;
80 } 82 }
81 83
82 if (quad->filters_scale != gfx::Vector2dF(1, 1)) { 84 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); 85 ca_layer_overlay->contents_rect = gfx::RectF(0, 0, 1, 1);
92 86
93 // TODO(erikchen): Enable this when RenderPassDrawQuad promotion to CALayer 87 // TODO(erikchen): Enable this when RenderPassDrawQuad promotion to CALayer
94 // is fully functional. https://crbug.com/581526. 88 // is fully functional. https://crbug.com/581526.
95 if (g_allow_rpdq_quad_conversion) 89 if (g_allow_rpdq_quad_conversion)
96 return CA_LAYER_SUCCESS; 90 return CA_LAYER_SUCCESS;
97 return CA_LAYER_FAILED_RENDER_PASS; 91 return CA_LAYER_FAILED_RENDER_PASS;
98 } 92 }
99 93
100 CALayerResult FromStreamVideoQuad(ResourceProvider* resource_provider, 94 CALayerResult FromStreamVideoQuad(ResourceProvider* resource_provider,
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 return false; 302 return false;
309 } 303 }
310 return true; 304 return true;
311 } 305 }
312 306
313 void EnableRenderPassDrawQuadForTesting() { 307 void EnableRenderPassDrawQuadForTesting() {
314 g_allow_rpdq_quad_conversion = true; 308 g_allow_rpdq_quad_conversion = true;
315 } 309 }
316 310
317 } // namespace cc 311 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/ca_layer_overlay.h ('k') | cc/output/gl_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698