Title: [115629] trunk/Source/WebCore
Revision
115629
Author
[email protected]
Date
2012-04-30 07:08:10 -0700 (Mon, 30 Apr 2012)

Log Message

[Texmap] TextureMapperLayer uses intermediate surfaces too eagerly
https://bugs.webkit.org/show_bug.cgi?id=85103

Reviewed by Kenneth Rohde Christiansen.

Instead of automatically using an intermediate surface for layers with opacity and
children, we limit surface usage for layers with more than one child and for layers with
one child and contents of its own.

This prevents us from using intermediate surfaces in cases where a single layer with
opacity has a single descendant with content, in which case normal blending can be used.

Covered by existing compositing layout tests.

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore):
* platform/graphics/texmap/TextureMapperLayer.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (115628 => 115629)


--- trunk/Source/WebCore/ChangeLog	2012-04-30 13:51:18 UTC (rev 115628)
+++ trunk/Source/WebCore/ChangeLog	2012-04-30 14:08:10 UTC (rev 115629)
@@ -1,3 +1,23 @@
+2012-04-30  No'am Rosenthal  <[email protected]>
+
+        [Texmap] TextureMapperLayer uses intermediate surfaces too eagerly
+        https://bugs.webkit.org/show_bug.cgi?id=85103
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Instead of automatically using an intermediate surface for layers with opacity and
+        children, we limit surface usage for layers with more than one child and for layers with
+        one child and contents of its own.
+
+        This prevents us from using intermediate surfaces in cases where a single layer with
+        opacity has a single descendant with content, in which case normal blending can be used.
+
+        Covered by existing compositing layout tests.
+
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore):
+        * platform/graphics/texmap/TextureMapperLayer.h:
+
 2012-04-30  Yi Shen  <[email protected]>
 
         Inserting a paragraph between quoted lines in editing/deleting/delete-4038408-fix.html doesn't work

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (115628 => 115629)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2012-04-30 13:51:18 UTC (rev 115628)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2012-04-30 14:08:10 UTC (rev 115629)
@@ -214,6 +214,23 @@
     return rect;
 }
 
+TextureMapperLayer::ContentsLayerCount TextureMapperLayer::countPotentialLayersWithContents() const
+{
+    int selfLayersWithContents = (m_state.drawsContent ? 1 : 0) + (m_contentsLayer ? 1 : 0);
+    int potentialLayersWithContents = selfLayersWithContents + m_children.size();
+
+    if (!potentialLayersWithContents)
+        return NoLayersWithContent;
+
+    if (potentialLayersWithContents > 1)
+        return MultipleLayersWithContents;
+
+    if (m_children.isEmpty())
+        return SingleLayerWithContents;
+
+    return m_children.first()->countPotentialLayersWithContents();
+}
+
 bool TextureMapperLayer::shouldPaintToIntermediateSurface() const
 {
 #if ENABLE(CSS_FILTERS)
@@ -221,7 +238,7 @@
         return true;
 #endif
     bool hasOpacity = m_opacity < 0.99;
-    bool hasChildren = !m_children.isEmpty();
+    bool canHaveMultipleLayersWithContent = countPotentialLayersWithContents() == MultipleLayersWithContents;
     bool hasReplica = !!m_state.replicaLayer;
     bool hasMask = !!m_state.maskLayer;
 
@@ -231,13 +248,13 @@
 
     // We should use an intermediate surface when blending several items with an ancestor opacity.
     // Tested by compositing/reflections/reflection-opacity.html
-    if (hasOpacity && (hasChildren || hasReplica))
+    if (hasOpacity && (canHaveMultipleLayersWithContent || hasReplica))
         return true;
 
     // We should use an intermediate surface with a masked ancestor.
     // In the case of replicas the mask is applied before replicating.
     // Tested by compositing/masks/masked-ancestor.html
-    if (hasMask && hasChildren && !hasReplica)
+    if (hasMask && canHaveMultipleLayersWithContent && !hasReplica)
         return true;
 
     return false;

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (115628 => 115629)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2012-04-30 13:51:18 UTC (rev 115628)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2012-04-30 14:08:10 UTC (rev 115629)
@@ -156,6 +156,13 @@
 
     void syncAnimations();
     bool isVisible() const;
+    enum ContentsLayerCount {
+        NoLayersWithContent,
+        SingleLayerWithContents,
+        MultipleLayersWithContents
+    };
+
+    ContentsLayerCount countPotentialLayersWithContents() const;
     bool shouldPaintToIntermediateSurface() const;
 
     LayerTransform m_transform;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to