| 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 "platform/graphics/compositing/PropertyTreeManager.h" | 5 #include "platform/graphics/compositing/PropertyTreeManager.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "cc/trees/clip_node.h" | 8 #include "cc/trees/clip_node.h" |
| 9 #include "cc/trees/effect_node.h" | 9 #include "cc/trees/effect_node.h" |
| 10 #include "cc/trees/layer_tree_host.h" | 10 #include "cc/trees/layer_tree_host.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 GetEffectTree() | 376 GetEffectTree() |
| 377 .Node(GetCurrentCompositorEffectNodeIndex()) | 377 .Node(GetCurrentCompositorEffectNodeIndex()) |
| 378 ->has_render_surface = true; | 378 ->has_render_surface = true; |
| 379 } | 379 } |
| 380 | 380 |
| 381 BuildEffectNodesRecursively(&next_effect); | 381 BuildEffectNodesRecursively(&next_effect); |
| 382 | 382 |
| 383 return GetCurrentCompositorEffectNodeIndex(); | 383 return GetCurrentCompositorEffectNodeIndex(); |
| 384 } | 384 } |
| 385 | 385 |
| 386 void PropertyTreeManager::BuildRoundedClipEffectNodesBetween( |
| 387 const ClipPaintPropertyNode* descendant_clip, |
| 388 const ClipPaintPropertyNode* ancestor_clip) { |
| 389 if (!descendant_clip || descendant_clip == ancestor_clip) |
| 390 return; |
| 391 BuildRoundedClipEffectNodesBetween(descendant_clip->Parent(), ancestor_clip); |
| 392 if (!descendant_clip->ClipRect().IsRounded()) |
| 393 return; |
| 394 BuildRoundedClipEffect(descendant_clip); |
| 395 } |
| 396 |
| 397 void PropertyTreeManager::BuildRoundedClipEffect( |
| 398 const ClipPaintPropertyNode* clip) { |
| 399 // todo. |
| 400 // BuildEffectNode(...); |
| 401 } |
| 402 |
| 386 void PropertyTreeManager::BuildEffectNodesRecursively( | 403 void PropertyTreeManager::BuildEffectNodesRecursively( |
| 387 const EffectPaintPropertyNode* next_effect) { | 404 const EffectPaintPropertyNode* next_effect) { |
| 388 if (next_effect == CurrentEffectNode()) | 405 if (next_effect == CurrentEffectNode()) |
| 389 return; | 406 return; |
| 390 DCHECK(next_effect); | 407 DCHECK(next_effect); |
| 391 | 408 |
| 392 BuildEffectNodesRecursively(next_effect->Parent()); | 409 BuildEffectNodesRecursively(next_effect->Parent()); |
| 393 DCHECK_EQ(next_effect->Parent(), CurrentEffectNode()); | 410 DCHECK_EQ(next_effect->Parent(), CurrentEffectNode()); |
| 394 | 411 |
| 412 BuildRoundedClipEffectNodesBetween(next_effect->OutputClip(), |
| 413 next_effect->Parent()->OutputClip()); |
| 414 |
| 395 #if DCHECK_IS_ON() | 415 #if DCHECK_IS_ON() |
| 396 DCHECK(!effect_nodes_converted_.Contains(next_effect)) | 416 DCHECK(!effect_nodes_converted_.Contains(next_effect)) |
| 397 << "Malformed paint artifact. Paint chunks under the same effect should " | 417 << "Malformed paint artifact. Paint chunks under the same effect should " |
| 398 "be contiguous."; | 418 "be contiguous."; |
| 399 effect_nodes_converted_.insert(next_effect); | 419 effect_nodes_converted_.insert(next_effect); |
| 400 #endif | 420 #endif |
| 401 | 421 |
| 422 BuildEffectNode(next_effect); |
| 423 } |
| 424 |
| 425 void PropertyTreeManager::BuildEffectNode( |
| 426 const EffectPaintPropertyNode* next_effect) { |
| 402 // An effect node can't omit render surface if it has child with exotic | 427 // An effect node can't omit render surface if it has child with exotic |
| 403 // blending mode. See comments below for more detail. | 428 // blending mode. See comments below for more detail. |
| 404 // TODO(crbug.com/504464): Remove premature optimization here. | 429 // TODO(crbug.com/504464): Remove premature optimization here. |
| 405 if (next_effect->BlendMode() != SkBlendMode::kSrcOver) { | 430 if (next_effect->BlendMode() != SkBlendMode::kSrcOver) { |
| 406 GetEffectTree() | 431 GetEffectTree() |
| 407 .Node(GetCurrentCompositorEffectNodeIndex()) | 432 .Node(GetCurrentCompositorEffectNodeIndex()) |
| 408 ->has_render_surface = true; | 433 ->has_render_surface = true; |
| 409 } | 434 } |
| 410 | 435 |
| 411 // We currently create dummy layers to host effect nodes and corresponding | 436 // We currently create dummy layers to host effect nodes and corresponding |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 effect_stack_.push_back(BlinkEffectAndCcIdPair{next_effect, effect_node.id}); | 482 effect_stack_.push_back(BlinkEffectAndCcIdPair{next_effect, effect_node.id}); |
| 458 | 483 |
| 459 dummy_layer->set_property_tree_sequence_number(sequence_number_); | 484 dummy_layer->set_property_tree_sequence_number(sequence_number_); |
| 460 dummy_layer->SetTransformTreeIndex(kSecondaryRootNodeId); | 485 dummy_layer->SetTransformTreeIndex(kSecondaryRootNodeId); |
| 461 dummy_layer->SetClipTreeIndex(output_clip_id); | 486 dummy_layer->SetClipTreeIndex(output_clip_id); |
| 462 dummy_layer->SetEffectTreeIndex(effect_node.id); | 487 dummy_layer->SetEffectTreeIndex(effect_node.id); |
| 463 dummy_layer->SetScrollTreeIndex(kRealRootNodeId); | 488 dummy_layer->SetScrollTreeIndex(kRealRootNodeId); |
| 464 } | 489 } |
| 465 | 490 |
| 466 } // namespace blink | 491 } // namespace blink |
| OLD | NEW |