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 "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "cc/layers/picture_layer.h" | 9 #include "cc/layers/picture_layer.h" |
10 #include "cc/playback/compositing_display_item.h" | 10 #include "cc/playback/compositing_display_item.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 cc::DisplayItemList& ccList, | 279 cc::DisplayItemList& ccList, |
280 Vector<EndDisplayItemType>& endDisplayItems, | 280 Vector<EndDisplayItemType>& endDisplayItems, |
281 GeometryMapper& geometryMapper) { | 281 GeometryMapper& geometryMapper) { |
282 DCHECK(localState.transform() == ancestorState.transform()); | 282 DCHECK(localState.transform() == ancestorState.transform()); |
283 #ifdef DCHECK_IS_ON | 283 #ifdef DCHECK_IS_ON |
284 const TransformPaintPropertyNode* transformNode = | 284 const TransformPaintPropertyNode* transformNode = |
285 localState.clip()->localTransformSpace(); | 285 localState.clip()->localTransformSpace(); |
286 if (transformNode != ancestorState.transform()) { | 286 if (transformNode != ancestorState.transform()) { |
287 bool success = false; | 287 bool success = false; |
288 const TransformationMatrix& localToAncestorMatrix = | 288 const TransformationMatrix& localToAncestorMatrix = |
289 geometryMapper.localToAncestorMatrix(transformNode, ancestorState, | 289 geometryMapper.localToAncestorMatrix( |
290 success); | 290 transformNode, ancestorState.transform(), success); |
291 DCHECK(success); | 291 DCHECK(success); |
292 // Clips are only in descendant spaces that are transformed by one | 292 // Clips are only in descendant spaces that are transformed by one |
293 // or more scrolls. | 293 // or more scrolls. |
294 DCHECK(localToAncestorMatrix.isIdentityOrTranslation()); | 294 DCHECK(localToAncestorMatrix.isIdentityOrTranslation()); |
295 } | 295 } |
296 #endif | 296 #endif |
297 | 297 |
298 FloatRect combinedClip; | 298 FloatRect combinedClip; |
299 bool success = false; | 299 bool success = false; |
300 combinedClip = geometryMapper.localToAncestorClipRect(localState, | 300 combinedClip = geometryMapper.localToAncestorClipRect(localState, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 FloatRect clipRect = | 366 FloatRect clipRect = |
367 pairedState->effect()->outputClip()->clipRect().rect(); | 367 pairedState->effect()->outputClip()->clipRect().rect(); |
368 // TODO(chrishtr): specify origin of the filter. | 368 // TODO(chrishtr): specify origin of the filter. |
369 FloatPoint filterOrigin; | 369 FloatPoint filterOrigin; |
370 if (pairedState->effect()->localTransformSpace() != | 370 if (pairedState->effect()->localTransformSpace() != |
371 pairedState->transform()) { | 371 pairedState->transform()) { |
372 bool success = false; | 372 bool success = false; |
373 const TransformPaintPropertyNode* transformNode = | 373 const TransformPaintPropertyNode* transformNode = |
374 pairedState->effect()->localTransformSpace(); | 374 pairedState->effect()->localTransformSpace(); |
375 const TransformationMatrix& localToAncestorMatrix = | 375 const TransformationMatrix& localToAncestorMatrix = |
376 geometryMapper.localToAncestorMatrix(transformNode, *pairedState, | 376 geometryMapper.localToAncestorMatrix( |
377 success); | 377 transformNode, pairedState->transform(), success); |
378 DCHECK(success); | 378 DCHECK(success); |
379 // Effects are only in descendant spaces that are transformed by one | 379 // Effects are only in descendant spaces that are transformed by one |
380 // or more scrolls. | 380 // or more scrolls. |
381 DCHECK(localToAncestorMatrix.isIdentityOrTranslation()); | 381 DCHECK(localToAncestorMatrix.isIdentityOrTranslation()); |
382 | 382 |
383 clipRect = localToAncestorMatrix.mapRect(clipRect); | 383 clipRect = localToAncestorMatrix.mapRect(clipRect); |
384 filterOrigin = localToAncestorMatrix.mapPoint(filterOrigin); | 384 filterOrigin = localToAncestorMatrix.mapPoint(filterOrigin); |
385 } | 385 } |
386 | 386 |
387 const bool kLcdTextRequiresOpaqueLayer = true; | 387 const bool kLcdTextRequiresOpaqueLayer = true; |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 bool PaintArtifactCompositor::mightOverlap( | 1074 bool PaintArtifactCompositor::mightOverlap( |
1075 const PaintChunk& paintChunk, | 1075 const PaintChunk& paintChunk, |
1076 const PendingLayer& candidatePendingLayer, | 1076 const PendingLayer& candidatePendingLayer, |
1077 GeometryMapper& geometryMapper) { | 1077 GeometryMapper& geometryMapper) { |
1078 PropertyTreeState rootPropertyTreeState( | 1078 PropertyTreeState rootPropertyTreeState( |
1079 TransformPaintPropertyNode::root(), ClipPaintPropertyNode::root(), | 1079 TransformPaintPropertyNode::root(), ClipPaintPropertyNode::root(), |
1080 EffectPaintPropertyNode::root(), ScrollPaintPropertyNode::root()); | 1080 EffectPaintPropertyNode::root(), ScrollPaintPropertyNode::root()); |
1081 | 1081 |
1082 bool success = false; | 1082 bool success = false; |
1083 FloatRect paintChunkScreenVisualRect = | 1083 FloatRect paintChunkScreenVisualRect = |
1084 geometryMapper.localToVisualRectInAncestorSpace( | 1084 geometryMapper.localToAncestorVisualRect( |
1085 paintChunk.bounds, paintChunk.properties.propertyTreeState, | 1085 paintChunk.bounds, paintChunk.properties.propertyTreeState, |
1086 rootPropertyTreeState, success); | 1086 rootPropertyTreeState, success); |
1087 DCHECK(success); | 1087 DCHECK(success); |
1088 | 1088 |
1089 success = false; | 1089 success = false; |
1090 FloatRect pendingLayerScreenVisualRect = | 1090 FloatRect pendingLayerScreenVisualRect = |
1091 geometryMapper.localToVisualRectInAncestorSpace( | 1091 geometryMapper.localToAncestorVisualRect( |
1092 candidatePendingLayer.bounds, candidatePendingLayer.propertyTreeState, | 1092 candidatePendingLayer.bounds, candidatePendingLayer.propertyTreeState, |
1093 rootPropertyTreeState, success); | 1093 rootPropertyTreeState, success); |
1094 DCHECK(success); | 1094 DCHECK(success); |
1095 | 1095 |
1096 return paintChunkScreenVisualRect.intersects(pendingLayerScreenVisualRect); | 1096 return paintChunkScreenVisualRect.intersects(pendingLayerScreenVisualRect); |
1097 } | 1097 } |
1098 | 1098 |
1099 PaintArtifactCompositor::PendingLayer::PendingLayer( | 1099 PaintArtifactCompositor::PendingLayer::PendingLayer( |
1100 const PaintChunk& firstPaintChunk) | 1100 const PaintChunk& firstPaintChunk) |
1101 : bounds(firstPaintChunk.bounds), | 1101 : bounds(firstPaintChunk.bounds), |
1102 knownToBeOpaque(firstPaintChunk.knownToBeOpaque), | 1102 knownToBeOpaque(firstPaintChunk.knownToBeOpaque), |
1103 backfaceHidden(firstPaintChunk.properties.backfaceHidden), | 1103 backfaceHidden(firstPaintChunk.properties.backfaceHidden), |
1104 propertyTreeState(firstPaintChunk.properties.propertyTreeState) { | 1104 propertyTreeState(firstPaintChunk.properties.propertyTreeState) { |
1105 paintChunks.push_back(&firstPaintChunk); | 1105 paintChunks.push_back(&firstPaintChunk); |
1106 } | 1106 } |
1107 | 1107 |
1108 void PaintArtifactCompositor::PendingLayer::add( | 1108 void PaintArtifactCompositor::PendingLayer::add( |
1109 const PaintChunk& paintChunk, | 1109 const PaintChunk& paintChunk, |
1110 GeometryMapper* geometryMapper) { | 1110 GeometryMapper* geometryMapper) { |
1111 DCHECK(paintChunk.properties.backfaceHidden == backfaceHidden); | 1111 DCHECK(paintChunk.properties.backfaceHidden == backfaceHidden); |
1112 paintChunks.push_back(&paintChunk); | 1112 paintChunks.push_back(&paintChunk); |
1113 FloatRect mappedBounds = paintChunk.bounds; | 1113 FloatRect mappedBounds = paintChunk.bounds; |
1114 if (geometryMapper) { | 1114 if (geometryMapper) { |
1115 bool success = false; | 1115 bool success = false; |
1116 mappedBounds = geometryMapper->localToAncestorRect( | 1116 mappedBounds = geometryMapper->localToAncestorRect( |
1117 mappedBounds, paintChunk.properties.propertyTreeState, | 1117 mappedBounds, paintChunk.properties.propertyTreeState.transform(), |
1118 propertyTreeState, success); | 1118 propertyTreeState.transform(), success); |
1119 DCHECK(success); | 1119 DCHECK(success); |
1120 } | 1120 } |
1121 bounds.unite(mappedBounds); | 1121 bounds.unite(mappedBounds); |
1122 if (bounds.size() != paintChunks[0]->bounds.size()) { | 1122 if (bounds.size() != paintChunks[0]->bounds.size()) { |
1123 if (bounds.size() != paintChunk.bounds.size()) | 1123 if (bounds.size() != paintChunk.bounds.size()) |
1124 knownToBeOpaque = false; | 1124 knownToBeOpaque = false; |
1125 else | 1125 else |
1126 knownToBeOpaque = paintChunk.knownToBeOpaque; | 1126 knownToBeOpaque = paintChunk.knownToBeOpaque; |
1127 } | 1127 } |
1128 } | 1128 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 #ifndef NDEBUG | 1228 #ifndef NDEBUG |
1229 void PaintArtifactCompositor::showDebugData() { | 1229 void PaintArtifactCompositor::showDebugData() { |
1230 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) | 1230 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) |
1231 ->toPrettyJSONString() | 1231 ->toPrettyJSONString() |
1232 .utf8() | 1232 .utf8() |
1233 .data(); | 1233 .data(); |
1234 } | 1234 } |
1235 #endif | 1235 #endif |
1236 | 1236 |
1237 } // namespace blink | 1237 } // namespace blink |
OLD | NEW |