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 FloatRect combinedClip = | 292 const FloatClipRect& combinedClip = |
293 geometryMapper.localToAncestorClipRect(localState, ancestorState).rect(); | 293 geometryMapper.localToAncestorClipRect(localState, ancestorState); |
294 | 294 |
295 ccList.CreateAndAppendPairedBeginItem<cc::FloatClipDisplayItem>( | 295 ccList.CreateAndAppendPairedBeginItem<cc::FloatClipDisplayItem>( |
296 gfx::RectF(combinedClip)); | 296 gfx::RectF(combinedClip.rect())); |
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 = | 607 FloatRect paintChunkScreenVisualRect = paintChunk.bounds; |
608 geometryMapper | 608 geometryMapper.localToAncestorVisualRect( |
609 .localToAncestorVisualRect(paintChunk.bounds, | 609 paintChunk.properties.propertyTreeState, rootPropertyTreeState, |
610 paintChunk.properties.propertyTreeState, | 610 paintChunkScreenVisualRect); |
611 rootPropertyTreeState) | |
612 .rect(); | |
613 | 611 |
614 FloatRect pendingLayerScreenVisualRect = | 612 FloatRect pendingLayerScreenVisualRect = candidatePendingLayer.bounds; |
615 geometryMapper | 613 geometryMapper.localToAncestorVisualRect( |
616 .localToAncestorVisualRect(candidatePendingLayer.bounds, | 614 candidatePendingLayer.propertyTreeState, rootPropertyTreeState, |
617 candidatePendingLayer.propertyTreeState, | 615 pendingLayerScreenVisualRect); |
618 rootPropertyTreeState) | |
619 .rect(); | |
620 | 616 |
621 return paintChunkScreenVisualRect.intersects(pendingLayerScreenVisualRect); | 617 return paintChunkScreenVisualRect.intersects(pendingLayerScreenVisualRect); |
622 } | 618 } |
623 | 619 |
624 PaintArtifactCompositor::PendingLayer::PendingLayer( | 620 PaintArtifactCompositor::PendingLayer::PendingLayer( |
625 const PaintChunk& firstPaintChunk) | 621 const PaintChunk& firstPaintChunk) |
626 : bounds(firstPaintChunk.bounds), | 622 : bounds(firstPaintChunk.bounds), |
627 knownToBeOpaque(firstPaintChunk.knownToBeOpaque), | 623 knownToBeOpaque(firstPaintChunk.knownToBeOpaque), |
628 backfaceHidden(firstPaintChunk.properties.backfaceHidden), | 624 backfaceHidden(firstPaintChunk.properties.backfaceHidden), |
629 propertyTreeState(firstPaintChunk.properties.propertyTreeState) { | 625 propertyTreeState(firstPaintChunk.properties.propertyTreeState) { |
630 paintChunks.push_back(&firstPaintChunk); | 626 paintChunks.push_back(&firstPaintChunk); |
631 } | 627 } |
632 | 628 |
633 void PaintArtifactCompositor::PendingLayer::add( | 629 void PaintArtifactCompositor::PendingLayer::add( |
634 const PaintChunk& paintChunk, | 630 const PaintChunk& paintChunk, |
635 GeometryMapper* geometryMapper) { | 631 GeometryMapper* geometryMapper) { |
636 DCHECK(paintChunk.properties.backfaceHidden == backfaceHidden); | 632 DCHECK(paintChunk.properties.backfaceHidden == backfaceHidden); |
637 paintChunks.push_back(&paintChunk); | 633 paintChunks.push_back(&paintChunk); |
638 FloatRect mappedBounds = paintChunk.bounds; | 634 FloatRect mappedBounds = paintChunk.bounds; |
639 if (geometryMapper) { | 635 if (geometryMapper) { |
640 mappedBounds = geometryMapper->localToAncestorRect( | 636 geometryMapper->localToAncestorRect( |
641 mappedBounds, paintChunk.properties.propertyTreeState.transform(), | 637 paintChunk.properties.propertyTreeState.transform(), |
642 propertyTreeState.transform()); | 638 propertyTreeState.transform(), mappedBounds); |
643 } | 639 } |
644 bounds.unite(mappedBounds); | 640 bounds.unite(mappedBounds); |
645 if (bounds.size() != paintChunks[0]->bounds.size()) { | 641 if (bounds.size() != paintChunks[0]->bounds.size()) { |
646 if (bounds.size() != paintChunk.bounds.size()) | 642 if (bounds.size() != paintChunk.bounds.size()) |
647 knownToBeOpaque = false; | 643 knownToBeOpaque = false; |
648 else | 644 else |
649 knownToBeOpaque = paintChunk.knownToBeOpaque; | 645 knownToBeOpaque = paintChunk.knownToBeOpaque; |
650 } | 646 } |
651 } | 647 } |
652 | 648 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 #ifndef NDEBUG | 750 #ifndef NDEBUG |
755 void PaintArtifactCompositor::showDebugData() { | 751 void PaintArtifactCompositor::showDebugData() { |
756 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) | 752 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) |
757 ->toPrettyJSONString() | 753 ->toPrettyJSONString() |
758 .utf8() | 754 .utf8() |
759 .data(); | 755 .data(); |
760 } | 756 } |
761 #endif | 757 #endif |
762 | 758 |
763 } // namespace blink | 759 } // namespace blink |
OLD | NEW |