Changeset 104728 in webkit


Ignore:
Timestamp:
Jan 11, 2012 11:49:40 AM (12 years ago)
Author:
noam.rosenthal@nokia.com
Message:

[Qt][Texmap] LayoutTests/compositing/masks/masked-ancestor does not render correctly.
https://bugs.webkit.org/show_bug.cgi?id=75910

Reviewed by Simon Hausmann.

Handle the mask surface correctly when drawing in two passes. Also, improve the readability
of the code that decides whether to draw in two passes.

LayoutTests/compositing/masks/masked-ancestor.html tests this.

  • platform/graphics/texmap/TextureMapperNode.cpp:

(WebCore::TextureMapperNode::computeAllTransforms):
(WebCore::TextureMapperNode::hasMoreThanOneTile):
(WebCore::TextureMapperNode::paintRecursive):

  • platform/graphics/texmap/TextureMapperNode.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r104726 r104728  
     12012-01-11  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        [Qt][Texmap] LayoutTests/compositing/masks/masked-ancestor does not render correctly.
     4        https://bugs.webkit.org/show_bug.cgi?id=75910
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Handle the mask surface correctly when drawing in two passes. Also, improve the readability
     9        of the code that decides whether to draw in two passes.
     10
     11        LayoutTests/compositing/masks/masked-ancestor.html tests this.
     12
     13        * platform/graphics/texmap/TextureMapperNode.cpp:
     14        (WebCore::TextureMapperNode::computeAllTransforms):
     15        (WebCore::TextureMapperNode::hasMoreThanOneTile):
     16        (WebCore::TextureMapperNode::paintRecursive):
     17        * platform/graphics/texmap/TextureMapperNode.h:
     18
    1192012-01-11  Dmitry Titov  <dimich@chromium.org>
    220
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp

    r104447 r104728  
    113113    computePerspectiveTransformIfNeeded();
    114114
    115     m_transforms.target = TransformationMatrix(m_parent ? m_parent->m_transforms.forDescendants : TransformationMatrix()).multiply(m_transforms.local);
     115    TextureMapperNode* parent = m_parent ? m_parent : m_effectTarget;
     116    m_transforms.target = TransformationMatrix(parent ? parent->m_transforms.forDescendants : TransformationMatrix()).multiply(m_transforms.local);
    116117
    117118    m_state.visible = m_state.backfaceVisibility || m_transforms.target.inverse().m33() >= 0;
     
    120121
    121122    // This transform is only applied if using a two-pass for the replica, because the transform needs to be adjusted to the size of the intermediate surface, insteaf of the size of the content layer.
    122     if (m_parent && m_parent->m_state.preserves3D)
     123    if (parent && parent->m_state.preserves3D)
    123124        m_transforms.centerZ = m_transforms.target.mapPoint(FloatPoint3D(m_size.width() / 2, m_size.height() / 2, 0)).z();
    124125
     
    248249}
    249250#endif
     251
     252bool TextureMapperNode::hasMoreThanOneTile() const
     253{
     254    int tiles = 0;
     255
     256#if USE(TILED_BACKING_STORE)
     257    if (m_state.tileOwnership == ExternallyManagedTiles) {
     258        HashMap<int, ExternallyManagedTile>::const_iterator end = m_externallyManagedTiles.end();
     259        for (HashMap<int, ExternallyManagedTile>::const_iterator it = m_externallyManagedTiles.begin(); it != end; ++it) {
     260            if (it->second.frontBuffer.texture) {
     261                if (++tiles > 1)
     262                    return true;
     263            }
     264        }
     265
     266        return false;
     267    }
     268#endif
     269
     270    for (size_t i = 0; i < m_ownedTiles.size(); ++i) {
     271        if (m_ownedTiles[i].texture) {
     272            if (++tiles > 1)
     273                return true;
     274        }
     275    }
     276
     277    return false;
     278}
     279
    250280
    251281void TextureMapperNode::renderContent(TextureMapper* textureMapper, GraphicsLayer* layer)
     
    516546    options.opacity *= m_opacity;
    517547    RefPtr<BitmapTexture> surface;
    518     const bool needsTwoPass = ((m_state.replicaLayer || m_state.maskLayer) && !m_children.isEmpty()) || (m_opacity < 0.99 && m_state.mightHaveOverlaps) || (m_opacity < 0.99 && m_state.replicaLayer);
     548
     549    bool hasReplica = m_state.replicaLayer;
     550    bool hasMask = m_state.maskLayer;
     551    bool needsBlending = m_opacity < 0.99 || hasMask;
     552    bool paintsMoreThanOneTexture = !m_children.isEmpty() || hasMoreThanOneTile() || (hasMask && m_state.maskLayer->hasMoreThanOneTile());
     553    bool hasOverlaps = m_state.mightHaveOverlaps || hasReplica;
    519554    const IntSize viewportSize = options.textureMapper->viewportSize();
     555    bool needsTwoPass = ((hasReplica || hasMask) && paintsMoreThanOneTexture) || (needsBlending && hasOverlaps);
    520556    options.isSurface = false;
    521557
     
    531567    RefPtr<BitmapTexture> maskSurface;
    532568
    533     // The mask has to be adjusted to target coordinates.
    534569    if (m_state.maskLayer) {
    535570        maskSurface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize());
    536571        options.textureMapper->bindSurface(maskSurface.get());
    537         options.textureMapper->drawTexture(*m_state.maskLayer->texture(), entireRect(), m_transforms.target, 1.0, 0);
     572        TextureMapperPaintOptions optionsForMask(options);
     573        optionsForMask.isSurface = true;
     574        m_state.maskLayer->paintSelf(optionsForMask);
    538575    }
    539576
     
    548585    if (!paintReflection(options, surface.get())) {
    549586        options.textureMapper->bindSurface(options.surface);
    550         options.textureMapper->drawTexture(*surface.get(), viewportRect, TransformationMatrix(), options.opacity, 0);
     587        options.textureMapper->drawTexture(*surface.get(), viewportRect, TransformationMatrix(), options.opacity, maskSurface.get());
    551588    }
    552589
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h

    r104447 r104728  
    207207    bool hasOpacityAnimation() const;
    208208    bool hasTransformAnimation() const;
    209 
     209    bool hasMoreThanOneTile() const;
    210210    struct TransformData {
    211211        TransformationMatrix target;
Note: See TracChangeset for help on using the changeset viewer.