Changeset 85814 in webkit


Ignore:
Timestamp:
May 4, 2011 5:42:19 PM (13 years ago)
Author:
vangelis@chromium.org
Message:

2011-05-04 Vangelis Kokkevis <vangelis@chromium.org>

Reviewed by Kenneth Russell.

[chromium] Adding a new layout test for perpendicular layers.
https://bugs.webkit.org/show_bug.cgi?id=59255

  • platform/chromium-gpu-mac/platform/chromium/compositing/perpendicular-layer-sorting-expected.png: Added.
  • platform/chromium-gpu-mac/platform/chromium/compositing/perpendicular-layer-sorting-expected.txt: Added.
  • platform/chromium/compositing/perpendicular-layer-sorting.html: Added.
  • platform/chromium/test_expectations.txt:

2011-05-04 Vangelis Kokkevis <vangelis@chromium.org>

Reviewed by Kenneth Russell.

[chromium] Improve sorting of layers in hierarchies that preserve-3d
by testing for overlapping regions between layer pairs and doing a
topological sort to determine the right order.
https://bugs.webkit.org/show_bug.cgi?id=59255

Test: platform/chromium/compositing/perpendicular-layer-sorting.html

  • WebCore.gypi:
  • platform/graphics/chromium/LayerRendererChromium.cpp: (WebCore::LayerRendererChromium::updatePropertiesAndRenderSurfaces):
  • platform/graphics/chromium/LayerRendererChromium.h:
  • platform/graphics/chromium/cc/CCLayerImpl.h: (WebCore::CCLayerImpl::clearRenderSurface):
  • platform/graphics/chromium/cc/CCLayerSorter.cpp: Added. (WebCore::perpProduct): (WebCore::innerProduct): (WebCore::pointInColinearEdge): (WebCore::edgeEdgeTest): (WebCore::CCLayerSorter::LayerIntersector::LayerIntersector): (WebCore::CCLayerSorter::LayerIntersector::go): (WebCore::CCLayerSorter::LayerIntersector::edgeTriangleTest): (WebCore::CCLayerSorter::LayerIntersector::triangleTriangleTest): (WebCore::CCLayerSorter::LayerIntersector::checkZDiff): (WebCore::CCLayerSorter::LayerIntersector::layerZFromProjectedPoint): (WebCore::CCLayerSorter::CCLayerSorter): (WebCore::CCLayerSorter::checkOverlap): (WebCore::CCLayerSorter::createGraphNodes): (WebCore::CCLayerSorter::createGraphEdges): (WebCore::CCLayerSorter::removeEdgeFromList): (WebCore::CCLayerSorter::sort):
  • platform/graphics/chromium/cc/CCLayerSorter.h: Added. (WebCore::CCLayerSorter::GraphNode::GraphNode): (WebCore::CCLayerSorter::GraphEdge::GraphEdge):
