summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp')
-rw-r--r--Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp b/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
index b2c702f..7ce7ee9 100644
--- a/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
+++ b/Source/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp
@@ -72,18 +72,15 @@ GraphicsContext::GraphicsContext(HDC dc, bool hasAlpha)
void GraphicsContext::platformInit(HDC dc, bool hasAlpha)
{
- m_data = new GraphicsContextPlatformPrivate;
-
- if (dc) {
- m_data->cr = createCairoContextWithHDC(dc, hasAlpha);
- m_data->m_hdc = dc;
- } else {
+ cairo_t* cr = 0;
+ if (dc)
+ cr = createCairoContextWithHDC(dc, hasAlpha);
+ else
setPaintingDisabled(true);
- m_data->cr = 0;
- m_data->m_hdc = 0;
- }
- if (m_data->cr) {
+ m_data = new GraphicsContextPlatformPrivateTopLevel(new PlatformContextCairo(cr));
+ m_data->m_hdc = dc;
+ if (platformContext()->cr()) {
// Make sure the context starts in sync with our state.
setPlatformFillColor(fillColor(), fillColorSpace());
setPlatformStrokeColor(strokeColor(), strokeColorSpace());
@@ -131,24 +128,25 @@ void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, boo
// Scale the target surface to the new image size, and flip it
// so that when we set the srcImage as the surface it will draw
// right-side-up.
- cairo_save(m_data->cr);
- cairo_translate(m_data->cr, dstRect.x(), dstRect.height() + dstRect.y());
- cairo_scale(m_data->cr, 1.0, -1.0);
- cairo_set_source_surface(m_data->cr, image, 0, 0);
+ cairo_t* cr = platformContext()->cr();
+ cairo_save(cr);
+ cairo_translate(cr, dstRect.x(), dstRect.height() + dstRect.y());
+ cairo_scale(cr, 1, -1);
+ cairo_set_source_surface(cr, image, 0, 0);
if (m_data->layers.size())
- cairo_paint_with_alpha(m_data->cr, m_data->layers.last());
+ cairo_paint_with_alpha(cr, m_data->layers.last());
else
- cairo_paint(m_data->cr);
+ cairo_paint(cr);
// Delete all our junk.
cairo_surface_destroy(image);
::DeleteDC(hdc);
::DeleteObject(bitmap);
- cairo_restore(m_data->cr);
+ cairo_restore(cr);
}
-void GraphicsContextPlatformPrivate::syncContext(PlatformGraphicsContext* cr)
+void GraphicsContextPlatformPrivate::syncContext(cairo_t* cr)
{
if (!cr)
return;