OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <AVFoundation/AVFoundation.h> | 5 #include <AVFoundation/AVFoundation.h> |
6 #include <memory> | 6 #include <memory> |
7 | 7 |
8 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
9 #include "gpu/GLES2/gl2extchromium.h" | 9 #include "gpu/GLES2/gl2extchromium.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "testing/gtest_mac.h" |
11 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
12 #include "ui/accelerated_widget_mac/ca_renderer_layer_tree.h" | 13 #include "ui/accelerated_widget_mac/ca_renderer_layer_tree.h" |
13 #include "ui/gfx/geometry/dip_util.h" | 14 #include "ui/gfx/geometry/dip_util.h" |
14 #include "ui/gfx/mac/io_surface.h" | 15 #include "ui/gfx/mac/io_surface.h" |
15 | 16 |
16 namespace gpu { | 17 namespace gpu { |
17 | 18 |
18 class CALayerTreeTest : public testing::Test { | 19 class CALayerTreeTest : public testing::Test { |
19 protected: | 20 protected: |
20 void SetUp() override { | 21 void SetUp() override { |
(...skipping 13 matching lines...) Expand all Loading... |
34 bool is_clipped = true; | 35 bool is_clipped = true; |
35 gfx::Rect clip_rect(2, 4, 8, 16); | 36 gfx::Rect clip_rect(2, 4, 8, 16); |
36 int sorting_context_id = 0; | 37 int sorting_context_id = 0; |
37 gfx::Transform transform; | 38 gfx::Transform transform; |
38 transform.Translate(10, 20); | 39 transform.Translate(10, 20); |
39 gfx::RectF contents_rect(0.0f, 0.25f, 0.5f, 0.75f); | 40 gfx::RectF contents_rect(0.0f, 0.25f, 0.5f, 0.75f); |
40 gfx::Rect rect(16, 32, 64, 128); | 41 gfx::Rect rect(16, 32, 64, 128); |
41 unsigned background_color = SkColorSetARGB(0xFF, 0xFF, 0, 0); | 42 unsigned background_color = SkColorSetARGB(0xFF, 0xFF, 0, 0); |
42 unsigned edge_aa_mask = GL_CA_LAYER_EDGE_LEFT_CHROMIUM; | 43 unsigned edge_aa_mask = GL_CA_LAYER_EDGE_LEFT_CHROMIUM; |
43 float opacity = 0.5f; | 44 float opacity = 0.5f; |
| 45 unsigned filter = GL_LINEAR; |
44 float scale_factor = 1.0f; | 46 float scale_factor = 1.0f; |
45 bool result = false; | 47 bool result = false; |
46 | 48 |
47 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree; | 49 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree; |
48 CALayer* root_layer = nil; | 50 CALayer* root_layer = nil; |
49 CALayer* clip_and_sorting_layer = nil; | 51 CALayer* clip_and_sorting_layer = nil; |
50 CALayer* transform_layer = nil; | 52 CALayer* transform_layer = nil; |
51 CALayer* content_layer = nil; | 53 CALayer* content_layer = nil; |
52 | 54 |
53 // Validate the initial values. | 55 // Validate the initial values. |
54 { | 56 { |
55 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( | 57 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( |
56 new ui::CARendererLayerTree); | 58 new ui::CARendererLayerTree); |
57 result = new_ca_layer_tree->ScheduleCALayer( | 59 result = new_ca_layer_tree->ScheduleCALayer( |
58 is_clipped, | 60 is_clipped, |
59 clip_rect, | 61 clip_rect, |
60 sorting_context_id, | 62 sorting_context_id, |
61 transform, | 63 transform, |
62 io_surface, | 64 io_surface, |
63 nullptr, | 65 nullptr, |
64 contents_rect, | 66 contents_rect, |
65 rect, | 67 rect, |
66 background_color, | 68 background_color, |
67 edge_aa_mask, | 69 edge_aa_mask, |
68 opacity); | 70 opacity, |
| 71 filter); |
69 EXPECT_TRUE(result); | 72 EXPECT_TRUE(result); |
70 new_ca_layer_tree->CommitScheduledCALayers( | 73 new_ca_layer_tree->CommitScheduledCALayers( |
71 superlayer_, std::move(ca_layer_tree), scale_factor); | 74 superlayer_, std::move(ca_layer_tree), scale_factor); |
72 std::swap(new_ca_layer_tree, ca_layer_tree); | 75 std::swap(new_ca_layer_tree, ca_layer_tree); |
73 | 76 |
74 // Validate the tree structure. | 77 // Validate the tree structure. |
75 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 78 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
76 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; | 79 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
77 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 80 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
78 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; | 81 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; |
(...skipping 19 matching lines...) Expand all Loading... |
98 EXPECT_EQ(transform.matrix().get(3, 1), | 101 EXPECT_EQ(transform.matrix().get(3, 1), |
99 [transform_layer sublayerTransform].m42); | 102 [transform_layer sublayerTransform].m42); |
100 | 103 |
101 // Validate the content layer. | 104 // Validate the content layer. |
102 EXPECT_EQ(static_cast<id>(io_surface.get()), [content_layer contents]); | 105 EXPECT_EQ(static_cast<id>(io_surface.get()), [content_layer contents]); |
103 EXPECT_EQ(contents_rect, gfx::RectF([content_layer contentsRect])); | 106 EXPECT_EQ(contents_rect, gfx::RectF([content_layer contentsRect])); |
104 EXPECT_EQ(rect.origin(), gfx::Point([content_layer position])); | 107 EXPECT_EQ(rect.origin(), gfx::Point([content_layer position])); |
105 EXPECT_EQ(gfx::Rect(rect.size()), gfx::Rect([content_layer bounds])); | 108 EXPECT_EQ(gfx::Rect(rect.size()), gfx::Rect([content_layer bounds])); |
106 EXPECT_EQ(kCALayerLeftEdge, [content_layer edgeAntialiasingMask]); | 109 EXPECT_EQ(kCALayerLeftEdge, [content_layer edgeAntialiasingMask]); |
107 EXPECT_EQ(opacity, [content_layer opacity]); | 110 EXPECT_EQ(opacity, [content_layer opacity]); |
| 111 EXPECT_NSEQ(kCAFilterLinear, [content_layer minificationFilter]); |
| 112 EXPECT_NSEQ(kCAFilterLinear, [content_layer magnificationFilter]); |
108 if ([content_layer respondsToSelector:(@selector(contentsScale))]) | 113 if ([content_layer respondsToSelector:(@selector(contentsScale))]) |
109 EXPECT_EQ(scale_factor, [content_layer contentsScale]); | 114 EXPECT_EQ(scale_factor, [content_layer contentsScale]); |
110 } | 115 } |
111 | 116 |
112 // Update just the clip rect and re-commit. | 117 // Update just the clip rect and re-commit. |
113 { | 118 { |
114 clip_rect = gfx::Rect(4, 8, 16, 32); | 119 clip_rect = gfx::Rect(4, 8, 16, 32); |
115 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( | 120 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( |
116 new ui::CARendererLayerTree); | 121 new ui::CARendererLayerTree); |
117 result = new_ca_layer_tree->ScheduleCALayer( | 122 result = new_ca_layer_tree->ScheduleCALayer( |
118 is_clipped, | 123 is_clipped, |
119 clip_rect, | 124 clip_rect, |
120 sorting_context_id, | 125 sorting_context_id, |
121 transform, | 126 transform, |
122 io_surface, | 127 io_surface, |
123 nullptr, | 128 nullptr, |
124 contents_rect, | 129 contents_rect, |
125 rect, | 130 rect, |
126 background_color, | 131 background_color, |
127 edge_aa_mask, | 132 edge_aa_mask, |
128 opacity); | 133 opacity, |
| 134 filter); |
129 EXPECT_TRUE(result); | 135 EXPECT_TRUE(result); |
130 new_ca_layer_tree->CommitScheduledCALayers( | 136 new_ca_layer_tree->CommitScheduledCALayers( |
131 superlayer_, std::move(ca_layer_tree), scale_factor); | 137 superlayer_, std::move(ca_layer_tree), scale_factor); |
132 std::swap(new_ca_layer_tree, ca_layer_tree); | 138 std::swap(new_ca_layer_tree, ca_layer_tree); |
133 | 139 |
134 // Validate the tree structure | 140 // Validate the tree structure |
135 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 141 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
136 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); | 142 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); |
137 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 143 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
138 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); | 144 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); |
(...skipping 22 matching lines...) Expand all Loading... |
161 is_clipped, | 167 is_clipped, |
162 clip_rect, | 168 clip_rect, |
163 sorting_context_id, | 169 sorting_context_id, |
164 transform, | 170 transform, |
165 io_surface, | 171 io_surface, |
166 nullptr, | 172 nullptr, |
167 contents_rect, | 173 contents_rect, |
168 rect, | 174 rect, |
169 background_color, | 175 background_color, |
170 edge_aa_mask, | 176 edge_aa_mask, |
171 opacity); | 177 opacity, |
| 178 filter); |
172 EXPECT_TRUE(result); | 179 EXPECT_TRUE(result); |
173 new_ca_layer_tree->CommitScheduledCALayers( | 180 new_ca_layer_tree->CommitScheduledCALayers( |
174 superlayer_, std::move(ca_layer_tree), scale_factor); | 181 superlayer_, std::move(ca_layer_tree), scale_factor); |
175 std::swap(new_ca_layer_tree, ca_layer_tree); | 182 std::swap(new_ca_layer_tree, ca_layer_tree); |
176 | 183 |
177 // Validate the tree structure | 184 // Validate the tree structure |
178 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 185 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
179 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); | 186 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); |
180 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 187 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
181 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); | 188 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); |
(...skipping 19 matching lines...) Expand all Loading... |
201 is_clipped, | 208 is_clipped, |
202 clip_rect, | 209 clip_rect, |
203 sorting_context_id, | 210 sorting_context_id, |
204 transform, | 211 transform, |
205 io_surface, | 212 io_surface, |
206 nullptr, | 213 nullptr, |
207 contents_rect, | 214 contents_rect, |
208 rect, | 215 rect, |
209 background_color, | 216 background_color, |
210 edge_aa_mask, | 217 edge_aa_mask, |
211 opacity); | 218 opacity, |
| 219 filter); |
212 EXPECT_TRUE(result); | 220 EXPECT_TRUE(result); |
213 new_ca_layer_tree->CommitScheduledCALayers( | 221 new_ca_layer_tree->CommitScheduledCALayers( |
214 superlayer_, std::move(ca_layer_tree), scale_factor); | 222 superlayer_, std::move(ca_layer_tree), scale_factor); |
215 std::swap(new_ca_layer_tree, ca_layer_tree); | 223 std::swap(new_ca_layer_tree, ca_layer_tree); |
216 | 224 |
217 // Validate the tree structure. | 225 // Validate the tree structure. |
218 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 226 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
219 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); | 227 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); |
220 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 228 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
221 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); | 229 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); |
(...skipping 17 matching lines...) Expand all Loading... |
239 is_clipped, | 247 is_clipped, |
240 clip_rect, | 248 clip_rect, |
241 sorting_context_id, | 249 sorting_context_id, |
242 transform, | 250 transform, |
243 io_surface, | 251 io_surface, |
244 nullptr, | 252 nullptr, |
245 contents_rect, | 253 contents_rect, |
246 rect, | 254 rect, |
247 background_color, | 255 background_color, |
248 edge_aa_mask, | 256 edge_aa_mask, |
249 opacity); | 257 opacity, |
| 258 filter); |
250 EXPECT_TRUE(result); | 259 EXPECT_TRUE(result); |
251 new_ca_layer_tree->CommitScheduledCALayers( | 260 new_ca_layer_tree->CommitScheduledCALayers( |
252 superlayer_, std::move(ca_layer_tree), scale_factor); | 261 superlayer_, std::move(ca_layer_tree), scale_factor); |
253 std::swap(new_ca_layer_tree, ca_layer_tree); | 262 std::swap(new_ca_layer_tree, ca_layer_tree); |
254 | 263 |
255 // Validate the tree structure. | 264 // Validate the tree structure. |
256 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 265 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
257 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); | 266 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); |
258 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 267 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
259 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); | 268 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); |
(...skipping 15 matching lines...) Expand all Loading... |
275 is_clipped, | 284 is_clipped, |
276 clip_rect, | 285 clip_rect, |
277 sorting_context_id, | 286 sorting_context_id, |
278 transform, | 287 transform, |
279 nullptr, | 288 nullptr, |
280 nullptr, | 289 nullptr, |
281 contents_rect, | 290 contents_rect, |
282 rect, | 291 rect, |
283 background_color, | 292 background_color, |
284 edge_aa_mask, | 293 edge_aa_mask, |
285 opacity); | 294 opacity, |
| 295 filter); |
286 EXPECT_TRUE(result); | 296 EXPECT_TRUE(result); |
287 new_ca_layer_tree->CommitScheduledCALayers( | 297 new_ca_layer_tree->CommitScheduledCALayers( |
288 superlayer_, std::move(ca_layer_tree), scale_factor); | 298 superlayer_, std::move(ca_layer_tree), scale_factor); |
289 std::swap(new_ca_layer_tree, ca_layer_tree); | 299 std::swap(new_ca_layer_tree, ca_layer_tree); |
290 | 300 |
291 // Validate the tree structure. | 301 // Validate the tree structure. |
292 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 302 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
293 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); | 303 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); |
294 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 304 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
295 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); | 305 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); |
(...skipping 17 matching lines...) Expand all Loading... |
313 is_clipped, | 323 is_clipped, |
314 clip_rect, | 324 clip_rect, |
315 sorting_context_id, | 325 sorting_context_id, |
316 transform, | 326 transform, |
317 nullptr, | 327 nullptr, |
318 nullptr, | 328 nullptr, |
319 contents_rect, | 329 contents_rect, |
320 rect, | 330 rect, |
321 background_color, | 331 background_color, |
322 edge_aa_mask, | 332 edge_aa_mask, |
323 opacity); | 333 opacity, |
| 334 filter); |
324 EXPECT_TRUE(result); | 335 EXPECT_TRUE(result); |
325 new_ca_layer_tree->CommitScheduledCALayers( | 336 new_ca_layer_tree->CommitScheduledCALayers( |
326 superlayer_, std::move(ca_layer_tree), scale_factor); | 337 superlayer_, std::move(ca_layer_tree), scale_factor); |
327 std::swap(new_ca_layer_tree, ca_layer_tree); | 338 std::swap(new_ca_layer_tree, ca_layer_tree); |
328 | 339 |
329 // Validate the tree structure. | 340 // Validate the tree structure. |
330 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 341 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
331 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); | 342 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); |
332 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 343 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
333 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); | 344 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); |
(...skipping 17 matching lines...) Expand all Loading... |
351 is_clipped, | 362 is_clipped, |
352 clip_rect, | 363 clip_rect, |
353 sorting_context_id, | 364 sorting_context_id, |
354 transform, | 365 transform, |
355 nullptr, | 366 nullptr, |
356 nullptr, | 367 nullptr, |
357 contents_rect, | 368 contents_rect, |
358 rect, | 369 rect, |
359 background_color, | 370 background_color, |
360 edge_aa_mask, | 371 edge_aa_mask, |
361 opacity); | 372 opacity, |
| 373 filter); |
362 EXPECT_TRUE(result); | 374 EXPECT_TRUE(result); |
363 new_ca_layer_tree->CommitScheduledCALayers( | 375 new_ca_layer_tree->CommitScheduledCALayers( |
364 superlayer_, std::move(ca_layer_tree), scale_factor); | 376 superlayer_, std::move(ca_layer_tree), scale_factor); |
365 std::swap(new_ca_layer_tree, ca_layer_tree); | 377 std::swap(new_ca_layer_tree, ca_layer_tree); |
366 | 378 |
367 // Validate the tree structure. | 379 // Validate the tree structure. |
368 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 380 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
369 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); | 381 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); |
370 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 382 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
371 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); | 383 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); |
(...skipping 17 matching lines...) Expand all Loading... |
389 is_clipped, | 401 is_clipped, |
390 clip_rect, | 402 clip_rect, |
391 sorting_context_id, | 403 sorting_context_id, |
392 transform, | 404 transform, |
393 nullptr, | 405 nullptr, |
394 nullptr, | 406 nullptr, |
395 contents_rect, | 407 contents_rect, |
396 rect, | 408 rect, |
397 background_color, | 409 background_color, |
398 edge_aa_mask, | 410 edge_aa_mask, |
399 opacity); | 411 opacity, |
| 412 filter); |
400 EXPECT_TRUE(result); | 413 EXPECT_TRUE(result); |
401 new_ca_layer_tree->CommitScheduledCALayers( | 414 new_ca_layer_tree->CommitScheduledCALayers( |
402 superlayer_, std::move(ca_layer_tree), scale_factor); | 415 superlayer_, std::move(ca_layer_tree), scale_factor); |
403 std::swap(new_ca_layer_tree, ca_layer_tree); | 416 std::swap(new_ca_layer_tree, ca_layer_tree); |
404 | 417 |
405 // Validate the tree structure. | 418 // Validate the tree structure. |
406 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 419 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
407 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); | 420 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); |
408 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 421 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
409 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); | 422 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); |
410 EXPECT_EQ(1u, [[clip_and_sorting_layer sublayers] count]); | 423 EXPECT_EQ(1u, [[clip_and_sorting_layer sublayers] count]); |
411 EXPECT_EQ(transform_layer, | 424 EXPECT_EQ(transform_layer, |
412 [[clip_and_sorting_layer sublayers] objectAtIndex:0]); | 425 [[clip_and_sorting_layer sublayers] objectAtIndex:0]); |
413 EXPECT_EQ(1u, [[transform_layer sublayers] count]); | 426 EXPECT_EQ(1u, [[transform_layer sublayers] count]); |
414 EXPECT_EQ(content_layer, [[transform_layer sublayers] objectAtIndex:0]); | 427 EXPECT_EQ(content_layer, [[transform_layer sublayers] objectAtIndex:0]); |
415 | 428 |
416 // Validate the content layer. | 429 // Validate the content layer. |
417 EXPECT_EQ(opacity, [content_layer opacity]); | 430 EXPECT_EQ(opacity, [content_layer opacity]); |
418 } | 431 } |
419 | 432 |
| 433 // Change the filter. |
| 434 { |
| 435 filter = GL_NEAREST; |
| 436 std::unique_ptr<ui::CALayerTree> new_ca_layer_tree(new ui::CALayerTree); |
| 437 result = new_ca_layer_tree->ScheduleCALayer( |
| 438 is_clipped, |
| 439 clip_rect, |
| 440 sorting_context_id, |
| 441 transform, |
| 442 nullptr, |
| 443 nullptr, |
| 444 contents_rect, |
| 445 rect, |
| 446 background_color, |
| 447 edge_aa_mask, |
| 448 opacity, |
| 449 filter); |
| 450 EXPECT_TRUE(result); |
| 451 new_ca_layer_tree->CommitScheduledCALayers( |
| 452 superlayer_, std::move(ca_layer_tree), scale_factor); |
| 453 std::swap(new_ca_layer_tree, ca_layer_tree); |
| 454 |
| 455 // Validate the tree structure. |
| 456 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
| 457 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); |
| 458 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
| 459 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); |
| 460 EXPECT_EQ(1u, [[clip_and_sorting_layer sublayers] count]); |
| 461 EXPECT_EQ(transform_layer, |
| 462 [[clip_and_sorting_layer sublayers] objectAtIndex:0]); |
| 463 EXPECT_EQ(1u, [[transform_layer sublayers] count]); |
| 464 EXPECT_EQ(content_layer, [[transform_layer sublayers] objectAtIndex:0]); |
| 465 |
| 466 // Validate the content layer. |
| 467 EXPECT_NSEQ(kCAFilterNearest, [content_layer minificationFilter]); |
| 468 EXPECT_NSEQ(kCAFilterNearest, [content_layer magnificationFilter]); |
| 469 } |
| 470 |
420 // Add the clipping and IOSurface contents back. | 471 // Add the clipping and IOSurface contents back. |
421 { | 472 { |
422 is_clipped = true; | 473 is_clipped = true; |
423 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( | 474 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( |
424 new ui::CARendererLayerTree); | 475 new ui::CARendererLayerTree); |
425 result = new_ca_layer_tree->ScheduleCALayer( | 476 result = new_ca_layer_tree->ScheduleCALayer( |
426 is_clipped, | 477 is_clipped, |
427 clip_rect, | 478 clip_rect, |
428 sorting_context_id, | 479 sorting_context_id, |
429 transform, | 480 transform, |
430 io_surface, | 481 io_surface, |
431 nullptr, | 482 nullptr, |
432 contents_rect, | 483 contents_rect, |
433 rect, | 484 rect, |
434 background_color, | 485 background_color, |
435 edge_aa_mask, | 486 edge_aa_mask, |
436 opacity); | 487 opacity, |
| 488 filter); |
437 EXPECT_TRUE(result); | 489 EXPECT_TRUE(result); |
438 new_ca_layer_tree->CommitScheduledCALayers( | 490 new_ca_layer_tree->CommitScheduledCALayers( |
439 superlayer_, std::move(ca_layer_tree), scale_factor); | 491 superlayer_, std::move(ca_layer_tree), scale_factor); |
440 std::swap(new_ca_layer_tree, ca_layer_tree); | 492 std::swap(new_ca_layer_tree, ca_layer_tree); |
441 | 493 |
442 // Validate the tree structure. | 494 // Validate the tree structure. |
443 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 495 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
444 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); | 496 EXPECT_EQ(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); |
445 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 497 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
446 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); | 498 EXPECT_EQ(clip_and_sorting_layer, [[root_layer sublayers] objectAtIndex:0]); |
(...skipping 17 matching lines...) Expand all Loading... |
464 is_clipped, | 516 is_clipped, |
465 clip_rect, | 517 clip_rect, |
466 sorting_context_id, | 518 sorting_context_id, |
467 transform, | 519 transform, |
468 io_surface, | 520 io_surface, |
469 nullptr, | 521 nullptr, |
470 contents_rect, | 522 contents_rect, |
471 rect, | 523 rect, |
472 background_color, | 524 background_color, |
473 edge_aa_mask, | 525 edge_aa_mask, |
474 opacity); | 526 opacity, |
| 527 filter); |
475 EXPECT_TRUE(result); | 528 EXPECT_TRUE(result); |
476 new_ca_layer_tree->CommitScheduledCALayers( | 529 new_ca_layer_tree->CommitScheduledCALayers( |
477 superlayer_, std::move(ca_layer_tree), scale_factor); | 530 superlayer_, std::move(ca_layer_tree), scale_factor); |
478 std::swap(new_ca_layer_tree, ca_layer_tree); | 531 std::swap(new_ca_layer_tree, ca_layer_tree); |
479 | 532 |
480 // Validate the tree structure. | 533 // Validate the tree structure. |
481 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 534 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
482 EXPECT_NE(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); | 535 EXPECT_NE(root_layer, [[superlayer_ sublayers] objectAtIndex:0]); |
483 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; | 536 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
484 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 537 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 TEST_F(CALayerTreeTest, SplitSortingContextZero) { | 580 TEST_F(CALayerTreeTest, SplitSortingContextZero) { |
528 bool is_clipped = false; | 581 bool is_clipped = false; |
529 gfx::Rect clip_rect; | 582 gfx::Rect clip_rect; |
530 int sorting_context_id = 0; | 583 int sorting_context_id = 0; |
531 gfx::RectF contents_rect(0, 0, 1, 1); | 584 gfx::RectF contents_rect(0, 0, 1, 1); |
532 gfx::Rect rect(0, 0, 256, 256); | 585 gfx::Rect rect(0, 0, 256, 256); |
533 unsigned background_color = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0xFF); | 586 unsigned background_color = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0xFF); |
534 unsigned edge_aa_mask = 0; | 587 unsigned edge_aa_mask = 0; |
535 float opacity = 1.0f; | 588 float opacity = 1.0f; |
536 float scale_factor = 1.0f; | 589 float scale_factor = 1.0f; |
| 590 unsigned filter = GL_LINEAR; |
537 | 591 |
538 // We'll use the IOSurface contents to identify the content layers. | 592 // We'll use the IOSurface contents to identify the content layers. |
539 base::ScopedCFTypeRef<IOSurfaceRef> io_surfaces[5]; | 593 base::ScopedCFTypeRef<IOSurfaceRef> io_surfaces[5]; |
540 for (size_t i = 0; i < 5; ++i) { | 594 for (size_t i = 0; i < 5; ++i) { |
541 io_surfaces[i].reset(gfx::CreateIOSurface( | 595 io_surfaces[i].reset(gfx::CreateIOSurface( |
542 gfx::Size(256, 256), gfx::BufferFormat::BGRA_8888)); | 596 gfx::Size(256, 256), gfx::BufferFormat::BGRA_8888)); |
543 } | 597 } |
544 | 598 |
545 // Have 5 transforms: | 599 // Have 5 transforms: |
546 // * 2 flat but different (1 sorting context layer, 2 transform layers) | 600 // * 2 flat but different (1 sorting context layer, 2 transform layers) |
(...skipping 14 matching lines...) Expand all Loading... |
561 is_clipped, | 615 is_clipped, |
562 clip_rect, | 616 clip_rect, |
563 sorting_context_id, | 617 sorting_context_id, |
564 transforms[i], | 618 transforms[i], |
565 io_surfaces[i], | 619 io_surfaces[i], |
566 nullptr, | 620 nullptr, |
567 contents_rect, | 621 contents_rect, |
568 rect, | 622 rect, |
569 background_color, | 623 background_color, |
570 edge_aa_mask, | 624 edge_aa_mask, |
571 opacity); | 625 opacity, |
| 626 filter); |
572 EXPECT_TRUE(result); | 627 EXPECT_TRUE(result); |
573 } | 628 } |
574 ca_layer_tree->CommitScheduledCALayers(superlayer_, nullptr, scale_factor); | 629 ca_layer_tree->CommitScheduledCALayers(superlayer_, nullptr, scale_factor); |
575 | 630 |
576 // Validate the root layer. | 631 // Validate the root layer. |
577 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 632 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
578 CALayer* root_layer = [[superlayer_ sublayers] objectAtIndex:0]; | 633 CALayer* root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
579 | 634 |
580 // Validate that we have 3 sorting context layers. | 635 // Validate that we have 3 sorting context layers. |
581 EXPECT_EQ(3u, [[root_layer sublayers] count]); | 636 EXPECT_EQ(3u, [[root_layer sublayers] count]); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 bool is_clipped = false; | 680 bool is_clipped = false; |
626 gfx::Rect clip_rect; | 681 gfx::Rect clip_rect; |
627 int sorting_context_ids[3] = {3, -1, 0}; | 682 int sorting_context_ids[3] = {3, -1, 0}; |
628 gfx::RectF contents_rect(0, 0, 1, 1); | 683 gfx::RectF contents_rect(0, 0, 1, 1); |
629 gfx::Rect rect(0, 0, 256, 256); | 684 gfx::Rect rect(0, 0, 256, 256); |
630 gfx::Transform transform; | 685 gfx::Transform transform; |
631 unsigned background_color = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0xFF); | 686 unsigned background_color = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0xFF); |
632 unsigned edge_aa_mask = 0; | 687 unsigned edge_aa_mask = 0; |
633 float opacity = 1.0f; | 688 float opacity = 1.0f; |
634 float scale_factor = 1.0f; | 689 float scale_factor = 1.0f; |
| 690 unsigned filter = GL_LINEAR; |
635 | 691 |
636 // We'll use the IOSurface contents to identify the content layers. | 692 // We'll use the IOSurface contents to identify the content layers. |
637 base::ScopedCFTypeRef<IOSurfaceRef> io_surfaces[3]; | 693 base::ScopedCFTypeRef<IOSurfaceRef> io_surfaces[3]; |
638 for (size_t i = 0; i < 3; ++i) { | 694 for (size_t i = 0; i < 3; ++i) { |
639 io_surfaces[i].reset(gfx::CreateIOSurface( | 695 io_surfaces[i].reset(gfx::CreateIOSurface( |
640 gfx::Size(256, 256), gfx::BufferFormat::BGRA_8888)); | 696 gfx::Size(256, 256), gfx::BufferFormat::BGRA_8888)); |
641 } | 697 } |
642 | 698 |
643 // Schedule and commit the layers. | 699 // Schedule and commit the layers. |
644 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree( | 700 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree( |
645 new ui::CARendererLayerTree); | 701 new ui::CARendererLayerTree); |
646 for (size_t i = 0; i < 3; ++i) { | 702 for (size_t i = 0; i < 3; ++i) { |
647 bool result = ca_layer_tree->ScheduleCALayer( | 703 bool result = ca_layer_tree->ScheduleCALayer( |
648 is_clipped, | 704 is_clipped, |
649 clip_rect, | 705 clip_rect, |
650 sorting_context_ids[i], | 706 sorting_context_ids[i], |
651 transform, | 707 transform, |
652 io_surfaces[i], | 708 io_surfaces[i], |
653 nullptr, | 709 nullptr, |
654 contents_rect, | 710 contents_rect, |
655 rect, | 711 rect, |
656 background_color, | 712 background_color, |
657 edge_aa_mask, | 713 edge_aa_mask, |
658 opacity); | 714 opacity, |
| 715 filter); |
659 EXPECT_TRUE(result); | 716 EXPECT_TRUE(result); |
660 } | 717 } |
661 ca_layer_tree->CommitScheduledCALayers(superlayer_, nullptr, scale_factor); | 718 ca_layer_tree->CommitScheduledCALayers(superlayer_, nullptr, scale_factor); |
662 | 719 |
663 // Validate the root layer. | 720 // Validate the root layer. |
664 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 721 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
665 CALayer* root_layer = [[superlayer_ sublayers] objectAtIndex:0]; | 722 CALayer* root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
666 | 723 |
667 // Validate that we have 3 sorting context layers. | 724 // Validate that we have 3 sorting context layers. |
668 EXPECT_EQ(3u, [[root_layer sublayers] count]); | 725 EXPECT_EQ(3u, [[root_layer sublayers] count]); |
(...skipping 28 matching lines...) Expand all Loading... |
697 | 754 |
698 // Verify that sorting contexts must all have the same clipping properties. | 755 // Verify that sorting contexts must all have the same clipping properties. |
699 TEST_F(CALayerTreeTest, SortingContextMustHaveConsistentClip) { | 756 TEST_F(CALayerTreeTest, SortingContextMustHaveConsistentClip) { |
700 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; | 757 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; |
701 gfx::RectF contents_rect(0, 0, 1, 1); | 758 gfx::RectF contents_rect(0, 0, 1, 1); |
702 gfx::Rect rect(0, 0, 256, 256); | 759 gfx::Rect rect(0, 0, 256, 256); |
703 gfx::Transform transform; | 760 gfx::Transform transform; |
704 unsigned background_color = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0xFF); | 761 unsigned background_color = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0xFF); |
705 unsigned edge_aa_mask = 0; | 762 unsigned edge_aa_mask = 0; |
706 float opacity = 1.0f; | 763 float opacity = 1.0f; |
| 764 unsigned filter = GL_LINEAR; |
707 | 765 |
708 // Vary the clipping parameters within sorting contexts. | 766 // Vary the clipping parameters within sorting contexts. |
709 bool is_clippeds[3] = { true, true, false}; | 767 bool is_clippeds[3] = { true, true, false}; |
710 gfx::Rect clip_rects[3] = { | 768 gfx::Rect clip_rects[3] = { |
711 gfx::Rect(0, 0, 16, 16), | 769 gfx::Rect(0, 0, 16, 16), |
712 gfx::Rect(4, 8, 16, 32), | 770 gfx::Rect(4, 8, 16, 32), |
713 gfx::Rect(0, 0, 16, 16) | 771 gfx::Rect(0, 0, 16, 16) |
714 }; | 772 }; |
715 | 773 |
716 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree( | 774 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree( |
717 new ui::CARendererLayerTree); | 775 new ui::CARendererLayerTree); |
718 // First send the various clip parameters to sorting context zero. This is | 776 // First send the various clip parameters to sorting context zero. This is |
719 // legitimate. | 777 // legitimate. |
720 for (size_t i = 0; i < 3; ++i) { | 778 for (size_t i = 0; i < 3; ++i) { |
721 int sorting_context_id = 0; | 779 int sorting_context_id = 0; |
722 bool result = ca_layer_tree->ScheduleCALayer( | 780 bool result = ca_layer_tree->ScheduleCALayer( |
723 is_clippeds[i], | 781 is_clippeds[i], |
724 clip_rects[i], | 782 clip_rects[i], |
725 sorting_context_id, | 783 sorting_context_id, |
726 transform, | 784 transform, |
727 io_surface, | 785 io_surface, |
728 nullptr, | 786 nullptr, |
729 contents_rect, | 787 contents_rect, |
730 rect, | 788 rect, |
731 background_color, | 789 background_color, |
732 edge_aa_mask, | 790 edge_aa_mask, |
733 opacity); | 791 opacity, |
| 792 filter); |
734 EXPECT_TRUE(result); | 793 EXPECT_TRUE(result); |
735 } | 794 } |
736 // Next send the various clip parameters to a non-zero sorting context. This | 795 // Next send the various clip parameters to a non-zero sorting context. This |
737 // will fail when we try to change the clip within the sorting context. | 796 // will fail when we try to change the clip within the sorting context. |
738 for (size_t i = 0; i < 3; ++i) { | 797 for (size_t i = 0; i < 3; ++i) { |
739 int sorting_context_id = 3; | 798 int sorting_context_id = 3; |
740 bool result = ca_layer_tree->ScheduleCALayer( | 799 bool result = ca_layer_tree->ScheduleCALayer( |
741 is_clippeds[i], | 800 is_clippeds[i], |
742 clip_rects[i], | 801 clip_rects[i], |
743 sorting_context_id, | 802 sorting_context_id, |
744 transform, | 803 transform, |
745 io_surface, | 804 io_surface, |
746 nullptr, | 805 nullptr, |
747 contents_rect, | 806 contents_rect, |
748 rect, | 807 rect, |
749 background_color, | 808 background_color, |
750 edge_aa_mask, | 809 edge_aa_mask, |
751 opacity); | 810 opacity, |
| 811 filter); |
752 if (i == 0) | 812 if (i == 0) |
753 EXPECT_TRUE(result); | 813 EXPECT_TRUE(result); |
754 else | 814 else |
755 EXPECT_FALSE(result); | 815 EXPECT_FALSE(result); |
756 } | 816 } |
757 // Try once more with the original clip and verify it works. | 817 // Try once more with the original clip and verify it works. |
758 { | 818 { |
759 int sorting_context_id = 3; | 819 int sorting_context_id = 3; |
760 bool result = ca_layer_tree->ScheduleCALayer( | 820 bool result = ca_layer_tree->ScheduleCALayer( |
761 is_clippeds[0], | 821 is_clippeds[0], |
762 clip_rects[0], | 822 clip_rects[0], |
763 sorting_context_id, | 823 sorting_context_id, |
764 transform, | 824 transform, |
765 io_surface, | 825 io_surface, |
766 nullptr, | 826 nullptr, |
767 contents_rect, | 827 contents_rect, |
768 rect, | 828 rect, |
769 background_color, | 829 background_color, |
770 edge_aa_mask, | 830 edge_aa_mask, |
771 opacity); | 831 opacity, |
| 832 filter); |
772 EXPECT_TRUE(result); | 833 EXPECT_TRUE(result); |
773 } | 834 } |
774 } | 835 } |
775 | 836 |
776 // Test updating each layer's properties. | 837 // Test updating each layer's properties. |
777 TEST_F(CALayerTreeTest, AVLayer) { | 838 TEST_F(CALayerTreeTest, AVLayer) { |
778 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(gfx::CreateIOSurface( | 839 base::ScopedCFTypeRef<IOSurfaceRef> io_surface(gfx::CreateIOSurface( |
779 gfx::Size(256, 256), gfx::BufferFormat::YUV_420_BIPLANAR)); | 840 gfx::Size(256, 256), gfx::BufferFormat::YUV_420_BIPLANAR)); |
780 | 841 |
781 bool is_clipped = true; | 842 bool is_clipped = true; |
782 gfx::Rect clip_rect(2, 4, 8, 16); | 843 gfx::Rect clip_rect(2, 4, 8, 16); |
783 int sorting_context_id = 0; | 844 int sorting_context_id = 0; |
784 gfx::Transform transform; | 845 gfx::Transform transform; |
785 gfx::RectF contents_rect(0.0f, 0.0f, 1.0f, 1.0f); | 846 gfx::RectF contents_rect(0.0f, 0.0f, 1.0f, 1.0f); |
786 gfx::Rect rect(16, 32, 64, 128); | 847 gfx::Rect rect(16, 32, 64, 128); |
787 unsigned background_color = SkColorSetARGB(0xFF, 0xFF, 0, 0); | 848 unsigned background_color = SkColorSetARGB(0xFF, 0xFF, 0, 0); |
788 unsigned edge_aa_mask = GL_CA_LAYER_EDGE_LEFT_CHROMIUM; | 849 unsigned edge_aa_mask = GL_CA_LAYER_EDGE_LEFT_CHROMIUM; |
789 float opacity = 0.5f; | 850 float opacity = 0.5f; |
790 float scale_factor = 1.0f; | 851 float scale_factor = 1.0f; |
791 bool result = false; | 852 bool result = false; |
| 853 unsigned filter = GL_LINEAR; |
792 | 854 |
793 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree; | 855 std::unique_ptr<ui::CARendererLayerTree> ca_layer_tree; |
794 CALayer* root_layer = nil; | 856 CALayer* root_layer = nil; |
795 CALayer* clip_and_sorting_layer = nil; | 857 CALayer* clip_and_sorting_layer = nil; |
796 CALayer* transform_layer = nil; | 858 CALayer* transform_layer = nil; |
797 CALayer* content_layer1 = nil; | 859 CALayer* content_layer1 = nil; |
798 CALayer* content_layer2 = nil; | 860 CALayer* content_layer2 = nil; |
799 CALayer* content_layer3 = nil; | 861 CALayer* content_layer3 = nil; |
800 | 862 |
801 // Validate the initial values. | 863 // Validate the initial values. |
802 { | 864 { |
803 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( | 865 std::unique_ptr<ui::CARendererLayerTree> new_ca_layer_tree( |
804 new ui::CARendererLayerTree); | 866 new ui::CARendererLayerTree); |
805 result = new_ca_layer_tree->ScheduleCALayer( | 867 result = new_ca_layer_tree->ScheduleCALayer( |
806 is_clipped, | 868 is_clipped, |
807 clip_rect, | 869 clip_rect, |
808 sorting_context_id, | 870 sorting_context_id, |
809 transform, | 871 transform, |
810 io_surface, | 872 io_surface, |
811 nullptr, | 873 nullptr, |
812 contents_rect, | 874 contents_rect, |
813 rect, background_color, | 875 rect, background_color, |
814 edge_aa_mask, | 876 edge_aa_mask, |
815 opacity); | 877 opacity, |
| 878 filter); |
816 EXPECT_TRUE(result); | 879 EXPECT_TRUE(result); |
817 new_ca_layer_tree->CommitScheduledCALayers( | 880 new_ca_layer_tree->CommitScheduledCALayers( |
818 superlayer_, std::move(ca_layer_tree), scale_factor); | 881 superlayer_, std::move(ca_layer_tree), scale_factor); |
819 std::swap(new_ca_layer_tree, ca_layer_tree); | 882 std::swap(new_ca_layer_tree, ca_layer_tree); |
820 | 883 |
821 // Validate the tree structure. | 884 // Validate the tree structure. |
822 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 885 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
823 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; | 886 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
824 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 887 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
825 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; | 888 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; |
(...skipping 18 matching lines...) Expand all Loading... |
844 is_clipped, | 907 is_clipped, |
845 clip_rect, | 908 clip_rect, |
846 sorting_context_id, | 909 sorting_context_id, |
847 transform, | 910 transform, |
848 io_surface, | 911 io_surface, |
849 nullptr, | 912 nullptr, |
850 contents_rect, | 913 contents_rect, |
851 rect, | 914 rect, |
852 background_color, | 915 background_color, |
853 edge_aa_mask, | 916 edge_aa_mask, |
854 opacity); | 917 opacity, |
| 918 filter); |
855 EXPECT_TRUE(result); | 919 EXPECT_TRUE(result); |
856 new_ca_layer_tree->CommitScheduledCALayers( | 920 new_ca_layer_tree->CommitScheduledCALayers( |
857 superlayer_, std::move(ca_layer_tree), scale_factor); | 921 superlayer_, std::move(ca_layer_tree), scale_factor); |
858 std::swap(new_ca_layer_tree, ca_layer_tree); | 922 std::swap(new_ca_layer_tree, ca_layer_tree); |
859 | 923 |
860 // Validate the tree structure. | 924 // Validate the tree structure. |
861 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 925 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
862 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; | 926 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
863 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 927 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
864 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; | 928 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; |
(...skipping 22 matching lines...) Expand all Loading... |
887 is_clipped, | 951 is_clipped, |
888 clip_rect, | 952 clip_rect, |
889 sorting_context_id, | 953 sorting_context_id, |
890 transform, | 954 transform, |
891 io_surface, | 955 io_surface, |
892 cv_pixel_buffer, | 956 cv_pixel_buffer, |
893 contents_rect, | 957 contents_rect, |
894 rect, | 958 rect, |
895 background_color, | 959 background_color, |
896 edge_aa_mask, | 960 edge_aa_mask, |
897 opacity); | 961 opacity, |
| 962 filter); |
898 EXPECT_TRUE(result); | 963 EXPECT_TRUE(result); |
899 new_ca_layer_tree->CommitScheduledCALayers( | 964 new_ca_layer_tree->CommitScheduledCALayers( |
900 superlayer_, std::move(ca_layer_tree), scale_factor); | 965 superlayer_, std::move(ca_layer_tree), scale_factor); |
901 std::swap(new_ca_layer_tree, ca_layer_tree); | 966 std::swap(new_ca_layer_tree, ca_layer_tree); |
902 | 967 |
903 // Validate the tree structure. | 968 // Validate the tree structure. |
904 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 969 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
905 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; | 970 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
906 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 971 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
907 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; | 972 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; |
(...skipping 21 matching lines...) Expand all Loading... |
929 is_clipped, | 994 is_clipped, |
930 clip_rect, | 995 clip_rect, |
931 sorting_context_id, | 996 sorting_context_id, |
932 transform, | 997 transform, |
933 io_surface, | 998 io_surface, |
934 nullptr, | 999 nullptr, |
935 contents_rect, | 1000 contents_rect, |
936 rect, | 1001 rect, |
937 background_color, | 1002 background_color, |
938 edge_aa_mask, | 1003 edge_aa_mask, |
939 opacity); | 1004 opacity, |
| 1005 filter); |
940 EXPECT_TRUE(result); | 1006 EXPECT_TRUE(result); |
941 new_ca_layer_tree->CommitScheduledCALayers( | 1007 new_ca_layer_tree->CommitScheduledCALayers( |
942 superlayer_, std::move(ca_layer_tree), scale_factor); | 1008 superlayer_, std::move(ca_layer_tree), scale_factor); |
943 std::swap(new_ca_layer_tree, ca_layer_tree); | 1009 std::swap(new_ca_layer_tree, ca_layer_tree); |
944 | 1010 |
945 // Validate the tree structure. | 1011 // Validate the tree structure. |
946 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); | 1012 EXPECT_EQ(1u, [[superlayer_ sublayers] count]); |
947 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; | 1013 root_layer = [[superlayer_ sublayers] objectAtIndex:0]; |
948 EXPECT_EQ(1u, [[root_layer sublayers] count]); | 1014 EXPECT_EQ(1u, [[root_layer sublayers] count]); |
949 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; | 1015 clip_and_sorting_layer = [[root_layer sublayers] objectAtIndex:0]; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 CALayer* content_layer = [[transform_layer sublayers] objectAtIndex:0]; | 1186 CALayer* content_layer = [[transform_layer sublayers] objectAtIndex:0]; |
1121 | 1187 |
1122 // Validate the content layer and fullscreen low power mode. | 1188 // Validate the content layer and fullscreen low power mode. |
1123 EXPECT_TRUE([content_layer | 1189 EXPECT_TRUE([content_layer |
1124 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); | 1190 isKindOfClass:NSClassFromString(@"AVSampleBufferDisplayLayer")]); |
1125 EXPECT_FALSE(fullscreen_low_power_valid); | 1191 EXPECT_FALSE(fullscreen_low_power_valid); |
1126 } | 1192 } |
1127 } | 1193 } |
1128 | 1194 |
1129 } // namespace gpu | 1195 } // namespace gpu |
OLD | NEW |