From 5e2bc6953fe6923165b8a5d7679939693a1d58d6 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Fri, 5 Feb 2010 14:27:46 +0000 Subject: Merge webkit.org at r54340 : Initial merge by git Change-Id: Ib489d2ff91186ea3652522e1d586e54416a2cf44 --- WebCore/platform/graphics/qt/GraphicsContextQt.cpp | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'WebCore/platform/graphics/qt/GraphicsContextQt.cpp') diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index b78a6e8..9046449 100644 --- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -40,6 +40,7 @@ #include #endif +#include "AffineTransform.h" #include "Color.h" #include "FloatConversion.h" #include "Font.h" @@ -275,6 +276,13 @@ PlatformGraphicsContext* GraphicsContext::platformContext() const return m_data->p(); } +AffineTransform GraphicsContext::getAffineCTM() const +{ + QTransform matrix(platformContext()->combinedTransform()); + return AffineTransform(matrix.m11(), matrix.m12(), matrix.m21(), + matrix.m22(), matrix.dx(), matrix.dy()); +} + TransformationMatrix GraphicsContext::getCTM() const { QTransform matrix(platformContext()->combinedTransform()); @@ -1188,6 +1196,24 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, p->setRenderHint(QPainter::Antialiasing, antiAlias); } +void GraphicsContext::concatCTM(const AffineTransform& transform) +{ + if (paintingDisabled()) + return; + + m_data->p()->setWorldTransform(transform, true); + + // Transformations to the context shouldn't transform the currentPath. + // We have to undo every change made to the context from the currentPath + // to avoid wrong drawings. + if (!m_data->currentPath.isEmpty() && transform.isInvertible()) { + QTransform matrix = transform.inverse(); + m_data->currentPath = m_data->currentPath * matrix; + m_common->state.pathTransform.multiply(transform.toTransformationMatrix()); + } +} + + void GraphicsContext::concatCTM(const TransformationMatrix& transform) { if (paintingDisabled()) -- cgit v1.1