Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1016)

Unified Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp

Issue 2833883003: Skip paint chunks with effectively invisible opacity. (Closed)
Patch Set: Tweak comment. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 == &current_group) {
// Case A: The next chunk belongs to the current group but no subgroup.
bool is_foreign =

Powered by Google App Engine
This is Rietveld 408576698