| 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/PaintArtifactCompositor.h" | 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 : paintArtifact.getDisplayItemList()[paintChunk.beginIndex].getId())); | 263 : paintArtifact.getDisplayItemList()[paintChunk.beginIndex].getId())); |
| 264 } | 264 } |
| 265 | 265 |
| 266 scoped_refptr<cc::Layer> | 266 scoped_refptr<cc::Layer> |
| 267 PaintArtifactCompositor::compositedLayerForPendingLayer( | 267 PaintArtifactCompositor::compositedLayerForPendingLayer( |
| 268 const PaintArtifact& paintArtifact, | 268 const PaintArtifact& paintArtifact, |
| 269 const PendingLayer& pendingLayer, | 269 const PendingLayer& pendingLayer, |
| 270 gfx::Vector2dF& layerOffset, | 270 gfx::Vector2dF& layerOffset, |
| 271 Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients, | 271 Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients, |
| 272 RasterInvalidationTrackingMap<const PaintChunk>* trackingMap, | 272 RasterInvalidationTrackingMap<const PaintChunk>* trackingMap, |
| 273 bool storeDebugInfo) { | 273 bool storeDebugInfo, |
| 274 GeometryMapper& geometryMapper) { |
| 274 DCHECK(pendingLayer.paintChunks.size()); | 275 DCHECK(pendingLayer.paintChunks.size()); |
| 275 const PaintChunk& firstPaintChunk = *pendingLayer.paintChunks[0]; | 276 const PaintChunk& firstPaintChunk = *pendingLayer.paintChunks[0]; |
| 276 DCHECK(firstPaintChunk.size()); | 277 DCHECK(firstPaintChunk.size()); |
| 277 | 278 |
| 278 // If the paint chunk is a foreign layer, just return that layer. | 279 // If the paint chunk is a foreign layer, just return that layer. |
| 279 if (scoped_refptr<cc::Layer> foreignLayer = foreignLayerForPaintChunk( | 280 if (scoped_refptr<cc::Layer> foreignLayer = foreignLayerForPaintChunk( |
| 280 paintArtifact, firstPaintChunk, layerOffset)) { | 281 paintArtifact, firstPaintChunk, layerOffset)) { |
| 281 DCHECK_EQ(pendingLayer.paintChunks.size(), 1u); | 282 DCHECK_EQ(pendingLayer.paintChunks.size(), 1u); |
| 282 return foreignLayer; | 283 return foreignLayer; |
| 283 } | 284 } |
| 284 | 285 |
| 285 // The common case: create or reuse a PictureLayer for painted content. | 286 // The common case: create or reuse a PictureLayer for painted content. |
| 286 std::unique_ptr<ContentLayerClientImpl> contentLayerClient = | 287 std::unique_ptr<ContentLayerClientImpl> contentLayerClient = |
| 287 clientForPaintChunk(firstPaintChunk, paintArtifact); | 288 clientForPaintChunk(firstPaintChunk, paintArtifact); |
| 288 | 289 |
| 289 gfx::Rect ccCombinedBounds(enclosingIntRect(pendingLayer.bounds)); | 290 gfx::Rect ccCombinedBounds(enclosingIntRect(pendingLayer.bounds)); |
| 290 | 291 |
| 291 layerOffset = ccCombinedBounds.OffsetFromOrigin(); | 292 layerOffset = ccCombinedBounds.OffsetFromOrigin(); |
| 292 scoped_refptr<cc::DisplayItemList> displayList = | 293 scoped_refptr<cc::DisplayItemList> displayList = |
| 293 PaintChunksToCcLayer::convert(pendingLayer.paintChunks, | 294 PaintChunksToCcLayer::convert( |
| 294 pendingLayer.propertyTreeState, layerOffset, | 295 pendingLayer.paintChunks, pendingLayer.propertyTreeState, layerOffset, |
| 295 paintArtifact.getDisplayItemList()); | 296 paintArtifact.getDisplayItemList(), geometryMapper); |
| 296 contentLayerClient->SetDisplayList(std::move(displayList)); | 297 contentLayerClient->SetDisplayList(std::move(displayList)); |
| 297 contentLayerClient->SetPaintableRegion(gfx::Rect(ccCombinedBounds.size())); | 298 contentLayerClient->SetPaintableRegion(gfx::Rect(ccCombinedBounds.size())); |
| 298 | 299 |
| 299 scoped_refptr<cc::PictureLayer> ccPictureLayer = | 300 scoped_refptr<cc::PictureLayer> ccPictureLayer = |
| 300 contentLayerClient->ccPictureLayer(); | 301 contentLayerClient->ccPictureLayer(); |
| 301 ccPictureLayer->SetBounds(ccCombinedBounds.size()); | 302 ccPictureLayer->SetBounds(ccCombinedBounds.size()); |
| 302 ccPictureLayer->SetIsDrawable(true); | 303 ccPictureLayer->SetIsDrawable(true); |
| 303 ccPictureLayer->SetContentsOpaque(pendingLayer.knownToBeOpaque); | 304 ccPictureLayer->SetContentsOpaque(pendingLayer.knownToBeOpaque); |
| 304 contentLayerClient->clearPaintChunkDebugData(); | 305 contentLayerClient->clearPaintChunkDebugData(); |
| 305 | 306 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 const PaintChunk& firstPaintChunk, | 346 const PaintChunk& firstPaintChunk, |
| 346 bool chunkIsForeign) | 347 bool chunkIsForeign) |
| 347 : bounds(firstPaintChunk.bounds), | 348 : bounds(firstPaintChunk.bounds), |
| 348 knownToBeOpaque(firstPaintChunk.knownToBeOpaque), | 349 knownToBeOpaque(firstPaintChunk.knownToBeOpaque), |
| 349 backfaceHidden(firstPaintChunk.properties.backfaceHidden), | 350 backfaceHidden(firstPaintChunk.properties.backfaceHidden), |
| 350 propertyTreeState(firstPaintChunk.properties.propertyTreeState), | 351 propertyTreeState(firstPaintChunk.properties.propertyTreeState), |
| 351 isForeign(chunkIsForeign) { | 352 isForeign(chunkIsForeign) { |
| 352 paintChunks.push_back(&firstPaintChunk); | 353 paintChunks.push_back(&firstPaintChunk); |
| 353 } | 354 } |
| 354 | 355 |
| 355 void PaintArtifactCompositor::PendingLayer::merge(const PendingLayer& guest) { | 356 void PaintArtifactCompositor::PendingLayer::merge( |
| 357 const PendingLayer& guest, |
| 358 GeometryMapper& geometryMapper) { |
| 356 DCHECK(!isForeign && !guest.isForeign); | 359 DCHECK(!isForeign && !guest.isForeign); |
| 357 DCHECK_EQ(backfaceHidden, guest.backfaceHidden); | 360 DCHECK_EQ(backfaceHidden, guest.backfaceHidden); |
| 358 | 361 |
| 359 paintChunks.appendVector(guest.paintChunks); | 362 paintChunks.appendVector(guest.paintChunks); |
| 360 FloatRect guestBoundsInHome = guest.bounds; | 363 FloatRect guestBoundsInHome = guest.bounds; |
| 361 GeometryMapper::localToAncestorVisualRect( | 364 geometryMapper.localToAncestorVisualRect( |
| 362 guest.propertyTreeState, propertyTreeState, guestBoundsInHome); | 365 guest.propertyTreeState, propertyTreeState, guestBoundsInHome); |
| 363 FloatRect oldBounds = bounds; | 366 FloatRect oldBounds = bounds; |
| 364 bounds.unite(guestBoundsInHome); | 367 bounds.unite(guestBoundsInHome); |
| 365 if (bounds != oldBounds) | 368 if (bounds != oldBounds) |
| 366 knownToBeOpaque = false; | 369 knownToBeOpaque = false; |
| 367 // TODO(crbug.com/701991): Upgrade GeometryMapper. | 370 // TODO(crbug.com/701991): Upgrade GeometryMapper. |
| 368 // If we knew the new bounds is enclosed by the mapped opaque region of | 371 // If we knew the new bounds is enclosed by the mapped opaque region of |
| 369 // the guest layer, we can deduce the merged layer being opaque too. | 372 // the guest layer, we can deduce the merged layer being opaque too. |
| 370 } | 373 } |
| 371 | 374 |
| 372 static bool canUpcastTo(const PropertyTreeState& guest, | 375 static bool canUpcastTo(const PropertyTreeState& guest, |
| 373 const PropertyTreeState& home); | 376 const PropertyTreeState& home); |
| 374 bool PaintArtifactCompositor::PendingLayer::canMerge( | 377 bool PaintArtifactCompositor::PendingLayer::canMerge( |
| 375 const PendingLayer& guest) const { | 378 const PendingLayer& guest) const { |
| 376 if (isForeign || guest.isForeign) | 379 if (isForeign || guest.isForeign) |
| 377 return false; | 380 return false; |
| 378 if (backfaceHidden != guest.backfaceHidden) | 381 if (backfaceHidden != guest.backfaceHidden) |
| 379 return false; | 382 return false; |
| 380 if (propertyTreeState.effect() != guest.propertyTreeState.effect()) | 383 if (propertyTreeState.effect() != guest.propertyTreeState.effect()) |
| 381 return false; | 384 return false; |
| 382 return canUpcastTo(guest.propertyTreeState, propertyTreeState); | 385 return canUpcastTo(guest.propertyTreeState, propertyTreeState); |
| 383 } | 386 } |
| 384 | 387 |
| 385 void PaintArtifactCompositor::PendingLayer::upcast( | 388 void PaintArtifactCompositor::PendingLayer::upcast( |
| 386 const PropertyTreeState& newState) { | 389 const PropertyTreeState& newState, |
| 390 GeometryMapper& geometryMapper) { |
| 387 DCHECK(!isForeign); | 391 DCHECK(!isForeign); |
| 388 GeometryMapper::localToAncestorVisualRect(propertyTreeState, newState, | 392 geometryMapper.localToAncestorVisualRect(propertyTreeState, newState, bounds); |
| 389 bounds); | |
| 390 | 393 |
| 391 propertyTreeState = newState; | 394 propertyTreeState = newState; |
| 392 // TODO(crbug.com/701991): Upgrade GeometryMapper. | 395 // TODO(crbug.com/701991): Upgrade GeometryMapper. |
| 393 // A local visual rect mapped to an ancestor space may become a polygon | 396 // A local visual rect mapped to an ancestor space may become a polygon |
| 394 // (e.g. consider transformed clip), also effects may affect the opaque | 397 // (e.g. consider transformed clip), also effects may affect the opaque |
| 395 // region. To determine whether the layer is still opaque, we need to | 398 // region. To determine whether the layer is still opaque, we need to |
| 396 // query conservative opaque rect after mapping to an ancestor space, | 399 // query conservative opaque rect after mapping to an ancestor space, |
| 397 // which is not supported by GeometryMapper yet. | 400 // which is not supported by GeometryMapper yet. |
| 398 knownToBeOpaque = false; | 401 knownToBeOpaque = false; |
| 399 } | 402 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 const EffectPaintPropertyNode* ancestor, | 444 const EffectPaintPropertyNode* ancestor, |
| 442 const EffectPaintPropertyNode* node) { | 445 const EffectPaintPropertyNode* node) { |
| 443 for (; node; node = node->parent()) { | 446 for (; node; node = node->parent()) { |
| 444 if (node->parent() == ancestor) | 447 if (node->parent() == ancestor) |
| 445 return node; | 448 return node; |
| 446 } | 449 } |
| 447 return nullptr; | 450 return nullptr; |
| 448 } | 451 } |
| 449 | 452 |
| 450 bool PaintArtifactCompositor::mightOverlap(const PendingLayer& layerA, | 453 bool PaintArtifactCompositor::mightOverlap(const PendingLayer& layerA, |
| 451 const PendingLayer& layerB) { | 454 const PendingLayer& layerB, |
| 455 GeometryMapper& geometryMapper) { |
| 452 PropertyTreeState rootPropertyTreeState(TransformPaintPropertyNode::root(), | 456 PropertyTreeState rootPropertyTreeState(TransformPaintPropertyNode::root(), |
| 453 ClipPaintPropertyNode::root(), | 457 ClipPaintPropertyNode::root(), |
| 454 EffectPaintPropertyNode::root()); | 458 EffectPaintPropertyNode::root()); |
| 455 | 459 |
| 456 FloatRect boundsA = layerA.bounds; | 460 FloatRect boundsA = layerA.bounds; |
| 457 GeometryMapper::localToAncestorVisualRect(layerA.propertyTreeState, | 461 geometryMapper.localToAncestorVisualRect(layerA.propertyTreeState, |
| 458 rootPropertyTreeState, boundsA); | 462 rootPropertyTreeState, boundsA); |
| 459 FloatRect boundsB = layerB.bounds; | 463 FloatRect boundsB = layerB.bounds; |
| 460 GeometryMapper::localToAncestorVisualRect(layerB.propertyTreeState, | 464 geometryMapper.localToAncestorVisualRect(layerB.propertyTreeState, |
| 461 rootPropertyTreeState, boundsB); | 465 rootPropertyTreeState, boundsB); |
| 462 | 466 |
| 463 return boundsA.intersects(boundsB); | 467 return boundsA.intersects(boundsB); |
| 464 } | 468 } |
| 465 | 469 |
| 466 bool PaintArtifactCompositor::canDecompositeEffect( | 470 bool PaintArtifactCompositor::canDecompositeEffect( |
| 467 const EffectPaintPropertyNode* effect, | 471 const EffectPaintPropertyNode* effect, |
| 468 const PendingLayer& layer) { | 472 const PendingLayer& layer) { |
| 469 // If the effect associated with the layer is deeper than than the effect | 473 // If the effect associated with the layer is deeper than than the effect |
| 470 // we are attempting to decomposite, than implies some previous decision | 474 // we are attempting to decomposite, than implies some previous decision |
| 471 // did not allow to decomposite intermediate effects. | 475 // did not allow to decomposite intermediate effects. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 482 if (!canUpcastTo(layer.propertyTreeState, | 486 if (!canUpcastTo(layer.propertyTreeState, |
| 483 PropertyTreeState(effect->localTransformSpace(), | 487 PropertyTreeState(effect->localTransformSpace(), |
| 484 effect->outputClip(), effect))) | 488 effect->outputClip(), effect))) |
| 485 return false; | 489 return false; |
| 486 return true; | 490 return true; |
| 487 } | 491 } |
| 488 | 492 |
| 489 void PaintArtifactCompositor::layerizeGroup( | 493 void PaintArtifactCompositor::layerizeGroup( |
| 490 const PaintArtifact& paintArtifact, | 494 const PaintArtifact& paintArtifact, |
| 491 Vector<PendingLayer>& pendingLayers, | 495 Vector<PendingLayer>& pendingLayers, |
| 496 GeometryMapper& geometryMapper, |
| 492 const EffectPaintPropertyNode& currentGroup, | 497 const EffectPaintPropertyNode& currentGroup, |
| 493 Vector<PaintChunk>::const_iterator& chunkIt) { | 498 Vector<PaintChunk>::const_iterator& chunkIt) { |
| 494 size_t firstLayerInCurrentGroup = pendingLayers.size(); | 499 size_t firstLayerInCurrentGroup = pendingLayers.size(); |
| 495 // The worst case time complexity of the algorithm is O(pqd), where | 500 // The worst case time complexity of the algorithm is O(pqd), where |
| 496 // p = the number of paint chunks. | 501 // p = the number of paint chunks. |
| 497 // q = average number of trials to find a squash layer or rejected | 502 // q = average number of trials to find a squash layer or rejected |
| 498 // for overlapping. | 503 // for overlapping. |
| 499 // d = (sum of) the depth of property trees. | 504 // d = (sum of) the depth of property trees. |
| 500 // The analysis as follows: | 505 // The analysis as follows: |
| 501 // Every paint chunk will be visited by the main loop below for exactly once, | 506 // Every paint chunk will be visited by the main loop below for exactly once, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 527 } else { | 532 } else { |
| 528 const EffectPaintPropertyNode* subgroup = | 533 const EffectPaintPropertyNode* subgroup = |
| 529 strictChildOfAlongPath(¤tGroup, chunkEffect); | 534 strictChildOfAlongPath(¤tGroup, chunkEffect); |
| 530 // Case B: This means we need to close the current group without | 535 // Case B: This means we need to close the current group without |
| 531 // processing the next chunk. | 536 // processing the next chunk. |
| 532 if (!subgroup) | 537 if (!subgroup) |
| 533 break; | 538 break; |
| 534 // Case C: The following chunks belong to a subgroup. Process them by | 539 // Case C: The following chunks belong to a subgroup. Process them by |
| 535 // a recursion call. | 540 // a recursion call. |
| 536 size_t firstLayerInSubgroup = pendingLayers.size(); | 541 size_t firstLayerInSubgroup = pendingLayers.size(); |
| 537 layerizeGroup(paintArtifact, pendingLayers, *subgroup, chunkIt); | 542 layerizeGroup(paintArtifact, pendingLayers, geometryMapper, *subgroup, |
| 543 chunkIt); |
| 538 // Now the chunk iterator stepped over the subgroup we just saw. | 544 // Now the chunk iterator stepped over the subgroup we just saw. |
| 539 // If the subgroup generated 2 or more layers then the subgroup must be | 545 // If the subgroup generated 2 or more layers then the subgroup must be |
| 540 // composited to satisfy grouping requirement. | 546 // composited to satisfy grouping requirement. |
| 541 // i.e. Grouping effects generally must be applied atomically, | 547 // i.e. Grouping effects generally must be applied atomically, |
| 542 // for example, Opacity(A+B) != Opacity(A) + Opacity(B), thus an effect | 548 // for example, Opacity(A+B) != Opacity(A) + Opacity(B), thus an effect |
| 543 // either applied 100% within a layer, or not at all applied within layer | 549 // either applied 100% within a layer, or not at all applied within layer |
| 544 // (i.e. applied by compositor render surface instead). | 550 // (i.e. applied by compositor render surface instead). |
| 545 if (pendingLayers.size() != firstLayerInSubgroup + 1) | 551 if (pendingLayers.size() != firstLayerInSubgroup + 1) |
| 546 continue; | 552 continue; |
| 547 // Now attempt to "decomposite" subgroup. | 553 // Now attempt to "decomposite" subgroup. |
| 548 PendingLayer& subgroupLayer = pendingLayers[firstLayerInSubgroup]; | 554 PendingLayer& subgroupLayer = pendingLayers[firstLayerInSubgroup]; |
| 549 if (!canDecompositeEffect(subgroup, subgroupLayer)) | 555 if (!canDecompositeEffect(subgroup, subgroupLayer)) |
| 550 continue; | 556 continue; |
| 551 subgroupLayer.upcast(PropertyTreeState(subgroup->localTransformSpace(), | 557 subgroupLayer.upcast( |
| 552 subgroup->outputClip(), | 558 PropertyTreeState(subgroup->localTransformSpace(), |
| 553 ¤tGroup)); | 559 subgroup->outputClip(), ¤tGroup), |
| 560 geometryMapper); |
| 554 } | 561 } |
| 555 // At this point pendingLayers.back() is the either a layer from a | 562 // At this point pendingLayers.back() is the either a layer from a |
| 556 // "decomposited" subgroup or a layer created from a chunk we just | 563 // "decomposited" subgroup or a layer created from a chunk we just |
| 557 // processed. Now determine whether it could be merged into a previous | 564 // processed. Now determine whether it could be merged into a previous |
| 558 // layer. | 565 // layer. |
| 559 const PendingLayer& newLayer = pendingLayers.back(); | 566 const PendingLayer& newLayer = pendingLayers.back(); |
| 560 DCHECK(!newLayer.isForeign); | 567 DCHECK(!newLayer.isForeign); |
| 561 DCHECK_EQ(¤tGroup, newLayer.propertyTreeState.effect()); | 568 DCHECK_EQ(¤tGroup, newLayer.propertyTreeState.effect()); |
| 562 // This iterates pendingLayers[firstLayerInCurrentGroup:-1] in reverse. | 569 // This iterates pendingLayers[firstLayerInCurrentGroup:-1] in reverse. |
| 563 for (size_t candidateIndex = pendingLayers.size() - 1; | 570 for (size_t candidateIndex = pendingLayers.size() - 1; |
| 564 candidateIndex-- > firstLayerInCurrentGroup;) { | 571 candidateIndex-- > firstLayerInCurrentGroup;) { |
| 565 PendingLayer& candidateLayer = pendingLayers[candidateIndex]; | 572 PendingLayer& candidateLayer = pendingLayers[candidateIndex]; |
| 566 if (candidateLayer.canMerge(newLayer)) { | 573 if (candidateLayer.canMerge(newLayer)) { |
| 567 candidateLayer.merge(newLayer); | 574 candidateLayer.merge(newLayer, geometryMapper); |
| 568 pendingLayers.pop_back(); | 575 pendingLayers.pop_back(); |
| 569 break; | 576 break; |
| 570 } | 577 } |
| 571 if (mightOverlap(newLayer, candidateLayer)) | 578 if (mightOverlap(newLayer, candidateLayer, geometryMapper)) |
| 572 break; | 579 break; |
| 573 } | 580 } |
| 574 } | 581 } |
| 575 } | 582 } |
| 576 | 583 |
| 577 void PaintArtifactCompositor::collectPendingLayers( | 584 void PaintArtifactCompositor::collectPendingLayers( |
| 578 const PaintArtifact& paintArtifact, | 585 const PaintArtifact& paintArtifact, |
| 579 Vector<PendingLayer>& pendingLayers) { | 586 Vector<PendingLayer>& pendingLayers, |
| 587 GeometryMapper& geometryMapper) { |
| 580 Vector<PaintChunk>::const_iterator cursor = | 588 Vector<PaintChunk>::const_iterator cursor = |
| 581 paintArtifact.paintChunks().begin(); | 589 paintArtifact.paintChunks().begin(); |
| 582 layerizeGroup(paintArtifact, pendingLayers, *EffectPaintPropertyNode::root(), | 590 layerizeGroup(paintArtifact, pendingLayers, geometryMapper, |
| 583 cursor); | 591 *EffectPaintPropertyNode::root(), cursor); |
| 584 DCHECK_EQ(paintArtifact.paintChunks().end(), cursor); | 592 DCHECK_EQ(paintArtifact.paintChunks().end(), cursor); |
| 585 } | 593 } |
| 586 | 594 |
| 587 void PaintArtifactCompositor::update( | 595 void PaintArtifactCompositor::update( |
| 588 const PaintArtifact& paintArtifact, | 596 const PaintArtifact& paintArtifact, |
| 589 RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations, | 597 RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations, |
| 590 bool storeDebugInfo) { | 598 bool storeDebugInfo, |
| 599 GeometryMapper& geometryMapper) { |
| 591 #ifndef NDEBUG | 600 #ifndef NDEBUG |
| 592 storeDebugInfo = true; | 601 storeDebugInfo = true; |
| 593 #endif | 602 #endif |
| 594 | 603 |
| 595 DCHECK(m_rootLayer); | 604 DCHECK(m_rootLayer); |
| 596 | 605 |
| 597 cc::LayerTreeHost* layerTreeHost = m_rootLayer->layer_tree_host(); | 606 cc::LayerTreeHost* layerTreeHost = m_rootLayer->layer_tree_host(); |
| 598 | 607 |
| 599 // The tree will be null after detaching and this update can be ignored. | 608 // The tree will be null after detaching and this update can be ignored. |
| 600 // See: WebViewImpl::detachPaintArtifactCompositor(). | 609 // See: WebViewImpl::detachPaintArtifactCompositor(). |
| 601 if (!layerTreeHost) | 610 if (!layerTreeHost) |
| 602 return; | 611 return; |
| 603 | 612 |
| 604 if (m_extraDataForTestingEnabled) | 613 if (m_extraDataForTestingEnabled) |
| 605 m_extraDataForTesting = WTF::wrapUnique(new ExtraDataForTesting); | 614 m_extraDataForTesting = WTF::wrapUnique(new ExtraDataForTesting); |
| 606 | 615 |
| 607 m_rootLayer->RemoveAllChildren(); | 616 m_rootLayer->RemoveAllChildren(); |
| 608 | 617 |
| 609 m_rootLayer->set_property_tree_sequence_number(sPropertyTreeSequenceNumber); | 618 m_rootLayer->set_property_tree_sequence_number(sPropertyTreeSequenceNumber); |
| 610 | 619 |
| 611 PropertyTreeManager propertyTreeManager(*layerTreeHost->property_trees(), | 620 PropertyTreeManager propertyTreeManager(*layerTreeHost->property_trees(), |
| 612 m_rootLayer.get(), | 621 m_rootLayer.get(), |
| 613 sPropertyTreeSequenceNumber); | 622 sPropertyTreeSequenceNumber); |
| 614 | 623 |
| 615 Vector<PendingLayer, 0> pendingLayers; | 624 Vector<PendingLayer, 0> pendingLayers; |
| 616 collectPendingLayers(paintArtifact, pendingLayers); | 625 collectPendingLayers(paintArtifact, pendingLayers, geometryMapper); |
| 617 | 626 |
| 618 Vector<std::unique_ptr<ContentLayerClientImpl>> newContentLayerClients; | 627 Vector<std::unique_ptr<ContentLayerClientImpl>> newContentLayerClients; |
| 619 newContentLayerClients.reserveCapacity(paintArtifact.paintChunks().size()); | 628 newContentLayerClients.reserveCapacity(paintArtifact.paintChunks().size()); |
| 620 for (const PendingLayer& pendingLayer : pendingLayers) { | 629 for (const PendingLayer& pendingLayer : pendingLayers) { |
| 621 gfx::Vector2dF layerOffset; | 630 gfx::Vector2dF layerOffset; |
| 622 scoped_refptr<cc::Layer> layer = compositedLayerForPendingLayer( | 631 scoped_refptr<cc::Layer> layer = compositedLayerForPendingLayer( |
| 623 paintArtifact, pendingLayer, layerOffset, newContentLayerClients, | 632 paintArtifact, pendingLayer, layerOffset, newContentLayerClients, |
| 624 rasterChunkInvalidations, storeDebugInfo); | 633 rasterChunkInvalidations, storeDebugInfo, geometryMapper); |
| 625 | 634 |
| 626 const auto* transform = pendingLayer.propertyTreeState.transform(); | 635 const auto* transform = pendingLayer.propertyTreeState.transform(); |
| 627 int transformId = | 636 int transformId = |
| 628 propertyTreeManager.ensureCompositorTransformNode(transform); | 637 propertyTreeManager.ensureCompositorTransformNode(transform); |
| 629 int clipId = propertyTreeManager.ensureCompositorClipNode( | 638 int clipId = propertyTreeManager.ensureCompositorClipNode( |
| 630 pendingLayer.propertyTreeState.clip()); | 639 pendingLayer.propertyTreeState.clip()); |
| 631 int effectId = propertyTreeManager.switchToEffectNode( | 640 int effectId = propertyTreeManager.switchToEffectNode( |
| 632 *pendingLayer.propertyTreeState.effect()); | 641 *pendingLayer.propertyTreeState.effect()); |
| 633 | 642 |
| 634 layer->set_offset_to_transform_parent(layerOffset); | 643 layer->set_offset_to_transform_parent(layerOffset); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 661 #ifndef NDEBUG | 670 #ifndef NDEBUG |
| 662 void PaintArtifactCompositor::showDebugData() { | 671 void PaintArtifactCompositor::showDebugData() { |
| 663 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) | 672 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) |
| 664 ->toPrettyJSONString() | 673 ->toPrettyJSONString() |
| 665 .utf8() | 674 .utf8() |
| 666 .data(); | 675 .data(); |
| 667 } | 676 } |
| 668 #endif | 677 #endif |
| 669 | 678 |
| 670 } // namespace blink | 679 } // namespace blink |
| OLD | NEW |