summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-01-30 17:01:04 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-31 21:21:42 +0100
commitf314bb46c5b144be4559ac13f055062d5e3027b3 (patch)
tree975fbd34c77e27ddc3aa49ecd31f41414328df38
parentdb006e7811c4cdc8eada301a2a986a8abbc5d13f (diff)
Fix assert in m_stack.isEmpty() in GraphicsContext::~GraphicsContext()
Save and restore is not balanced in GraphicsContext. This causes the log error "ERROR void GraphicsContext::restore() stack is empty" and assert in the GraphicsContext destructor. The cause is a mismatch of GraphicsContexts being saved and restored by TextureMapperImageBuffer beginClip and endClip. This patch fixes endClip to restore the currentContext beginClip saved. Change-Id: Ief0100dd26c7eded04734167e86712a81f1a7674 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp9
-rw-r--r--Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp
index c04e576db..668ea95b1 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp
@@ -114,6 +114,15 @@ void TextureMapperImageBuffer::beginClip(const TransformationMatrix& matrix, con
#endif
}
+void TextureMapperImageBuffer::endClip()
+{
+ GraphicsContext* context = currentContext();
+ if (!context)
+ return;
+
+ context->restore();
+}
+
void TextureMapperImageBuffer::drawTexture(const BitmapTexture& texture, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity, unsigned /* exposedEdges */)
{
GraphicsContext* context = currentContext();
diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h
index 060713ce5..637d9d33b 100644
--- a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h
+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h
@@ -59,7 +59,7 @@ public:
virtual void drawSolidColor(const FloatRect&, const TransformationMatrix&, const Color&) OVERRIDE;
virtual void beginClip(const TransformationMatrix&, const FloatRect&) OVERRIDE;
virtual void bindSurface(BitmapTexture* surface) OVERRIDE { m_currentSurface = surface;}
- virtual void endClip() OVERRIDE { graphicsContext()->restore(); }
+ virtual void endClip() OVERRIDE;
virtual IntRect clipBounds() OVERRIDE { return currentContext()->clipBounds(); }
virtual IntSize maxTextureSize() const;
virtual PassRefPtr<BitmapTexture> createTexture() OVERRIDE { return BitmapTextureImageBuffer::create(); }