| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 if (transformNode != ancestorState.transform()) { | 282 if (transformNode != ancestorState.transform()) { |
| 283 const TransformationMatrix& localToAncestorMatrix = | 283 const TransformationMatrix& localToAncestorMatrix = |
| 284 geometryMapper.localToAncestorMatrix(transformNode, | 284 geometryMapper.localToAncestorMatrix(transformNode, |
| 285 ancestorState.transform()); | 285 ancestorState.transform()); |
| 286 // Clips are only in descendant spaces that are transformed by one | 286 // Clips are only in descendant spaces that are transformed by one |
| 287 // or more scrolls. | 287 // or more scrolls. |
| 288 DCHECK(localToAncestorMatrix.isIdentityOrTranslation()); | 288 DCHECK(localToAncestorMatrix.isIdentityOrTranslation()); |
| 289 } | 289 } |
| 290 #endif | 290 #endif |
| 291 | 291 |
| 292 const FloatClipRect& combinedClip = | 292 FloatRect combinedClip = |
| 293 geometryMapper.localToAncestorClipRect(localState, ancestorState); | 293 geometryMapper.localToAncestorClipRect(localState, ancestorState).rect(); |
| 294 | 294 |
| 295 ccList.CreateAndAppendPairedBeginItem<cc::FloatClipDisplayItem>( | 295 ccList.CreateAndAppendPairedBeginItem<cc::FloatClipDisplayItem>( |
| 296 gfx::RectF(combinedClip.rect())); | 296 gfx::RectF(combinedClip)); |
| 297 endDisplayItems.push_back(EndClip); | 297 endDisplayItems.push_back(EndClip); |
| 298 } | 298 } |
| 299 | 299 |
| 300 static void recordPairedBeginDisplayItems( | 300 static void recordPairedBeginDisplayItems( |
| 301 const Vector<PropertyTreeState>& pairedStates, | 301 const Vector<PropertyTreeState>& pairedStates, |
| 302 const PropertyTreeState& pendingLayerState, | 302 const PropertyTreeState& pendingLayerState, |
| 303 cc::DisplayItemList& ccList, | 303 cc::DisplayItemList& ccList, |
| 304 Vector<EndDisplayItemType>& endDisplayItems, | 304 Vector<EndDisplayItemType>& endDisplayItems, |
| 305 GeometryMapper& geometryMapper) { | 305 GeometryMapper& geometryMapper) { |
| 306 PropertyTreeState mappedClipDestinationSpace = pendingLayerState; | 306 PropertyTreeState mappedClipDestinationSpace = pendingLayerState; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 } | 597 } |
| 598 | 598 |
| 599 bool PaintArtifactCompositor::mightOverlap( | 599 bool PaintArtifactCompositor::mightOverlap( |
| 600 const PaintChunk& paintChunk, | 600 const PaintChunk& paintChunk, |
| 601 const PendingLayer& candidatePendingLayer, | 601 const PendingLayer& candidatePendingLayer, |
| 602 GeometryMapper& geometryMapper) { | 602 GeometryMapper& geometryMapper) { |
| 603 PropertyTreeState rootPropertyTreeState(TransformPaintPropertyNode::root(), | 603 PropertyTreeState rootPropertyTreeState(TransformPaintPropertyNode::root(), |
| 604 ClipPaintPropertyNode::root(), | 604 ClipPaintPropertyNode::root(), |
| 605 EffectPaintPropertyNode::root()); | 605 EffectPaintPropertyNode::root()); |
| 606 | 606 |
| 607 FloatRect paintChunkScreenVisualRect = paintChunk.bounds; | 607 FloatRect paintChunkScreenVisualRect = |
| 608 geometryMapper.localToAncestorVisualRect( | 608 geometryMapper |
| 609 paintChunk.properties.propertyTreeState, rootPropertyTreeState, | 609 .localToAncestorVisualRect(paintChunk.bounds, |
| 610 paintChunkScreenVisualRect); | 610 paintChunk.properties.propertyTreeState, |
| 611 rootPropertyTreeState) |
| 612 .rect(); |
| 611 | 613 |
| 612 FloatRect pendingLayerScreenVisualRect = candidatePendingLayer.bounds; | 614 FloatRect pendingLayerScreenVisualRect = |
| 613 geometryMapper.localToAncestorVisualRect( | 615 geometryMapper |
| 614 candidatePendingLayer.propertyTreeState, rootPropertyTreeState, | 616 .localToAncestorVisualRect(candidatePendingLayer.bounds, |
| 615 pendingLayerScreenVisualRect); | 617 candidatePendingLayer.propertyTreeState, |
| 618 rootPropertyTreeState) |
| 619 .rect(); |
| 616 | 620 |
| 617 return paintChunkScreenVisualRect.intersects(pendingLayerScreenVisualRect); | 621 return paintChunkScreenVisualRect.intersects(pendingLayerScreenVisualRect); |
| 618 } | 622 } |
| 619 | 623 |
| 620 PaintArtifactCompositor::PendingLayer::PendingLayer( | 624 PaintArtifactCompositor::PendingLayer::PendingLayer( |
| 621 const PaintChunk& firstPaintChunk) | 625 const PaintChunk& firstPaintChunk) |
| 622 : bounds(firstPaintChunk.bounds), | 626 : bounds(firstPaintChunk.bounds), |
| 623 knownToBeOpaque(firstPaintChunk.knownToBeOpaque), | 627 knownToBeOpaque(firstPaintChunk.knownToBeOpaque), |
| 624 backfaceHidden(firstPaintChunk.properties.backfaceHidden), | 628 backfaceHidden(firstPaintChunk.properties.backfaceHidden), |
| 625 propertyTreeState(firstPaintChunk.properties.propertyTreeState) { | 629 propertyTreeState(firstPaintChunk.properties.propertyTreeState) { |
| 626 paintChunks.push_back(&firstPaintChunk); | 630 paintChunks.push_back(&firstPaintChunk); |
| 627 } | 631 } |
| 628 | 632 |
| 629 void PaintArtifactCompositor::PendingLayer::add( | 633 void PaintArtifactCompositor::PendingLayer::add( |
| 630 const PaintChunk& paintChunk, | 634 const PaintChunk& paintChunk, |
| 631 GeometryMapper* geometryMapper) { | 635 GeometryMapper* geometryMapper) { |
| 632 DCHECK(paintChunk.properties.backfaceHidden == backfaceHidden); | 636 DCHECK(paintChunk.properties.backfaceHidden == backfaceHidden); |
| 633 paintChunks.push_back(&paintChunk); | 637 paintChunks.push_back(&paintChunk); |
| 634 FloatRect mappedBounds = paintChunk.bounds; | 638 FloatRect mappedBounds = paintChunk.bounds; |
| 635 if (geometryMapper) { | 639 if (geometryMapper) { |
| 636 geometryMapper->localToAncestorRect( | 640 mappedBounds = geometryMapper->localToAncestorRect( |
| 637 paintChunk.properties.propertyTreeState.transform(), | 641 mappedBounds, paintChunk.properties.propertyTreeState.transform(), |
| 638 propertyTreeState.transform(), mappedBounds); | 642 propertyTreeState.transform()); |
| 639 } | 643 } |
| 640 bounds.unite(mappedBounds); | 644 bounds.unite(mappedBounds); |
| 641 if (bounds.size() != paintChunks[0]->bounds.size()) { | 645 if (bounds.size() != paintChunks[0]->bounds.size()) { |
| 642 if (bounds.size() != paintChunk.bounds.size()) | 646 if (bounds.size() != paintChunk.bounds.size()) |
| 643 knownToBeOpaque = false; | 647 knownToBeOpaque = false; |
| 644 else | 648 else |
| 645 knownToBeOpaque = paintChunk.knownToBeOpaque; | 649 knownToBeOpaque = paintChunk.knownToBeOpaque; |
| 646 } | 650 } |
| 647 } | 651 } |
| 648 | 652 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 #ifndef NDEBUG | 754 #ifndef NDEBUG |
| 751 void PaintArtifactCompositor::showDebugData() { | 755 void PaintArtifactCompositor::showDebugData() { |
| 752 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) | 756 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) |
| 753 ->toPrettyJSONString() | 757 ->toPrettyJSONString() |
| 754 .utf8() | 758 .utf8() |
| 755 .data(); | 759 .data(); |
| 756 } | 760 } |
| 757 #endif | 761 #endif |
| 758 | 762 |
| 759 } // namespace blink | 763 } // namespace blink |
| OLD | NEW |