Changeset 105467 in webkit


Ignore:
Timestamp:
Jan 19, 2012 5:34:24 PM (12 years ago)
Author:
noam.rosenthal@nokia.com
Message:

[Texmap] TextureMapper creates two many big intermediate surfaces
https://bugs.webkit.org/show_bug.cgi?id=76336

Reviewed by Simon Hausmann.

The following has been done to optimize surface allocation:

  1. Instead of using a viewport-size surface, use a surface in the size of the layer's bounding rect and apply the transform after the content has been rendered into it.
  2. Avoid generating intermediate surface for occasions where they're not necessary, such as nested reflections without opacity.
  3. Releasing of textures from the pool is now implicit, based on refCount.
  4. Do not use intermediate surfaces for preserve-3d layers. This is in alignment with other ports.

Tests in LayoutTests/compositing/masks and LayoutTests/compositing/reflection cover this.

  • platform/graphics/texmap/TextureMapper.cpp:

(WebCore::TextureMapper::acquireTextureFromPool):

  • platform/graphics/texmap/TextureMapper.h:
  • platform/graphics/texmap/TextureMapperNode.cpp:

(WebCore::TextureMapperNode::paintSelf):
(WebCore::TextureMapperNode::paintSelfAndChildren):
(WebCore::TextureMapperNode::intermediateSurfaceRect):
(WebCore::TextureMapperNode::shouldPaintToIntermediateSurface):
(WebCore::TextureMapperNode::isVisible):
(WebCore::TextureMapperNode::paintSelfAndChildrenWithReplica):
(WebCore::TextureMapperNode::paintRecursive):
(WebCore::TextureMapperNode::syncCompositingStateSelf):
(WebCore::TextureMapperNode::syncCompositingState):

  • platform/graphics/texmap/TextureMapperNode.h:

