summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-05-21 13:08:12 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-05-21 12:47:18 +0000
commit8b2647154aa08a498624fa144d55fdefbeebe320 (patch)
treed8feeb06c77ccc104a3b9bc5351b2d2a7ab2af29
parent586bdc38324dfaeec65389bf7646c82cb35db017 (diff)
Fix drawing of oversized accelerated layersv5.4.2
Adds a special content layer that can used when we drop the backing store due to size, but still need to draw the content that would have been in the backing store. This fixes a regression introduced with the recent patch to prevent large backing stores. Change-Id: I9a61b3cc978bccdaa423c0d076e3aeaa7d9ebc99 Task-number: QTBUG-46178 Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
-rw-r--r--Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp40
-rw-r--r--Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h1
2 files changed, 39 insertions, 2 deletions
diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
index e390792a3..73a6afc02 100644
--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
@@ -48,6 +48,31 @@ PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
return adoptPtr(new GraphicsLayerTextureMapper(client));
}
+// A fallback layer to handle painting when we decide dynamically to avoid compositing due to layer size.
+class DirectPaintLayer : public TextureMapperPlatformLayer {
+public:
+ DirectPaintLayer(GraphicsLayer* sourceLayer) : m_sourceLayer(sourceLayer)
+ { }
+ void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix& modelViewMatrix, float opacity) OVERRIDE;
+
+private:
+ GraphicsLayer* m_sourceLayer;
+};
+
+void DirectPaintLayer::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity)
+{
+ GraphicsContext* context = textureMapper->graphicsContext();
+ context->save();
+ context->setAlpha(opacity);
+#if ENABLE(3D_RENDERING)
+ context->concat3DTransform(matrix);
+#else
+ context->concatCTM(matrix.toAffineTransform());
+#endif
+ m_sourceLayer->paintGraphicsLayerContents(*context, enclosingIntRect(targetRect));
+ context->restore();
+}
+
GraphicsLayerTextureMapper::GraphicsLayerTextureMapper(GraphicsLayerClient* client)
: GraphicsLayer(client)
, m_layer(adoptPtr(new TextureMapperLayer()))
@@ -57,6 +82,7 @@ GraphicsLayerTextureMapper::GraphicsLayerTextureMapper(GraphicsLayerClient* clie
, m_fixedToViewport(false)
, m_debugBorderWidth(0)
, m_contentsLayer(0)
+ , m_directLayer(0)
, m_animationStartTime(0)
, m_isScrollable(false)
{
@@ -79,7 +105,8 @@ GraphicsLayerTextureMapper::~GraphicsLayerTextureMapper()
{
if (m_contentsLayer)
m_contentsLayer->setClient(0);
-
+ delete m_directLayer;
+ m_directLayer = 0;
willBeDestroyed();
}
@@ -233,6 +260,15 @@ void GraphicsLayerTextureMapper::setSize(const FloatSize& value)
if (maskLayer())
maskLayer()->setSize(value);
notifyChange(SizeChange);
+
+ if (m_size.width() * m_size.height() <= 8192*8192) {
+ if (m_contentsLayer == m_directLayer)
+ setContentsToMedia(0);
+ } else if (!m_contentsLayer) {
+ if (!m_directLayer)
+ m_directLayer = new DirectPaintLayer(this);
+ setContentsToMedia(m_directLayer);
+ }
}
/* \reimp (GraphicsLayer.h)
@@ -627,7 +663,7 @@ void GraphicsLayerTextureMapper::updateBackingStoreIfNeeded()
bool GraphicsLayerTextureMapper::shouldHaveBackingStore() const
{
- return drawsContent() && contentsAreVisible() && !m_size.isEmpty() && (m_size.width() * m_size.height() <= 8192*8192);
+ return drawsContent() && contentsAreVisible() && !m_size.isEmpty() && !m_contentsLayer;
}
bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset)
diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
index 16e4ebad0..548a95c29 100644
--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
@@ -176,6 +176,7 @@ private:
float m_debugBorderWidth;
TextureMapperPlatformLayer* m_contentsLayer;
+ TextureMapperPlatformLayer* m_directLayer;
FloatRect m_needsDisplayRect;
GraphicsLayerAnimations m_animations;
double m_animationStartTime;