summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/qt/GraphicsContextQt.cpp')
-rw-r--r--WebCore/platform/graphics/qt/GraphicsContextQt.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 4f68577..06e1e1c 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -220,8 +220,11 @@ public:
#endif
}
+ void takeOwnershipOfPlatformContext() { platformContextIsOwned = true; }
+
private:
QPainter* painter;
+ bool platformContextIsOwned;
};
@@ -231,6 +234,7 @@ GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p, cons
, solidColor(initialSolidColor)
, imageInterpolationQuality(InterpolationDefault)
, painter(p)
+ , platformContextIsOwned(false)
{
if (!painter)
return;
@@ -243,6 +247,13 @@ GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(QPainter* p, cons
GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate()
{
+ if (!platformContextIsOwned)
+ return;
+
+ painter->end();
+ QPaintDevice* device = painter->device();
+ delete painter;
+ delete device;
}
GraphicsContext::GraphicsContext(PlatformGraphicsContext* painter)
@@ -1400,6 +1411,11 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const
return m_data->imageInterpolationQuality;
}
+void GraphicsContext::takeOwnershipOfPlatformContext()
+{
+ m_data->takeOwnershipOfPlatformContext();
+}
+
}
// vim: ts=4 sw=4 et