(WebCore::TextureMapperPaintOptions::TextureMapperPaintOptions):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r105463 r105467  
     12012-01-19  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        [Texmap] TextureMapper creates two many big intermediate surfaces
     4        https://bugs.webkit.org/show_bug.cgi?id=76336
     5
     6        Reviewed by Simon Hausmann.
     7
     8        The following has been done to optimize surface allocation:
     9        1. Instead of using a viewport-size surface, use a surface in the size of the layer's
     10           bounding rect and apply the transform after the content has been rendered into it.
     11        2. Avoid generating intermediate surface for occasions where they're not necessary,
     12           such as nested reflections without opacity.
     13        3. Releasing of textures from the pool is now implicit, based on refCount.
     14        4. Do not use intermediate surfaces for preserve-3d layers. This is in alignment with
     15           other ports.
     16
     17        Tests in LayoutTests/compositing/masks and LayoutTests/compositing/reflection cover this.
     18
     19        * platform/graphics/texmap/TextureMapper.cpp:
     20        (WebCore::TextureMapper::acquireTextureFromPool):
     21        * platform/graphics/texmap/TextureMapper.h:
     22        * platform/graphics/texmap/TextureMapperNode.cpp:
     23        (WebCore::TextureMapperNode::paintSelf):
     24        (WebCore::TextureMapperNode::paintSelfAndChildren):
     25        (WebCore::TextureMapperNode::intermediateSurfaceRect):
     26        (WebCore::TextureMapperNode::shouldPaintToIntermediateSurface):
     27        (WebCore::TextureMapperNode::isVisible):
     28        (WebCore::TextureMapperNode::paintSelfAndChildrenWithReplica):
     29        (WebCore::TextureMapperNode::paintRecursive):
     30        (WebCore::TextureMapperNode::syncCompositingStateSelf):
     31        (WebCore::TextureMapperNode::syncCompositingState):
     32        * platform/graphics/texmap/TextureMapperNode.h:
     33        (WebCore::TextureMapperPaintOptions::TextureMapperPaintOptions):
     34
    1352012-01-19  Eric Seidel  <eric@webkit.org>
    236
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp

    r104447 r105467  
    2727PassRefPtr<BitmapTexture> TextureMapper::acquireTextureFromPool(const IntSize& size)
    2828{
    29     if (m_texturePool.isEmpty()) {
    30         RefPtr<BitmapTexture> selectedTexture = createTexture();
    31         selectedTexture->reset(size, false);
    32         selectedTexture->lock();
    33         return selectedTexture;
    34     }
     29    RefPtr<BitmapTexture> selectedTexture;
    3530
    36     size_t index = 0;
    37     RefPtr<BitmapTexture> selectedTexture = m_texturePool[0];
     31    for (size_t i = 0; i < m_texturePool.size(); ++i) {
     32        RefPtr<BitmapTexture>& texture = m_texturePool[i];
    3833
    39     for (size_t i = 1; i < m_texturePool.size(); ++i) {
    40         RefPtr<BitmapTexture> texture = m_texturePool[i];
     34        // If the surface has only one reference (the one in m_texturePool), we can safely reuse it.
     35        if (texture->refCount() > 1)
     36            continue;
     37
     38        // We default to the first available texture.
     39        if (!selectedTexture) {
     40            selectedTexture = texture;
     41            continue;
     42        }
    4143
    4244        IntSize textureSize = texture->size();
     
    5961
    6062        selectedTexture = texture;
    61         index = i;
    6263    }
    6364
    64     m_texturePool.remove(index);
     65    if (!selectedTexture) {
     66        selectedTexture = createTexture();
     67        m_texturePool.append(selectedTexture);
     68    }
     69
    6570    selectedTexture->reset(size, false);
    66     selectedTexture->lock();
    6771    return selectedTexture;
    68 }
    69 
    70 void TextureMapper::releaseTextureToPool(BitmapTexture* texture)
    71 {
    72     if (!texture)
    73         return;
    74     m_texturePool.append(texture);
    75     texture->unlock();
    7672}
    7773
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h

    r104447 r105467  
    127127    virtual void endPainting() { }
    128128
    129     virtual void releaseTextureToPool(BitmapTexture* surface);
     129    // A surface is released implicitly when dereferenced.
    130130    virtual PassRefPtr<BitmapTexture> acquireTextureFromPool(const IntSize&);
    131131
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp

    r105413 r105467  
    4949{
    5050    m_transform.setLocalTransform(matrix);
    51 }
    52 
    53 int TextureMapperNode::countDescendantsWithContent() const
    54 {
    55     if (!m_state.visible || (!m_size.width() && !m_size.height() && m_state.masksToBounds))
    56         return 0;
    57     int count = (m_size.width() && m_size.height() && (m_state.drawsContent || m_currentContent.contentType != HTMLContentType)) ? 1 : 0;
    58     for (size_t i = 0; i < m_children.size(); ++i)
    59         count += m_children[i]->countDescendantsWithContent();
    60 
    61     return count;
    62 }
    63 
    64 void TextureMapperNode::computeOverlapsIfNeeded()
    65 {
    66     m_state.mightHaveOverlaps = countDescendantsWithContent() > 1;
    6751}
    6852
     
    156140    for (size_t i = 0; i < tilesToRemove.size() && m_ownedTiles.size() > TileEraseThreshold; ++i)
    157141        m_ownedTiles.remove(tilesToRemove[i]);
    158 }
    159 
    160 bool TextureMapperNode::hasMoreThanOneTile() const
    161 {
    162     int tiles = 0;
    163 
    164 #if USE(TILED_BACKING_STORE)
    165     if (m_state.tileOwnership == ExternallyManagedTiles) {
    166         HashMap<int, ExternallyManagedTile>::const_iterator end = m_externallyManagedTiles.end();
    167         for (HashMap<int, ExternallyManagedTile>::const_iterator it = m_externallyManagedTiles.begin(); it != end; ++it) {
    168             if (it->second.frontBuffer.texture) {
    169                 if (++tiles > 1)
    170                     return true;
    171             }
    172         }
    173 
    174         return false;
    175     }
    176 #endif
    177 
    178     for (size_t i = 0; i < m_ownedTiles.size(); ++i) {
    179         if (m_ownedTiles[i].texture) {
    180             if (++tiles > 1)
    181                 return true;
    182         }
    183     }
    184 
    185     return false;
    186142}
    187143
     
    272228        return;
    273229
    274     RefPtr<BitmapTexture> maskTexture;
    275     RefPtr<BitmapTexture> replicaMaskTexture;
    276 
    277     if (m_state.maskLayer)
    278         maskTexture = m_state.maskLayer->texture();
    279     if (m_state.replicaLayer && m_state.replicaLayer->m_state.maskLayer)
    280         replicaMaskTexture = m_state.replicaLayer->m_state.maskLayer->texture();
    281 
    282     float opacity = options.isSurface ? 1 : options.opacity;
     230    float opacity = options.opacity;
     231    BitmapTexture* mask = options.mask;
    283232    FloatRect targetRect = this->targetRect();
     233
     234    // We apply the following transform to compensate for painting into a surface, and then apply the offset so that the painting fits in the target rect.
     235    TransformationMatrix transform =
     236            TransformationMatrix(options.transform)
     237            .multiply(m_transform.combined())
     238            .translate(options.offset.width(), options.offset.height());
    284239
    285240#if USE(TILED_BACKING_STORE)
     
    304259        }
    305260
    306         TransformationMatrix replicaMatrix;
    307261        for (int i = 0; i < tiles.size(); ++i) {
    308262            ExternallyManagedTile& tile = *tiles[i];
    309263            FloatRect rect = tile.frontBuffer.targetRect;
    310 
    311             float replicaOpacity = 1.0;
    312             if (m_state.replicaLayer) {
    313                 replicaMatrix = m_state.replicaLayer->m_transform.combined().scale(1.0 / tile.scale);
    314                 replicaOpacity = opacity * m_state.replicaLayer->m_opacity;
    315             }
    316264            BitmapTexture& texture = *tile.frontBuffer.texture;
    317             if (m_state.replicaLayer)
    318                 options.textureMapper->drawTexture(texture, rect, replicaMatrix, replicaOpacity, replicaMaskTexture ? replicaMaskTexture.get() : maskTexture.get());
    319             options.textureMapper->drawTexture(texture, rect, m_transform.combined(), opacity, options.isSurface ? 0 : maskTexture.get());
     265            options.textureMapper->drawTexture(texture, rect, transform, opacity, mask);
    320266        }
    321267        return;
     
    326272    for (size_t i = 0; i < m_ownedTiles.size(); ++i) {
    327273        BitmapTexture* texture = m_ownedTiles[i].texture.get();
    328         if (m_state.replicaLayer && !options.isSurface) {
    329             options.textureMapper->drawTexture(*texture, targetRectForTileRect(targetRect, m_ownedTiles[i].rect),
    330                              m_state.replicaLayer->m_transform.combined(),
    331                              opacity * m_state.replicaLayer->m_opacity,
    332                              replicaMaskTexture ? replicaMaskTexture.get() : maskTexture.get());
    333         }
    334 
    335274        const FloatRect rect = targetRectForTileRect(targetRect, m_ownedTiles[i].rect);
    336         options.textureMapper->drawTexture(*texture, rect, m_transform.combined(), opacity, options.isSurface ? 0 : maskTexture.get());
    337     }
    338 
    339     if (m_currentContent.contentType == MediaContentType && m_currentContent.media) {
    340         if (m_state.replicaLayer && !options.isSurface)
    341             m_currentContent.media->paintToTextureMapper(options.textureMapper, targetRect,
    342                                                          m_state.replicaLayer->m_transform.combined(),
    343                                                          opacity * m_state.replicaLayer->m_opacity,
    344                                                          replicaMaskTexture ? replicaMaskTexture.get() : maskTexture.get());
    345         m_currentContent.media->paintToTextureMapper(options.textureMapper, targetRect, m_transform.combined(), opacity, options.isSurface ? 0 : maskTexture.get());
    346     }
     275        options.textureMapper->drawTexture(*texture, rect, transform, opacity, mask);
     276    }
     277
     278    if (m_currentContent.contentType == MediaContentType && m_currentContent.media)
     279        m_currentContent.media->paintToTextureMapper(options.textureMapper, targetRect, transform, opacity, mask);
    347280}
    348281
     
    359292}
    360293
    361 void TextureMapperNode::paintSelfAndChildren(const TextureMapperPaintOptions& options, TextureMapperPaintOptions& optionsForDescendants)
     294void TextureMapperNode::paintSelfAndChildren(const TextureMapperPaintOptions& options)
    362295{
    363296    bool hasClip = m_state.masksToBounds && !m_children.isEmpty();
    364297    if (hasClip)
    365         options.textureMapper->beginClip(m_transform.combined(), FloatRect(0, 0, m_size.width(), m_size.height()));
     298        options.textureMapper->beginClip(TransformationMatrix(options.transform).multiply(m_transform.combined()), FloatRect(0, 0, m_size.width(), m_size.height()));
    366299
    367300    paintSelf(options);
    368301
    369302    for (int i = 0; i < m_children.size(); ++i)
    370         m_children[i]->paintRecursive(optionsForDescendants);
     303        m_children[i]->paintRecursive(options);
    371304
    372305    if (hasClip)
     
    374307}
    375308
    376 bool TextureMapperNode::paintReflection(const TextureMapperPaintOptions& options, BitmapTexture* contentSurface)
    377 {
    378     if (!m_state.replicaLayer)
     309IntRect TextureMapperNode::intermediateSurfaceRect()
     310{
     311    // FIXME: Add an inverse transform to LayerTransform.
     312    return intermediateSurfaceRect(m_transform.combined().inverse());
     313}
     314
     315IntRect TextureMapperNode::intermediateSurfaceRect(const TransformationMatrix& matrix)
     316{
     317    IntRect rect;
     318    TransformationMatrix localTransform = TransformationMatrix(matrix).multiply(m_transform.combined());
     319    rect = enclosingIntRect(localTransform.mapRect(entireRect()));
     320    if (!m_state.masksToBounds && !m_state.maskLayer) {
     321        for (int i = 0; i < m_children.size(); ++i)
     322            rect.unite(m_children[i]->intermediateSurfaceRect(matrix));
     323    }
     324
     325    if (m_state.replicaLayer)
     326        rect.unite(m_state.replicaLayer->intermediateSurfaceRect(matrix));
     327
     328    return rect;
     329}
     330
     331bool TextureMapperNode::shouldPaintToIntermediateSurface() const
     332{
     333    bool hasOpacity = m_opacity < 0.99;
     334    bool hasChildren = !m_children.isEmpty();
     335    bool hasReplica = !!m_state.replicaLayer;
     336    bool hasMask = !!m_state.maskLayer;
     337
     338    // We don't use two-pass blending for preserves-3d, that's in sync with Safari.
     339    if (m_state.preserves3D)
    379340        return false;
    380341
    381     RefPtr<BitmapTexture> surface(contentSurface);
    382     RefPtr<BitmapTexture> maskSurface;
    383     RefPtr<BitmapTexture> replicaMaskSurface;
    384     RefPtr<BitmapTexture> replicaMaskTexture;
    385 
    386     if (TextureMapperNode* replicaMask = m_state.replicaLayer->m_state.maskLayer)
    387         replicaMaskTexture = replicaMask->texture();
    388 
    389     RefPtr<BitmapTexture> maskTexture;
    390     if (TextureMapperNode* mask = m_state.maskLayer)
    391         maskTexture = mask->texture();
    392 
    393     const IntSize viewportSize = options.textureMapper->viewportSize();
    394     const bool useIntermediateBufferForReplica = m_state.replicaLayer && options.opacity < 0.99;
    395     const bool useIntermediateBufferForMask = maskTexture && replicaMaskTexture;
    396     const FloatRect viewportRect(0, 0, viewportSize.width(), viewportSize.height());
    397     // Reverse this layer's transform on the replica's transform and use it with the contents
    398     // intermediate surface, applied in the viewport coordinate system.
    399     TransformationMatrix replicaMatrix = m_state.replicaLayer->m_transform.combined();
    400     replicaMatrix.multiply(m_transform.combined().inverse());
    401 
    402     // The mask has to be adjusted to target coordinates.
    403     if (maskTexture) {
    404         maskSurface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize());
    405         options.textureMapper->bindSurface(maskSurface.get());
    406         options.textureMapper->drawTexture(*maskTexture.get(), entireRect(), m_transform.combined(), 1, 0);
    407         maskTexture = maskSurface;
    408     }
    409 
    410     // The replica's mask has to be adjusted to target coordinates.
    411     if (replicaMaskTexture) {
    412         replicaMaskSurface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize());
    413         options.textureMapper->bindSurface(replicaMaskSurface.get());
    414         options.textureMapper->drawTexture(*replicaMaskTexture.get(), entireRect(), m_transform.combined(), 1, 0);
    415         replicaMaskTexture = replicaMaskSurface;
    416     }
    417 
    418     // We might need to apply the mask of the content layer before we draw the reflection, as there might be yet another mask for the reflection itself.
    419     if (useIntermediateBufferForMask) {
    420         RefPtr<BitmapTexture> maskSurface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize());
    421         options.textureMapper->bindSurface(maskSurface.get());
    422         options.textureMapper->drawTexture(*surface.get(), viewportRect, TransformationMatrix(), 1, maskTexture.get());
    423         options.textureMapper->releaseTextureToPool(surface.get());
    424         surface = maskSurface;
    425         maskTexture.clear();
    426     }
    427 
    428     // We blend the layer and its replica in an intermediate buffer before blending into the target surface.
    429     if (useIntermediateBufferForReplica) {
    430         RefPtr<BitmapTexture> replicaSurface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize());
    431         options.textureMapper->bindSurface(replicaSurface.get());
    432         options.textureMapper->drawTexture(*surface.get(), viewportRect, replicaMatrix, m_state.replicaLayer->m_opacity, replicaMaskTexture.get());
    433         options.textureMapper->drawTexture(*surface.get(), viewportRect, TransformationMatrix(), 1, maskTexture.get());
    434         options.textureMapper->releaseTextureToPool(surface.get());
    435         surface = replicaSurface;
    436     }
     342    // We should use an intermediate surface when blending several items with an ancestor opacity.
     343    // Tested by compositing/reflections/reflection-opacity.html
     344    if (hasOpacity && (hasChildren || hasReplica))
     345        return true;
     346
     347    // We should use an intermediate surface with a masked ancestor.
     348    // In the case of replicas the mask is applied before replicating.
     349    // Tested by compositing/masks/masked-ancestor.html
     350    if (hasMask && hasChildren && !hasReplica)
     351        return true;
     352
     353    return false;
     354}
     355
     356bool TextureMapperNode::isVisible() const
     357{
     358    if (m_size.isEmpty() && (m_state.masksToBounds || m_state.maskLayer || m_children.isEmpty()))
     359        return false;
     360    if (!m_state.visible || m_opacity < 0.01)
     361        return false;
     362    return true;
     363}
     364
     365void TextureMapperNode::paintSelfAndChildrenWithReplica(const TextureMapperPaintOptions& options)
     366{
     367    if (m_state.replicaLayer) {
     368        TextureMapperPaintOptions replicaOptions(options);
     369        // We choose either the content's mask or the replica's mask.
     370        // FIXME: blend the two if both exist.
     371        if (m_state.replicaLayer->m_state.maskLayer)
     372            replicaOptions.mask = m_state.replicaLayer->m_state.maskLayer->texture();
     373
     374        replicaOptions.transform
     375                  .multiply(m_state.replicaLayer->m_transform.combined())
     376                  .multiply(m_transform.combined().inverse());
     377        paintSelfAndChildren(replicaOptions);
     378    }
     379
     380    paintSelfAndChildren(options);
     381}
     382
     383void TextureMapperNode::paintRecursive(const TextureMapperPaintOptions& options)
     384{
     385    if (!isVisible())
     386        return;
     387
     388    float opacity = options.opacity * m_opacity;
     389    RefPtr<BitmapTexture> maskTexture = m_state.maskLayer ? m_state.maskLayer->texture() : 0;
     390
     391    TextureMapperPaintOptions paintOptions(options);
     392    paintOptions.mask = maskTexture.get();
     393    IntRect surfaceRect;
     394
     395    RefPtr<BitmapTexture> surface;
     396
     397    if (!shouldPaintToIntermediateSurface()) {
     398        paintOptions.opacity = opacity;
     399        paintSelfAndChildrenWithReplica(paintOptions);
     400        return;
     401    }
     402
     403    // Prepare a surface to paint into.
     404    // We paint into the surface ignoring the opacity/transform of the current layer.
     405    surfaceRect = intermediateSurfaceRect();
     406    surface = options.textureMapper->acquireTextureFromPool(surfaceRect.size());
     407    options.textureMapper->bindSurface(surface.get());
     408    paintOptions.opacity = 1;
     409
     410    // We have to use combinedForChildren() and not combined(), otherwise preserve-3D doesn't work.
     411    paintOptions.transform = m_transform.combinedForChildren().inverse();
     412    paintOptions.offset = -IntSize(surfaceRect.x(), surfaceRect.y());
     413
     414    paintSelfAndChildrenWithReplica(paintOptions);
     415
     416    // If we painted the replica, the mask is already applied so we don't need to paint it again.
     417    if (m_state.replicaLayer)
     418        maskTexture = 0;
    437419
    438420    options.textureMapper->bindSurface(options.surface);
    439 
    440     // Draw the reflection.
    441     if (!useIntermediateBufferForReplica)
    442         options.textureMapper->drawTexture(*surface.get(), viewportRect, replicaMatrix, m_state.replicaLayer->m_opacity, replicaMaskTexture.get());
    443 
    444     // Draw the original.
    445     options.textureMapper->drawTexture(*surface.get(), viewportRect, TransformationMatrix(), options.opacity, maskTexture.get());
    446 
    447     options.textureMapper->releaseTextureToPool(maskSurface.get());
    448     options.textureMapper->releaseTextureToPool(replicaMaskSurface.get());
    449 
    450     return true;
    451 }
    452 
    453 void TextureMapperNode::paintRecursive(TextureMapperPaintOptions options)
    454 {
    455     if ((m_size.isEmpty() && (m_state.masksToBounds
    456         || m_children.isEmpty())) || !m_state.visible || options.opacity < 0.01 || m_opacity < 0.01)
    457         return;
    458 
    459     options.opacity *= m_opacity;
    460     RefPtr<BitmapTexture> surface;
    461 
    462     bool hasReplica = m_state.replicaLayer;
    463     bool hasMask = m_state.maskLayer;
    464     bool needsBlending = m_opacity < 0.99 || hasMask;
    465     bool paintsMoreThanOneTexture = !m_children.isEmpty() || hasMoreThanOneTile() || (hasMask && m_state.maskLayer->hasMoreThanOneTile());
    466     bool hasOverlaps = m_state.mightHaveOverlaps || hasReplica;
    467     const IntSize viewportSize = options.textureMapper->viewportSize();
    468     bool needsTwoPass = ((hasReplica || hasMask) && paintsMoreThanOneTexture) || (needsBlending && hasOverlaps);
    469     options.isSurface = false;
    470 
    471     TextureMapperPaintOptions optionsForDescendants(options);
    472 
    473     if (!needsTwoPass) {
    474         paintSelfAndChildren(options, optionsForDescendants);
    475         return;
    476     }
    477 
    478     FloatRect viewportRect(0, 0, viewportSize.width(), viewportSize.height());
    479 
    480     RefPtr<BitmapTexture> maskSurface;
    481 
    482     if (m_state.maskLayer) {
    483         maskSurface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize());
    484         options.textureMapper->bindSurface(maskSurface.get());
    485         TextureMapperPaintOptions optionsForMask(options);
    486         optionsForMask.isSurface = true;
    487         m_state.maskLayer->paintSelf(optionsForMask);
    488     }
    489 
    490     surface = options.textureMapper->acquireTextureFromPool(options.textureMapper->viewportSize());
    491     optionsForDescendants.surface = surface.get();
    492     options.isSurface = true;
    493     optionsForDescendants.opacity = 1;
    494     options.textureMapper->bindSurface(surface.get());
    495 
    496     paintSelfAndChildren(options, optionsForDescendants);
    497 
    498     if (!paintReflection(options, surface.get())) {
    499         options.textureMapper->bindSurface(options.surface);
    500         options.textureMapper->drawTexture(*surface.get(), viewportRect, TransformationMatrix(), options.opacity, maskSurface.get());
    501     }
    502 
    503     options.textureMapper->releaseTextureToPool(surface.get());
    504     options.textureMapper->releaseTextureToPool(maskSurface.get());
     421    TransformationMatrix targetTransform =
     422            TransformationMatrix(options.transform)
     423                .multiply(m_transform.combined())
     424                .translate(options.offset.width(), options.offset.height());
     425    options.textureMapper->drawTexture(*surface.get(), surfaceRect, targetTransform, opacity, maskTexture.get());
    505426}
    506427
     
    686607    m_state.childrenTransform = graphicsLayer->childrenTransform();
    687608    m_state.opacity = graphicsLayer->opacity();
     609
    688610    m_currentContent.contentType = pendingContent.contentType;
    689611    m_currentContent.image = pendingContent.image;
     
    937859
    938860    computeTiles();
    939     computeOverlapsIfNeeded();
    940861
    941862    if (graphicsLayer)
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h

    r105413 r105467  
    4545public:
    4646    BitmapTexture* surface;
     47    BitmapTexture* mask;
     48    float opacity;
     49    TransformationMatrix transform;
     50    IntSize offset;
    4751    TextureMapper* textureMapper;
    48 
    49     float opacity;
    50     bool isSurface;
    5152    TextureMapperPaintOptions()
    5253        : surface(0)
     54        , mask(0)
     55        , opacity(1)
    5356        , textureMapper(0)
    54         , opacity(1)
    55         , isSurface(false)
    5657    { }
    5758};
     
    179180    void computeOverlapsIfNeeded();
    180181    void computeTiles();
     182    IntRect intermediateSurfaceRect(const TransformationMatrix&);
     183    IntRect intermediateSurfaceRect();
    181184    void swapContentsBuffers();
    182     int countDescendantsWithContent() const;
    183185    FloatRect targetRectForTileRect(const FloatRect& totalTargetRect, const FloatRect& tileRect) const;
    184186    void invalidateViewport(const FloatRect&);
     
    191193    BitmapTexture* texture() { return m_ownedTiles.isEmpty() ? 0 : m_ownedTiles[0].texture.get(); }
    192194
    193     void paintRecursive(TextureMapperPaintOptions);
    194     bool paintReflection(const TextureMapperPaintOptions&, BitmapTexture* surface);
     195    void paintRecursive(const TextureMapperPaintOptions&);
    195196    void paintSelf(const TextureMapperPaintOptions&);
    196     void paintSelfAndChildren(const TextureMapperPaintOptions&, TextureMapperPaintOptions& optionsForDescendants);
     197    void paintSelfAndChildren(const TextureMapperPaintOptions&);
     198    void paintSelfAndChildrenWithReplica(const TextureMapperPaintOptions&);
    197199    void renderContent(TextureMapper*, GraphicsLayer*);
    198200
     
    204206    bool hasOpacityAnimation() const;
    205207    bool hasTransformAnimation() const;
    206     bool hasMoreThanOneTile() const;
     208    bool isVisible() const;
     209    bool shouldPaintToIntermediateSurface() const;
    207210
    208211    LayerTransform m_transform;
Note: See TracChangeset for help on using the changeset viewer.