Changeset 269204 in webkit


Ignore:
Timestamp:
Oct 30, 2020 1:27:23 PM (3 years ago)
Author:
Fujii Hironori
Message:

[TextureMapper] Replica layers don't blend correctly because computeOverlapRegions doesn't take TextureMapperPaintOptions::transform into account
https://bugs.webkit.org/show_bug.cgi?id=218307

Reviewed by Don Olmstead.

Source/WebCore:

Blending in replica layers didn't work as expected because
computeOverlapRegions didn't take the transform of
TextureMapperPaintOptions into account. Rendering replica layers
are achieved by using the transform.

TextureMapperLayer::paintWithIntermediateSurface also should take
the transform. commitSurface no longer needs to transform by it.

Test: compositing/reflections/opacity-in-reflection.html

  • platform/graphics/texmap/TextureMapperLayer.cpp:

(WebCore::TextureMapperLayer::computeOverlapRegions):
(WebCore::TextureMapperLayer::paintUsingOverlapRegions):
(WebCore::commitSurface):
(WebCore::TextureMapperLayer::paintWithIntermediateSurface):

  • platform/graphics/texmap/TextureMapperLayer.h:

LayoutTests:

  • compositing/reflections/opacity-in-reflection-expected.html: Added.
  • compositing/reflections/opacity-in-reflection.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269186 r269204  
     12020-10-30  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [TextureMapper] Replica layers don't blend correctly because computeOverlapRegions doesn't take TextureMapperPaintOptions::transform into account
     4        https://bugs.webkit.org/show_bug.cgi?id=218307
     5
     6        Reviewed by Don Olmstead.
     7
     8        * compositing/reflections/opacity-in-reflection-expected.html: Added.
     9        * compositing/reflections/opacity-in-reflection.html: Added.
     10
    1112020-10-30  Chris Dumez  <cdumez@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r269203 r269204  
     12020-10-30  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [TextureMapper] Replica layers don't blend correctly because computeOverlapRegions doesn't take TextureMapperPaintOptions::transform into account
     4        https://bugs.webkit.org/show_bug.cgi?id=218307
     5
     6        Reviewed by Don Olmstead.
     7
     8        Blending in replica layers didn't work as expected because
     9        computeOverlapRegions didn't take the transform of
     10        TextureMapperPaintOptions into account. Rendering replica layers
     11        are achieved by using the transform.
     12
     13        TextureMapperLayer::paintWithIntermediateSurface also should take
     14        the transform. commitSurface no longer needs to transform by it.
     15
     16        Test: compositing/reflections/opacity-in-reflection.html
     17
     18        * platform/graphics/texmap/TextureMapperLayer.cpp:
     19        (WebCore::TextureMapperLayer::computeOverlapRegions):
     20        (WebCore::TextureMapperLayer::paintUsingOverlapRegions):
     21        (WebCore::commitSurface):
     22        (WebCore::TextureMapperLayer::paintWithIntermediateSurface):
     23        * platform/graphics/texmap/TextureMapperLayer.h:
     24
    1252020-10-30  Chris Dumez  <cdumez@apple.com>
    226
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

    r269116 r269204  
    326326}
    327327
    328 void TextureMapperLayer::computeOverlapRegions(Region& overlapRegion, Region& nonOverlapRegion, ResolveSelfOverlapMode mode)
     328void TextureMapperLayer::computeOverlapRegions(const TextureMapperPaintOptions& options, Region& overlapRegion, Region& nonOverlapRegion, ResolveSelfOverlapMode mode)
    329329{
    330330    if (!m_state.visible || !m_state.contentsVisible)
     
    345345    }
    346346
     347    TransformationMatrix transform;
     348    transform.multiply(options.transform);
     349    transform.multiply(m_layerTransforms.combined);
     350
    347351    TransformationMatrix replicaMatrix;
    348352    if (m_state.replicaLayer) {
     
    351355    }
    352356
    353     boundingRect = m_layerTransforms.combined.mapRect(boundingRect);
     357    boundingRect = transform.mapRect(boundingRect);
    354358
    355359    // Count all masks and filters as overlap layers.
     
    366370    if (!m_state.masksToBounds) {
    367371        for (auto* child : m_children)
    368             child->computeOverlapRegions(newOverlapRegion, newNonOverlapRegion, ResolveSelfOverlapIfNeeded);
     372            child->computeOverlapRegions(options, newOverlapRegion, newNonOverlapRegion, ResolveSelfOverlapIfNeeded);
    369373    }
    370374
     
    388392    Region overlapRegion;
    389393    Region nonOverlapRegion;
    390     computeOverlapRegions(overlapRegion, nonOverlapRegion, ResolveSelfOverlapAlways);
     394    computeOverlapRegions(options, overlapRegion, nonOverlapRegion, ResolveSelfOverlapAlways);
    391395    if (overlapRegion.isEmpty()) {
    392396        paintSelfAndChildrenWithReplica(options);
     
    461465static void commitSurface(const TextureMapperPaintOptions& options, BitmapTexture& surface, const IntRect& rect, float opacity)
    462466{
     467    IntRect targetRect(rect);
     468    targetRect.move(options.offset);
    463469    options.textureMapper.bindSurface(options.surface.get());
    464     TransformationMatrix targetTransform;
    465     targetTransform.translate(options.offset.width(), options.offset.height());
    466     targetTransform.multiply(options.transform);
    467     options.textureMapper.drawTexture(surface, rect, targetTransform, opacity);
     470    options.textureMapper.drawTexture(surface, targetRect, { }, opacity);
    468471}
    469472
     
    472475    TextureMapperPaintOptions paintOptions(options);
    473476    paintOptions.surface = options.textureMapper.acquireTextureFromPool(rect.size(), BitmapTexture::SupportsAlpha);
    474     paintOptions.offset = -IntSize(rect.x(), rect.y());
     477    paintOptions.offset = -toIntSize(rect.location());
    475478    paintOptions.opacity = 1;
    476     paintOptions.transform = TransformationMatrix();
    477479    if (m_state.replicaLayer) {
    478480        paintOptions.isReplica = true;
    479         paintOptions.transform = replicaTransform();
     481        paintOptions.transform.multiply(replicaTransform());
    480482        paintIntoSurface(paintOptions);
    481483        paintOptions.isReplica = false;
    482         paintOptions.transform = TransformationMatrix();
     484        paintOptions.transform = options.transform;
    483485        if (m_state.replicaLayer->m_state.maskLayer)
    484486            m_state.replicaLayer->m_state.maskLayer->applyMask(paintOptions);
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h

    r269116 r269204  
    128128        ResolveSelfOverlapIfNeeded
    129129    };
    130     void computeOverlapRegions(Region& overlapRegion, Region& nonOverlapRegion, ResolveSelfOverlapMode);
     130    void computeOverlapRegions(const TextureMapperPaintOptions&, Region& overlapRegion, Region& nonOverlapRegion, ResolveSelfOverlapMode);
    131131
    132132    void paintRecursive(const TextureMapperPaintOptions&);
Note: See TracChangeset for help on using the changeset viewer.