summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp
index d8315660a2..eafdcf04b4 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageBufferQt.cpp
@@ -46,12 +46,19 @@ namespace WebCore {
ImageBufferData::ImageBufferData(const IntSize& size)
: m_pixmap(size)
+ , m_painter(0)
{
+ if (m_pixmap.isNull())
+ return;
+
m_pixmap.fill(QColor(Qt::transparent));
- QPainter* painter = new QPainter(&m_pixmap);
+ QPainter* painter = new QPainter;
m_painter.set(painter);
+ if (!painter->begin(&m_pixmap))
+ return;
+
// Since ImageBuffer is used mainly for Canvas, explicitly initialize
// its painter's pen and brush with the corresponding canvas defaults
// NOTE: keep in sync with CanvasRenderingContext2D::State
@@ -72,8 +79,11 @@ ImageBuffer::ImageBuffer(const IntSize& size, ImageColorSpace, bool& success)
: m_data(size)
, m_size(size)
{
+ success = m_data.m_painter && m_data.m_painter->isActive();
+ if (!success)
+ return;
+
m_context.set(new GraphicsContext(m_data.m_painter.get()));
- success = true;
}
ImageBuffer::~ImageBuffer()