[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
jpetsovits at rim.com
jpetsovits at rim.com
Wed Mar 17 18:07:24 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 7bbc0c913a56dd271f5cdde642d14478225fdcf3
Author: jpetsovits at rim.com <jpetsovits at rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Mar 1 15:51:59 2010 +0000
2010-03-01 Jakob Petsovits <jpetsovits at rim.com>
Reviewed by Nikolas Zimmermann.
[OpenVG] Convert from TransformationMatrix to AffineTransform.
https://bugs.webkit.org/show_bug.cgi?id=35445
Dirk Schulze previously introduced AffineTransform as
replacement for most TransformationMatrix occurrences
in GraphicsContext & Co., but did not update the OpenVG
graphics backend as there's no publicly available way
to build it. This commit now takes care of that.
* platform/graphics/openvg/GraphicsContextOpenVG.cpp:
(WebCore::GraphicsContext::getCTM):
(WebCore::GraphicsContext::roundToDevicePixels):
(WebCore::GraphicsContext::origin):
(WebCore::GraphicsContext::concatCTM):
* platform/graphics/openvg/PainterOpenVG.cpp:
(WebCore::isNonRotatedAffineTransformation):
(WebCore::PlatformPainterState::PlatformPainterState):
(WebCore::PlatformPainterState::applyState):
(WebCore::PlatformPainterState::applyTransformation):
(WebCore::PainterOpenVG::transformation):
(WebCore::PainterOpenVG::concatTransformation):
(WebCore::PainterOpenVG::setTransformation):
(WebCore::PainterOpenVG::scale):
(WebCore::PainterOpenVG::rotate):
(WebCore::PainterOpenVG::translate):
(WebCore::PainterOpenVG::intersectClipRect):
* platform/graphics/openvg/PainterOpenVG.h:
* platform/graphics/openvg/VGUtils.cpp:
(WebCore::VGMatrix::VGMatrix):
(WebCore::VGMatrix::operator AffineTransform):
(WebCore::VGMatrix::operator TransformationMatrix):
(WebCore::AffineTransform::operator VGMatrix):
* platform/graphics/openvg/VGUtils.h:
* platform/graphics/transforms/AffineTransform.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 82d1d9f..ade5349 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,42 @@
+2010-03-01 Jakob Petsovits <jpetsovits at rim.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ [OpenVG] Convert from TransformationMatrix to AffineTransform.
+ https://bugs.webkit.org/show_bug.cgi?id=35445
+
+ Dirk Schulze previously introduced AffineTransform as
+ replacement for most TransformationMatrix occurrences
+ in GraphicsContext & Co., but did not update the OpenVG
+ graphics backend as there's no publicly available way
+ to build it. This commit now takes care of that.
+
+ * platform/graphics/openvg/GraphicsContextOpenVG.cpp:
+ (WebCore::GraphicsContext::getCTM):
+ (WebCore::GraphicsContext::roundToDevicePixels):
+ (WebCore::GraphicsContext::origin):
+ (WebCore::GraphicsContext::concatCTM):
+ * platform/graphics/openvg/PainterOpenVG.cpp:
+ (WebCore::isNonRotatedAffineTransformation):
+ (WebCore::PlatformPainterState::PlatformPainterState):
+ (WebCore::PlatformPainterState::applyState):
+ (WebCore::PlatformPainterState::applyTransformation):
+ (WebCore::PainterOpenVG::transformation):
+ (WebCore::PainterOpenVG::concatTransformation):
+ (WebCore::PainterOpenVG::setTransformation):
+ (WebCore::PainterOpenVG::scale):
+ (WebCore::PainterOpenVG::rotate):
+ (WebCore::PainterOpenVG::translate):
+ (WebCore::PainterOpenVG::intersectClipRect):
+ * platform/graphics/openvg/PainterOpenVG.h:
+ * platform/graphics/openvg/VGUtils.cpp:
+ (WebCore::VGMatrix::VGMatrix):
+ (WebCore::VGMatrix::operator AffineTransform):
+ (WebCore::VGMatrix::operator TransformationMatrix):
+ (WebCore::AffineTransform::operator VGMatrix):
+ * platform/graphics/openvg/VGUtils.h:
+ * platform/graphics/transforms/AffineTransform.h:
+
2010-03-01 Tor Arne Vestbø <tor.arne.vestbo at nokia.com>
Reviewed by Simon Hausmann.
diff --git a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
index 5ed892c..909fa27 100644
--- a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
@@ -20,11 +20,11 @@
#include "config.h"
#include "GraphicsContext.h"
+#include "AffineTransform.h"
#include "GraphicsContextPrivate.h"
#include "NotImplemented.h"
#include "PainterOpenVG.h"
#include "SurfaceOpenVG.h"
-#include "TransformationMatrix.h"
#include <wtf/Assertions.h>
#include <wtf/MathExtras.h>
@@ -69,12 +69,12 @@ PlatformGraphicsContext* GraphicsContext::platformContext() const
return m_data->baseSurface();
}
-TransformationMatrix GraphicsContext::getCTM() const
+AffineTransform GraphicsContext::getCTM() const
{
if (paintingDisabled())
- return TransformationMatrix();
+ return AffineTransform();
- return m_data->transformationMatrix();
+ return m_data->transformation();
}
void GraphicsContext::savePlatformState()
@@ -281,7 +281,7 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect)
if (paintingDisabled())
return FloatRect();
- return FloatRect(enclosingIntRect(m_data->transformationMatrix().mapRect(rect)));
+ return FloatRect(enclosingIntRect(m_data->transformation().mapRect(rect)));
}
void GraphicsContext::setPlatformShadow(const IntSize& size, int blur, const Color& color, ColorSpace colorSpace)
@@ -451,8 +451,8 @@ IntPoint GraphicsContext::origin()
if (paintingDisabled())
return IntPoint();
- TransformationMatrix matrix = m_data->transformationMatrix();
- return IntPoint(roundf(matrix.m41()), roundf(matrix.m42()));
+ AffineTransform transformation = m_data->transformation();
+ return IntPoint(roundf(transformation.e()), roundf(transformation.f()));
}
void GraphicsContext::clipOut(const IntRect& rect)
@@ -493,12 +493,12 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness
UNUSED_PARAM(thickness);
}
-void GraphicsContext::concatCTM(const TransformationMatrix& transform)
+void GraphicsContext::concatCTM(const AffineTransform& transformation)
{
if (paintingDisabled())
return;
- m_data->concatTransformationMatrix(transform);
+ m_data->concatTransformation(transformation);
}
void GraphicsContext::setURLForRect(const KURL& link, const IntRect& destRect)
diff --git a/WebCore/platform/graphics/openvg/PainterOpenVG.cpp b/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
index 3b7cf85..fd75ec1 100644
--- a/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
@@ -20,6 +20,7 @@
#include "config.h"
#include "PainterOpenVG.h"
+#include "AffineTransform.h"
#include "Color.h"
#include "DashArray.h"
#include "FloatPoint.h"
@@ -29,7 +30,6 @@
#include "IntSize.h"
#include "NotImplemented.h"
#include "SurfaceOpenVG.h"
-#include "TransformationMatrix.h"
#include "VGUtils.h"
#if PLATFORM(EGL)
@@ -43,12 +43,9 @@
namespace WebCore {
-static bool isNonRotatedAffineTransformation(const TransformationMatrix& matrix)
+static bool isNonRotatedAffineTransformation(const AffineTransform& t)
{
- return matrix.m12() <= FLT_EPSILON && matrix.m13() <= FLT_EPSILON && matrix.m14() <= FLT_EPSILON
- && matrix.m21() <= FLT_EPSILON && matrix.m23() <= FLT_EPSILON && matrix.m24() <= FLT_EPSILON
- && matrix.m31() <= FLT_EPSILON && matrix.m32() <= FLT_EPSILON && matrix.m34() <= FLT_EPSILON
- && matrix.m44() >= 1 - FLT_EPSILON;
+ return t.b() <= FLT_EPSILON && t.c() <= FLT_EPSILON;
}
static VGCapStyle toVGCapStyle(LineCap lineCap)
@@ -103,7 +100,7 @@ static void setVGSolidColor(VGPaintMode paintMode, const Color& color)
struct PlatformPainterState {
- TransformationMatrix surfaceTransformationMatrix;
+ AffineTransform surfaceTransformation;
CompositeOperator compositeOperation;
float opacity;
@@ -139,7 +136,7 @@ struct PlatformPainterState {
PlatformPainterState(const PlatformPainterState& state)
{
- surfaceTransformationMatrix = state.surfaceTransformationMatrix;
+ surfaceTransformation = state.surfaceTransformation;
scissoringEnabled = state.scissoringEnabled;
scissorRect = state.scissorRect;
@@ -184,7 +181,7 @@ struct PlatformPainterState {
applyBlending(painter);
applyStrokeStyle();
- applyTransformationMatrix(painter);
+ applyTransformation(painter);
applyScissorRect();
}
@@ -267,12 +264,12 @@ struct PlatformPainterState {
ASSERT_VG_NO_ERROR();
}
- void applyTransformationMatrix(PainterOpenVG* painter)
+ void applyTransformation(PainterOpenVG* painter)
{
// There are *five* separate transforms that can be applied to OpenVG as of 1.1
// but it is not clear that we need to set them separately. Instead we set them
// all right here and let this be a call to essentially set the world transformation!
- VGMatrix vgMatrix(surfaceTransformationMatrix);
+ VGMatrix vgMatrix(surfaceTransformation);
const VGfloat* vgFloatArray = vgMatrix.toVGfloat();
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
@@ -417,31 +414,31 @@ void PainterOpenVG::blitToSurface()
m_surface->flush();
}
-TransformationMatrix PainterOpenVG::transformationMatrix() const
+AffineTransform PainterOpenVG::transformation() const
{
ASSERT(m_state);
- return m_state->surfaceTransformationMatrix;
+ return m_state->surfaceTransformation;
}
-void PainterOpenVG::concatTransformationMatrix(const TransformationMatrix& matrix)
+void PainterOpenVG::concatTransformation(const AffineTransform& transformation)
{
ASSERT(m_state);
m_surface->makeCurrent();
- // We do the multiplication ourself using WebCore's TransformationMatrix rather than
- // offloading this to VG via vgMultMatrix to keep things simple and so we can maintain
- // state ourselves.
- m_state->surfaceTransformationMatrix.multLeft(matrix);
- m_state->applyTransformationMatrix(this);
+ // We do the multiplication ourself using WebCore's AffineTransform rather
+ // than offloading this to VG via vgMultMatrix() to keep things simple and
+ // so we can maintain state ourselves.
+ m_state->surfaceTransformation.multLeft(transformation);
+ m_state->applyTransformation(this);
}
-void PainterOpenVG::setTransformationMatrix(const TransformationMatrix& matrix)
+void PainterOpenVG::setTransformation(const AffineTransform& transformation)
{
ASSERT(m_state);
m_surface->makeCurrent();
- m_state->surfaceTransformationMatrix = matrix;
- m_state->applyTransformationMatrix(this);
+ m_state->surfaceTransformation = transformation;
+ m_state->applyTransformation(this);
}
CompositeOperator PainterOpenVG::compositeOperation() const
@@ -599,9 +596,9 @@ void PainterOpenVG::scale(const FloatSize& scaleFactors)
ASSERT(m_state);
m_surface->makeCurrent();
- TransformationMatrix matrix = m_state->surfaceTransformationMatrix;
- matrix.scaleNonUniform(scaleFactors.width(), scaleFactors.height());
- setTransformationMatrix(matrix);
+ AffineTransform transformation = m_state->surfaceTransformation;
+ transformation.scaleNonUniform(scaleFactors.width(), scaleFactors.height());
+ setTransformation(transformation);
}
void PainterOpenVG::rotate(float radians)
@@ -609,9 +606,9 @@ void PainterOpenVG::rotate(float radians)
ASSERT(m_state);
m_surface->makeCurrent();
- TransformationMatrix matrix = m_state->surfaceTransformationMatrix;
- matrix.rotate(rad2deg(radians));
- setTransformationMatrix(matrix);
+ AffineTransform transformation = m_state->surfaceTransformation;
+ transformation.rotate(rad2deg(radians));
+ setTransformation(transformation);
}
void PainterOpenVG::translate(float dx, float dy)
@@ -619,9 +616,9 @@ void PainterOpenVG::translate(float dx, float dy)
ASSERT(m_state);
m_surface->makeCurrent();
- TransformationMatrix matrix = m_state->surfaceTransformationMatrix;
- matrix.translate(dx, dy);
- setTransformationMatrix(matrix);
+ AffineTransform transformation = m_state->surfaceTransformation;
+ transformation.translate(dx, dy);
+ setTransformation(transformation);
}
void PainterOpenVG::intersectScissorRect(const FloatRect& rect)
@@ -649,7 +646,7 @@ void PainterOpenVG::intersectClipRect(const FloatRect& rect)
ASSERT(m_state);
m_surface->makeCurrent();
- if (m_state->surfaceTransformationMatrix.isIdentity()) {
+ if (m_state->surfaceTransformation.isIdentity()) {
// No transformation required, skip all the complex stuff.
intersectScissorRect(rect);
return;
@@ -660,8 +657,7 @@ void PainterOpenVG::intersectClipRect(const FloatRect& rect)
// (potentially more expensive) path clipping. Note that scissoring is not
// subject to transformations, so we need to do the transformation to
// surface coordinates by ourselves.
- FloatQuad effectiveScissorQuad =
- m_state->surfaceTransformationMatrix.mapQuad(FloatQuad(rect));
+ FloatQuad effectiveScissorQuad = m_state->surfaceTransformation.mapQuad(FloatQuad(rect));
if (effectiveScissorQuad.isRectilinear())
intersectScissorRect(effectiveScissorQuad.boundingBox());
diff --git a/WebCore/platform/graphics/openvg/PainterOpenVG.h b/WebCore/platform/graphics/openvg/PainterOpenVG.h
index 6936eee..9982283 100644
--- a/WebCore/platform/graphics/openvg/PainterOpenVG.h
+++ b/WebCore/platform/graphics/openvg/PainterOpenVG.h
@@ -31,12 +31,12 @@
namespace WebCore {
+class AffineTransform;
class FloatPoint;
class FloatRect;
class IntRect;
class IntSize;
class SurfaceOpenVG;
-class TransformationMatrix;
struct PlatformPainterState;
@@ -57,9 +57,9 @@ public:
void begin(SurfaceOpenVG*);
void end();
- TransformationMatrix transformationMatrix() const;
- void setTransformationMatrix(const TransformationMatrix&);
- void concatTransformationMatrix(const TransformationMatrix&);
+ AffineTransform transformation() const;
+ void setTransformation(const AffineTransform&);
+ void concatTransformation(const AffineTransform&);
CompositeOperator compositeOperation() const;
void setCompositeOperation(CompositeOperator);
diff --git a/WebCore/platform/graphics/openvg/VGUtils.cpp b/WebCore/platform/graphics/openvg/VGUtils.cpp
index 72ba5b2..ce9bcd2 100644
--- a/WebCore/platform/graphics/openvg/VGUtils.cpp
+++ b/WebCore/platform/graphics/openvg/VGUtils.cpp
@@ -20,6 +20,7 @@
#include "config.h"
#include "VGUtils.h"
+#include "AffineTransform.h"
#include "FloatRect.h"
#include "TransformationMatrix.h"
@@ -38,6 +39,19 @@ VGMatrix::VGMatrix(const VGfloat data[9])
m_data[8] = data[8];
}
+VGMatrix::VGMatrix(const AffineTransform& transformation)
+{
+ m_data[0] = transformation.a();
+ m_data[1] = transformation.b();
+ m_data[2] = 0;
+ m_data[3] = transformation.c();
+ m_data[4] = transformation.d();
+ m_data[5] = 0;
+ m_data[6] = transformation.e();
+ m_data[7] = transformation.f();
+ m_data[8] = 1;
+}
+
VGMatrix::VGMatrix(const TransformationMatrix& matrix)
{
m_data[0] = matrix.m11();
@@ -51,21 +65,30 @@ VGMatrix::VGMatrix(const TransformationMatrix& matrix)
m_data[8] = matrix.m44();
}
+VGMatrix::operator AffineTransform() const
+{
+ AffineTransform transformation(
+ m_data[0], m_data[1],
+ m_data[3], m_data[4],
+ m_data[6], m_data[7]);
+ return transformation;
+}
+
VGMatrix::operator TransformationMatrix() const
{
- TransformationMatrix matrix;
- matrix.setM11(m_data[0]);
- matrix.setM12(m_data[1]);
- matrix.setM14(m_data[2]);
- matrix.setM21(m_data[3]);
- matrix.setM22(m_data[4]);
- matrix.setM24(m_data[5]);
- matrix.setM41(m_data[6]);
- matrix.setM42(m_data[7]);
- matrix.setM44(m_data[8]);
+ TransformationMatrix matrix(
+ m_data[0], m_data[1], 0, m_data[2],
+ m_data[3], m_data[4], 0, m_data[5],
+ 0, 0, 1, 0,
+ m_data[6], m_data[7], 0, m_data[8]);
return matrix;
}
+AffineTransform::operator VGMatrix() const
+{
+ return VGMatrix(*this);
+}
+
TransformationMatrix::operator VGMatrix() const
{
return VGMatrix(*this);
diff --git a/WebCore/platform/graphics/openvg/VGUtils.h b/WebCore/platform/graphics/openvg/VGUtils.h
index 083c15a..3a290cb 100644
--- a/WebCore/platform/graphics/openvg/VGUtils.h
+++ b/WebCore/platform/graphics/openvg/VGUtils.h
@@ -59,14 +59,17 @@ static inline const char* toVGErrorConstant(VGErrorCode error)
namespace WebCore {
+class AffineTransform;
class FloatRect;
class TransformationMatrix;
class VGMatrix {
public:
VGMatrix(const VGfloat data[9]);
+ VGMatrix(const AffineTransform&);
VGMatrix(const TransformationMatrix&);
const VGfloat* toVGfloat() const { return m_data; }
+ operator AffineTransform() const;
operator TransformationMatrix() const;
private:
VGfloat m_data[9];
diff --git a/WebCore/platform/graphics/transforms/AffineTransform.h b/WebCore/platform/graphics/transforms/AffineTransform.h
index d89964b..289ec54 100644
--- a/WebCore/platform/graphics/transforms/AffineTransform.h
+++ b/WebCore/platform/graphics/transforms/AffineTransform.h
@@ -36,6 +36,8 @@
#include <CoreGraphics/CGAffineTransform.h>
#elif PLATFORM(CAIRO)
#include <cairo.h>
+#elif PLATFORM(OPENVG)
+#include "VGUtils.h"
#elif PLATFORM(QT)
#include <QTransform>
#elif PLATFORM(SKIA)
@@ -158,6 +160,8 @@ public:
operator CGAffineTransform() const;
#elif PLATFORM(CAIRO)
operator cairo_matrix_t() const;
+#elif PLATFORM(OPENVG)
+ operator VGMatrix() const;
#elif PLATFORM(QT)
operator QTransform() const;
#elif PLATFORM(SKIA)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list