Modified: trunk/Source/WebCore/ChangeLog (269115 => 269116)
--- trunk/Source/WebCore/ChangeLog 2020-10-28 19:25:14 UTC (rev 269115)
+++ trunk/Source/WebCore/ChangeLog 2020-10-28 20:01:28 UTC (rev 269116)
@@ -1,3 +1,22 @@
+2020-10-28 Fujii Hironori <[email protected]>
+
+ 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:
+
2020-10-28 Zalan Bujtas <[email protected]>
[LFC][IFC] horizontalAlignmentOffset should check for empty run list
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (269115 => 269116)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2020-10-28 19:25:14 UTC (rev 269115)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2020-10-28 20:01:28 UTC (rev 269116)
@@ -443,23 +443,19 @@
options.textureMapper.setMaskMode(false);
}
-RefPtr<BitmapTexture> TextureMapperLayer::paintIntoSurface(const TextureMapperPaintOptions& options, const IntSize& size)
+void TextureMapperLayer::paintIntoSurface(TextureMapperPaintOptions& options)
{
- RefPtr<BitmapTexture> surface = options.textureMapper.acquireTextureFromPool(size, BitmapTexture::SupportsAlpha);
- TextureMapperPaintOptions paintOptions(options);
- paintOptions.surface = surface;
- options.textureMapper.bindSurface(surface.get());
+ options.textureMapper.bindSurface(options.surface.get());
if (m_isBackdrop) {
+ TextureMapperPaintOptions paintOptions(options);
paintOptions.backdropLayer = this;
rootLayer().paintSelfAndChildren(paintOptions);
- paintOptions.backdropLayer = nullptr;
} else
- paintSelfAndChildren(paintOptions);
+ paintSelfAndChildren(options);
if (m_state.maskLayer)
m_state.maskLayer->applyMask(options);
- surface = surface->applyFilters(options.textureMapper, m_currentFilters);
- options.textureMapper.bindSurface(surface.get());
- return surface;
+ options.surface = options.surface->applyFilters(options.textureMapper, m_currentFilters);
+ options.textureMapper.bindSurface(options.surface.get());
}
static void commitSurface(const TextureMapperPaintOptions& options, BitmapTexture& surface, const IntRect& rect, float opacity)
@@ -473,9 +469,8 @@
void TextureMapperLayer::paintWithIntermediateSurface(const TextureMapperPaintOptions& options, const IntRect& rect)
{
- RefPtr<BitmapTexture> replicaSurface;
- RefPtr<BitmapTexture> mainSurface;
TextureMapperPaintOptions paintOptions(options);
+ paintOptions.surface = options.textureMapper.acquireTextureFromPool(rect.size(), BitmapTexture::SupportsAlpha);
paintOptions.offset = -IntSize(rect.x(), rect.y());
paintOptions.opacity = 1;
paintOptions.transform = TransformationMatrix();
@@ -482,7 +477,7 @@
if (m_state.replicaLayer) {
paintOptions.isReplica = true;
paintOptions.transform = replicaTransform();
- replicaSurface = paintIntoSurface(paintOptions, rect.size());
+ paintIntoSurface(paintOptions);
paintOptions.isReplica = false;
paintOptions.transform = TransformationMatrix();
if (m_state.replicaLayer->m_state.maskLayer)
@@ -489,22 +484,12 @@
m_state.replicaLayer->m_state.maskLayer->applyMask(paintOptions);
}
- if (replicaSurface && options.opacity == 1) {
- commitSurface(options, *replicaSurface, rect, 1);
- replicaSurface = nullptr;
- }
-
if (m_isBackdrop && m_effectTarget->m_state.replicaLayer && options.isReplica)
paintOptions.transform = m_effectTarget->replicaTransform();
- mainSurface = paintIntoSurface(paintOptions, rect.size());
- if (replicaSurface) {
- options.textureMapper.bindSurface(replicaSurface.get());
- options.textureMapper.drawTexture(*mainSurface.get(), FloatRect(FloatPoint::zero(), rect.size()));
- mainSurface = replicaSurface;
- }
+ paintIntoSurface(paintOptions);
- commitSurface(options, *mainSurface, rect, options.opacity);
+ commitSurface(options, *paintOptions.surface, rect, options.opacity);
}
void TextureMapperLayer::paintRecursive(const TextureMapperPaintOptions& options)
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (269115 => 269116)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2020-10-28 19:25:14 UTC (rev 269115)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2020-10-28 20:01:28 UTC (rev 269116)
@@ -131,7 +131,7 @@
void paintRecursive(const TextureMapperPaintOptions&);
void paintUsingOverlapRegions(const TextureMapperPaintOptions&);
- RefPtr<BitmapTexture> paintIntoSurface(const TextureMapperPaintOptions&, const IntSize&);
+ void paintIntoSurface(TextureMapperPaintOptions&);
void paintWithIntermediateSurface(const TextureMapperPaintOptions&, const IntRect&);
void paintSelf(const TextureMapperPaintOptions&);
void paintSelfAndChildren(const TextureMapperPaintOptions&);