Location:
trunk
Files:
5 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r85811 r85814  
     12011-05-04  Vangelis Kokkevis  <vangelis@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        [chromium] Adding a new layout test for perpendicular layers.
     6        https://bugs.webkit.org/show_bug.cgi?id=59255
     7
     8        * platform/chromium-gpu-mac/platform/chromium/compositing/perpendicular-layer-sorting-expected.png: Added.
     9        * platform/chromium-gpu-mac/platform/chromium/compositing/perpendicular-layer-sorting-expected.txt: Added.
     10        * platform/chromium/compositing/perpendicular-layer-sorting.html: Added.
     11        * platform/chromium/test_expectations.txt:
     12
    1132011-05-03  Jer Noble  <jer.noble@apple.com>
    214
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r85805 r85814  
    28342834BUGWK58182 GPU : compositing/images/content-image-change.html = PASS FAIL
    28352835BUGWK58398 GPU : platform/chromium/compositing/child-layer-3d-sorting.html = PASS FAIL MISSING
     2836BUGVANGELIS GPU WIN LINUX : platform/chromium/compositing/perpendicular-layer-sorting.html = PASS FAIL MISSING
    28362837
    28372838// The picture does not match the video in the test.
  • trunk/Source/WebCore/ChangeLog

    r85811 r85814  
     12011-05-04  Vangelis Kokkevis  <vangelis@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        [chromium] Improve sorting of layers in hierarchies that preserve-3d
     6        by testing for overlapping regions between layer pairs and doing a
     7        topological sort to determine the right order.
     8        https://bugs.webkit.org/show_bug.cgi?id=59255
     9
     10        Test: platform/chromium/compositing/perpendicular-layer-sorting.html
     11
     12        * WebCore.gypi:
     13        * platform/graphics/chromium/LayerRendererChromium.cpp:
     14        (WebCore::LayerRendererChromium::updatePropertiesAndRenderSurfaces):
     15        * platform/graphics/chromium/LayerRendererChromium.h:
     16        * platform/graphics/chromium/cc/CCLayerImpl.h:
     17        (WebCore::CCLayerImpl::clearRenderSurface):
     18        * platform/graphics/chromium/cc/CCLayerSorter.cpp: Added.
     19        (WebCore::perpProduct):
     20        (WebCore::innerProduct):
     21        (WebCore::pointInColinearEdge):
     22        (WebCore::edgeEdgeTest):
     23        (WebCore::CCLayerSorter::LayerIntersector::LayerIntersector):
     24        (WebCore::CCLayerSorter::LayerIntersector::go):
     25        (WebCore::CCLayerSorter::LayerIntersector::edgeTriangleTest):
     26        (WebCore::CCLayerSorter::LayerIntersector::triangleTriangleTest):
     27        (WebCore::CCLayerSorter::LayerIntersector::checkZDiff):
     28        (WebCore::CCLayerSorter::LayerIntersector::layerZFromProjectedPoint):
     29        (WebCore::CCLayerSorter::CCLayerSorter):
     30        (WebCore::CCLayerSorter::checkOverlap):
     31        (WebCore::CCLayerSorter::createGraphNodes):
     32        (WebCore::CCLayerSorter::createGraphEdges):
     33        (WebCore::CCLayerSorter::removeEdgeFromList):
     34        (WebCore::CCLayerSorter::sort):
     35        * platform/graphics/chromium/cc/CCLayerSorter.h: Added.
     36        (WebCore::CCLayerSorter::GraphNode::GraphNode):
     37        (WebCore::CCLayerSorter::GraphEdge::GraphEdge):
     38
    1392011-05-03  Jer Noble  <jer.noble@apple.com>
    240
  • trunk/Source/WebCore/WebCore.gypi

    r85785 r85814  
    40654065            'platform/graphics/chromium/cc/CCLayerImpl.cpp',
    40664066            'platform/graphics/chromium/cc/CCLayerImpl.h',
     4067            'platform/graphics/chromium/cc/CCLayerSorter.cpp',
     4068            'platform/graphics/chromium/cc/CCLayerSorter.h',
    40674069            'platform/graphics/chromium/cc/CCMainThread.cpp',
    40684070            'platform/graphics/chromium/cc/CCMainThread.h',
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r85261 r85814  
    9494}
    9595
    96 bool LayerRendererChromium::compareLayerZ(const RefPtr<CCLayerImpl>& a, const RefPtr<CCLayerImpl>& b)
    97 {
    98     return a->drawDepth() < b->drawDepth();
    99 }
    100 
    10196PassRefPtr<LayerRendererChromium> LayerRendererChromium::create(PassRefPtr<GraphicsContext3D> context, PassOwnPtr<TilePaintInterface> contentPaint)
    10297{
     
    615610    // 3. The layer uses a mask
    616611    // 4. The layer has a replica (used for reflections)
     612    // 5. The layer doesn't preserve-3d but is the child of a layer which does.
    617613    // If a layer preserves-3d then we don't create a RenderSurface for it to avoid flattening
    618614    // out its children. The opacity value of the children layers is multiplied by the opacity
     
    622618    bool useSurfaceForMasking = drawLayer->maskLayer();
    623619    bool useSurfaceForReflection = drawLayer->replicaLayer();
    624     if (useSurfaceForMasking || useSurfaceForReflection || ((useSurfaceForClipping || useSurfaceForOpacity) && drawLayer->descendantsDrawsContent())) {
     620    bool useSurfaceForFlatDescendants = (drawLayer->superlayer() && drawLayer->superlayer()->preserves3D() && !drawLayer->preserves3D() && drawLayer->descendantsDrawsContent());
     621    if (useSurfaceForMasking || useSurfaceForReflection || useSurfaceForFlatDescendants || ((useSurfaceForClipping || useSurfaceForOpacity) && drawLayer->descendantsDrawsContent())) {
    625622        RenderSurfaceChromium* renderSurface = drawLayer->renderSurface();
    626623        if (!renderSurface)
     
    728725    // M[s] = M * Tr[-center]
    729726    sublayerMatrix.translate3d(-bounds.width() * 0.5, -bounds.height() * 0.5, 0);
    730 
    731     // Compute the depth value of the center of the layer which will be used when
    732     // sorting the layers for the preserves-3d property.
    733     const TransformationMatrix& layerDrawMatrix = drawLayer->renderSurface() ? drawLayer->renderSurface()->m_drawTransform : drawLayer->drawTransform();
    734     if (drawLayer->superlayer()) {
    735         if (!drawLayer->superlayer()->preserves3D())
    736             drawLayer->setDrawDepth(drawLayer->superlayer()->drawDepth());
    737         else
    738             drawLayer->setDrawDepth(layerDrawMatrix.m43());
    739     } else
    740         drawLayer->setDrawDepth(0);
    741727
    742728    LayerList& descendants = (drawLayer->renderSurface() ? drawLayer->renderSurface()->m_layerList : layerList);
     
    811797    }
    812798
    813     // If preserves-3d then sort all the descendants by the Z coordinate of their
    814     // center. If the preserves-3d property is also set on the superlayer then
     799    // If preserves-3d then sort all the descendants in 3D so that they can be
     800    // drawn from back to front. If the preserves-3d property is also set on the superlayer then
    815801    // skip the sorting as the superlayer will sort all the descendants anyway.
    816802    if (drawLayer->preserves3D() && (!drawLayer->superlayer() || !drawLayer->superlayer()->preserves3D()))
    817         std::stable_sort(&descendants.at(thisLayerIndex), descendants.end(), compareLayerZ);
     803        m_layerSorter.sort(&descendants.at(thisLayerIndex), descendants.end());
    818804}
    819805
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h

    r85136 r85814  
    4444#include "cc/CCCanvasLayerImpl.h"
    4545#include "cc/CCHeadsUpDisplay.h"
     46#include "cc/CCLayerSorter.h"
    4647#include "cc/CCPluginLayerImpl.h"
    4748#include "cc/CCVideoLayerImpl.h"
     
    235236
    236237    RenderSurfaceChromium* m_defaultRenderSurface;
     238
     239    CCLayerSorter m_layerSorter;
    237240};
    238241
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h

    r84582 r85814  
    117117    RenderSurfaceChromium* renderSurface() const { return m_renderSurface.get(); }
    118118    void clearRenderSurface() { m_renderSurface.clear(); }
    119     float drawDepth() const { return m_drawDepth; }
    120     void setDrawDepth(float depth) { m_drawDepth = depth; }
    121119    float drawOpacity() const { return m_drawOpacity; }
    122120    void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
Note: See TracChangeset for help on using the changeset viewer.