Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp |
| index 83cf5e45e90c8d5f3da455493a94a93311c6a8d0..121f0009d0ec6eb8cde0fa83bcb1e970ed92fe44 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp |
| @@ -499,12 +499,30 @@ void PaintArtifactCompositor::LayerizeGroup( |
| // due to copying the chunk list. Subtotal: O((qd + p)d) = O(qd^2 + pd) |
| // Assuming p > d, the total complexity would be O(pqd + qd^2 + pd) = O(pqd) |
| while (chunk_it != paint_artifact.PaintChunks().end()) { |
| - // Look at the effect node of the next chunk. There are 3 possible cases: |
| + // Look at the effect node of the next chunk. If the chunk has |
| + // effectively-invisible opacity we skip it. Otherwise, there are 3 possible |
| + // cases: |
| // A. The next chunk belongs to the current group but no subgroup. |
| // B. The next chunk does not belong to the current group. |
| // C. The next chunk belongs to some subgroup of the current group. |
| const EffectPaintPropertyNode* chunk_effect = |
| chunk_it->properties.property_tree_state.Effect(); |
| + |
| + // TODO(wkorman): Do we need to check blend mode, mask, or filter to skip |
|
wkorman
2017/04/24 19:49:38
Seeking your thought on this comment as I haven't
|
| + // only when appropriate? See also PaintLayer::IsTransparent() which was |
| + // previously incorporated via PaintLayer::PaintsWithTransparency(). |
| + |
| + // Skip paint chunks that are effectively invisible due to opacity. The |
| + // lower bound of visibility is considered to be 0.0004f < 1/2048. With |
| + // 10-bit color channels (only available on the newest Macs as of 2016; |
| + // otherwise it's 8-bit), we see that an alpha of 1/2048 or less leads to a |
| + // color output of less than 0.5 in all channels, hence not visible. |
| + static const float kMinimumVisibleOpacity = 0.0004f; |
| + if (chunk_effect->Opacity() < kMinimumVisibleOpacity) { |
| + chunk_it++; |
| + continue; |
| + } |
| + |
| if (chunk_effect == ¤t_group) { |
| // Case A: The next chunk belongs to the current group but no subgroup. |
| bool is_foreign = |