Changeset 269116 in webkit


Ignore:
Timestamp:
Oct 28, 2020 1:01:28 PM (3 years ago)
Author:
Fujii Hironori
Message:

TextureMapperLayer::paintWithIntermediateSurface: Reduce BitmapTextures by unifying replicaSurface and mainSurface
https://bugs.webkit.org/show_bug.cgi?id=217943

Reviewed by Don Olmstead.

TextureMapperLayer::paintWithIntermediateSurface was using two
BitmapTextures for the main layer and replica layer. But, a single
BitmapTexture suffices. Create a BitmapTexture and render both
layers onto it.

No new tests, no behavior changes.

  • platform/graphics/texmap/TextureMapperLayer.cpp:

(WebCore::TextureMapperLayer::paintIntoSurface):
(WebCore::TextureMapperLayer::paintWithIntermediateSurface):

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

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r269110 r269116  
     12020-10-28  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        TextureMapperLayer::paintWithIntermediateSurface: Reduce BitmapTextures by unifying replicaSurface and mainSurface
     4        https://bugs.webkit.org/show_bug.cgi?id=217943
     5
     6        Reviewed by Don Olmstead.
     7
     8        TextureMapperLayer::paintWithIntermediateSurface was using two
     9        BitmapTextures for the main layer and replica layer. But, a single
     10        BitmapTexture suffices. Create a BitmapTexture and render both
     11        layers onto it.
     12
     13        No new tests, no behavior changes.
     14
     15        * platform/graphics/texmap/TextureMapperLayer.cpp:
     16        (WebCore::TextureMapperLayer::paintIntoSurface):
     17        (WebCore::TextureMapperLayer::paintWithIntermediateSurface):
     18        * platform/graphics/texmap/TextureMapperLayer.h:
     19
    1202020-10-28  Zalan Bujtas  <zalan@apple.com>
    221
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

    r269072 r269116  
    444444}
    445445
    446 RefPtr<BitmapTexture> TextureMapperLayer::paintIntoSurface(const TextureMapperPaintOptions& options, const IntSize& size)
    447 {
    448     RefPtr<BitmapTexture> surface = options.textureMapper.acquireTextureFromPool(size, BitmapTexture::SupportsAlpha);
    449     TextureMapperPaintOptions paintOptions(options);
    450     paintOptions.surface = surface;
    451     options.textureMapper.bindSurface(surface.get());
     446void TextureMapperLayer::paintIntoSurface(TextureMapperPaintOptions& options)
     447{
     448    options.textureMapper.bindSurface(options.surface.get());
    452449    if (m_isBackdrop) {
     450        TextureMapperPaintOptions paintOptions(options);
    453451        paintOptions.backdropLayer = this;
    454452        rootLayer().paintSelfAndChildren(paintOptions);
    455         paintOptions.backdropLayer = nullptr;
    456453    } else
    457         paintSelfAndChildren(paintOptions);
     454        paintSelfAndChildren(options);
    458455    if (m_state.maskLayer)
    459456        m_state.maskLayer->applyMask(options);
    460     surface = surface->applyFilters(options.textureMapper, m_currentFilters);
    461     options.textureMapper.bindSurface(surface.get());
    462     return surface;
     457    options.surface = options.surface->applyFilters(options.textureMapper, m_currentFilters);
     458    options.textureMapper.bindSurface(options.surface.get());
    463459}
    464460
     
    474470void TextureMapperLayer::paintWithIntermediateSurface(const TextureMapperPaintOptions& options, const IntRect& rect)
    475471{
    476     RefPtr<BitmapTexture> replicaSurface;
    477     RefPtr<BitmapTexture> mainSurface;
    478472    TextureMapperPaintOptions paintOptions(options);
     473    paintOptions.surface = options.textureMapper.acquireTextureFromPool(rect.size(), BitmapTexture::SupportsAlpha);
    479474    paintOptions.offset = -IntSize(rect.x(), rect.y());
    480475    paintOptions.opacity = 1;
     
    483478        paintOptions.isReplica = true;
    484479        paintOptions.transform = replicaTransform();
    485         replicaSurface = paintIntoSurface(paintOptions, rect.size());
     480        paintIntoSurface(paintOptions);
    486481        paintOptions.isReplica = false;
    487482        paintOptions.transform = TransformationMatrix();
     
    490485    }
    491486
    492     if (replicaSurface && options.opacity == 1) {
    493         commitSurface(options, *replicaSurface, rect, 1);
    494         replicaSurface = nullptr;
    495     }
    496 
    497487    if (m_isBackdrop && m_effectTarget->m_state.replicaLayer && options.isReplica)
    498488        paintOptions.transform = m_effectTarget->replicaTransform();
    499489
    500     mainSurface = paintIntoSurface(paintOptions, rect.size());
    501     if (replicaSurface) {
    502         options.textureMapper.bindSurface(replicaSurface.get());
    503         options.textureMapper.drawTexture(*mainSurface.get(), FloatRect(FloatPoint::zero(), rect.size()));
    504         mainSurface = replicaSurface;
    505     }
    506 
    507     commitSurface(options, *mainSurface, rect, options.opacity);
     490    paintIntoSurface(paintOptions);
     491
     492    commitSurface(options, *paintOptions.surface, rect, options.opacity);
    508493}
    509494
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h

    r269072 r269116  
    132132    void paintRecursive(const TextureMapperPaintOptions&);
    133133    void paintUsingOverlapRegions(const TextureMapperPaintOptions&);
    134     RefPtr<BitmapTexture> paintIntoSurface(const TextureMapperPaintOptions&, const IntSize&);
     134    void paintIntoSurface(TextureMapperPaintOptions&);
    135135    void paintWithIntermediateSurface(const TextureMapperPaintOptions&, const IntRect&);
    136136    void paintSelf(const TextureMapperPaintOptions&);
Note: See TracChangeset for help on using the changeset viewer.