Reviewed by andersca.
- Small ammount of bindings-related code cleanup.
+ Small amount of svg-related code cleanup.
+ No test case possible.
+
+ * ksvg2/svg/SVGColor.h:
+ * ksvg2/svg/SVGLength.cpp:
+ (SVGLength::SVGLength):
+ (SVGLength::value):
+ * ksvg2/svg/SVGMarkerElement.cpp:
+ * ksvg2/svg/SVGMatrix.cpp:
+ (SVGMatrix::SVGMatrix):
+ (SVGMatrix::copy):
+ (SVGMatrix::postMultiply):
+ (SVGMatrix::inverse):
+ (SVGMatrix::postTranslate):
+ (SVGMatrix::postScale):
+ (SVGMatrix::postScaleNonUniform):
+ (SVGMatrix::postRotate):
+ (SVGMatrix::postRotateFromVector):
+ (SVGMatrix::postFlipX):
+ (SVGMatrix::postFlipY):
+ (SVGMatrix::postSkewX):
+ (SVGMatrix::postSkewY):
+ (SVGMatrix::multiply):
+ (SVGMatrix::translate):
+ (SVGMatrix::scale):
+ (SVGMatrix::scaleNonUniform):
+ (SVGMatrix::rotate):
+ (SVGMatrix::rotateFromVector):
+ (SVGMatrix::flipX):
+ (SVGMatrix::flipY):
+ (SVGMatrix::skewX):
+ (SVGMatrix::skewY):
+ (SVGMatrix::setMatrix):
+ (SVGMatrix::qmatrix):
+ (SVGMatrix::removeScale):
+ * ksvg2/svg/SVGMatrix.h:
+
+2006-05-30 Eric Seidel <eric@eseidel.com>
+
+ Reviewed by andersca.
+
+ Small amount of bindings-related code cleanup.
No test case possible.
* bindings/js/JSHTMLFormElementCustom.cpp:
virtual String cssText() const;
// Helpers
- const Color &color() const;
+ const Color& color() const;
- private:
+ private:
Color m_qColor;
unsigned short m_colorType;
String m_rgbColor;
"pc"
};
-SVGLength::SVGLength(const SVGStyledElement *context, LengthMode mode, const SVGElement *viewport) : Shared<SVGLength>()
+SVGLength::SVGLength(const SVGStyledElement *context, LengthMode mode, const SVGElement *viewport)
+ : Shared<SVGLength>()
+ , m_value(0)
+ , m_valueInSpecifiedUnits(0)
+ , m_mode(mode)
+ , m_bboxRelative(false)
+ , m_unitType(SVG_LENGTHTYPE_UNKNOWN)
+ , m_requiresLayout(false)
+ , m_context(context)
+ , m_viewportElement(viewport)
{
- m_mode = mode;
- m_context = context;
- m_viewportElement = viewport;
-
- m_value = 0;
- m_valueInSpecifiedUnits = 0;
-
- m_bboxRelative = false;
- m_unitType = SVG_LENGTHTYPE_UNKNOWN;
-
- m_requiresLayout = false;
}
SVGLength::~SVGLength()
if (m_requiresLayout)
const_cast<SVGLength*>(this)->updateValue(false);
- if(m_unitType != SVG_LENGTHTYPE_PERCENTAGE)
+ if (m_unitType != SVG_LENGTHTYPE_PERCENTAGE)
return m_value;
float value = m_valueInSpecifiedUnits / 100.0;
- if(m_bboxRelative)
+ if (m_bboxRelative)
return value;
// Use the manual override "m_viewportElement" when there is no context element off of which to establish the viewport.
#include "SVGAnimatedLength.h"
#include "SVGFitToViewBox.h"
#include "SVGHelper.h"
-#include "SVGLength.h"
#include "SVGMatrix.h"
#include "SVGNames.h"
#include "SVGSVGElement.h"
{
}
-SVGMatrix::SVGMatrix(QMatrix mat) : Shared<SVGMatrix>()
+SVGMatrix::SVGMatrix(const QMatrix& mat)
+ : Shared<SVGMatrix>()
+ , m_mat(mat)
{
- m_mat = mat;
}
SVGMatrix::SVGMatrix(double a, double b, double c, double d, double e, double f) : Shared<SVGMatrix>()
return m_mat.dy();
}
-void SVGMatrix::copy(const SVGMatrix *other)
+void SVGMatrix::copy(const SVGMatrix* other)
{
m_mat.setMatrix(other->m_mat.m11(), other->m_mat.m12(), other->m_mat.m21(), other->m_mat.m22(), other->m_mat.dx(), other->m_mat.dy());
}
-SVGMatrix *SVGMatrix::postMultiply(const SVGMatrix *secondMatrix)
+SVGMatrix* SVGMatrix::postMultiply(const SVGMatrix* secondMatrix)
{
QMatrix temp(secondMatrix->a(), secondMatrix->b(), secondMatrix->c(), secondMatrix->d(), secondMatrix->e(), secondMatrix->f());
m_mat *= temp;
return this;
}
-SVGMatrix *SVGMatrix::inverse()
+SVGMatrix* SVGMatrix::inverse()
{
m_mat = m_mat.invert();
return this;
}
-SVGMatrix *SVGMatrix::postTranslate(double x, double y)
+SVGMatrix* SVGMatrix::postTranslate(double x, double y)
{
// Could optimise these.
QMatrix temp;
return this;
}
-SVGMatrix *SVGMatrix::postScale(double scaleFactor)
+SVGMatrix* SVGMatrix::postScale(double scaleFactor)
{
QMatrix temp;
temp.scale(scaleFactor, scaleFactor);
return this;
}
-SVGMatrix *SVGMatrix::postScaleNonUniform(double scaleFactorX, double scaleFactorY)
+SVGMatrix* SVGMatrix::postScaleNonUniform(double scaleFactorX, double scaleFactorY)
{
QMatrix temp;
temp.scale(scaleFactorX, scaleFactorY);
return this;
}
-SVGMatrix *SVGMatrix::postRotate(double angle)
+SVGMatrix* SVGMatrix::postRotate(double angle)
{
QMatrix temp;
temp.rotate(angle);
return this;
}
-SVGMatrix *SVGMatrix::postRotateFromVector(double x, double y)
+SVGMatrix* SVGMatrix::postRotateFromVector(double x, double y)
{
QMatrix temp;
temp.rotate(SVGAngle::todeg(atan2(y, x)));
return this;
}
-SVGMatrix *SVGMatrix::postFlipX()
+SVGMatrix* SVGMatrix::postFlipX()
{
QMatrix temp(-1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F);
m_mat *= temp;
return this;
}
-SVGMatrix *SVGMatrix::postFlipY()
+SVGMatrix* SVGMatrix::postFlipY()
{
QMatrix temp(1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F);
m_mat *= temp;
return this;
}
-SVGMatrix *SVGMatrix::postSkewX(double angle)
+SVGMatrix* SVGMatrix::postSkewX(double angle)
{
QMatrix temp;
temp.shear(tan(SVGAngle::torad(angle)), 0.0F);
return this;
}
-SVGMatrix *SVGMatrix::postSkewY(double angle)
+SVGMatrix* SVGMatrix::postSkewY(double angle)
{
QMatrix temp;
temp.shear(0.0F, tan(SVGAngle::torad(angle)));
return this;
}
-SVGMatrix *SVGMatrix::multiply(const SVGMatrix *secondMatrix)
+SVGMatrix* SVGMatrix::multiply(const SVGMatrix* secondMatrix)
{
QMatrix temp(secondMatrix->a(), secondMatrix->b(), secondMatrix->c(), secondMatrix->d(), secondMatrix->e(), secondMatrix->f());
temp *= m_mat;
return this;
}
-SVGMatrix *SVGMatrix::translate(double x, double y)
+SVGMatrix* SVGMatrix::translate(double x, double y)
{
m_mat.translate(x, y);
return this;
}
-SVGMatrix *SVGMatrix::scale(double scaleFactor)
+SVGMatrix* SVGMatrix::scale(double scaleFactor)
{
m_mat.scale(scaleFactor, scaleFactor);
return this;
}
-SVGMatrix *SVGMatrix::scaleNonUniform(double scaleFactorX, double scaleFactorY)
+SVGMatrix* SVGMatrix::scaleNonUniform(double scaleFactorX, double scaleFactorY)
{
m_mat.scale(scaleFactorX, scaleFactorY);
return this;
}
-SVGMatrix *SVGMatrix::rotate(double angle)
+SVGMatrix* SVGMatrix::rotate(double angle)
{
m_mat.rotate(angle);
return this;
}
-SVGMatrix *SVGMatrix::rotateFromVector(double x, double y)
+SVGMatrix* SVGMatrix::rotateFromVector(double x, double y)
{
m_mat.rotate(SVGAngle::todeg(atan2(y, x)));
return this;
}
-SVGMatrix *SVGMatrix::flipX()
+SVGMatrix* SVGMatrix::flipX()
{
m_mat.scale(-1.0f, 1.0f);
return this;
}
-SVGMatrix *SVGMatrix::flipY()
+SVGMatrix* SVGMatrix::flipY()
{
m_mat.scale(1.0f, -1.0f);
return this;
}
-SVGMatrix *SVGMatrix::skewX(double angle)
+SVGMatrix* SVGMatrix::skewX(double angle)
{
m_mat.shear(tan(SVGAngle::torad(angle)), 0.0F);
return this;
}
-SVGMatrix *SVGMatrix::skewY(double angle)
+SVGMatrix* SVGMatrix::skewY(double angle)
{
m_mat.shear(0.0F, tan(SVGAngle::torad(angle)));
return this;
}
-void SVGMatrix::setMatrix(QMatrix mat)
+void SVGMatrix::setMatrix(const QMatrix& mat)
{
m_mat = mat;
}
-QMatrix &SVGMatrix::qmatrix()
+QMatrix& SVGMatrix::qmatrix()
{
return m_mat;
}
-const QMatrix &SVGMatrix::qmatrix() const
+const QMatrix& SVGMatrix::qmatrix() const
{
return m_mat;
}
m_mat.reset();
}
-void SVGMatrix::removeScale(double *xScale, double *yScale)
+void SVGMatrix::removeScale(double* xScale, double* yScale)
{
double sx = sqrt(a() * a() + b() * b());
double sy = sqrt(c() * c() + d() * d());
public:
SVGMatrix();
SVGMatrix(double a, double b, double c, double d, double e, double f);
- SVGMatrix(QMatrix mat);
+ SVGMatrix(const QMatrix& mat);
virtual ~SVGMatrix();
- void setA(double a);
+ void setA(double);
double a() const;
- void setB(double b);
+ void setB(double);
double b() const;
- void setC(double c);
+ void setC(double);
double c() const;
- void setD(double d);
+ void setD(double);
double d() const;
- void setE(double e);
+ void setE(double);
double e() const;
- void setF(double f);
+ void setF(double);
double f() const;
- void copy(const SVGMatrix *other);
+ void copy(const SVGMatrix*);
- SVGMatrix *inverse();
+ SVGMatrix* inverse();
// Pre-multiplied operations, as per the specs.
- SVGMatrix *multiply(const SVGMatrix *secondMatrix);
- SVGMatrix *translate(double x, double y);
- SVGMatrix *scale(double scaleFactor);
- SVGMatrix *scaleNonUniform(double scaleFactorX, double scaleFactorY);
- SVGMatrix *rotate(double angle);
- SVGMatrix *rotateFromVector(double x, double y);
- SVGMatrix *flipX();
- SVGMatrix *flipY();
- SVGMatrix *skewX(double angle);
- SVGMatrix *skewY(double angle);
+ SVGMatrix* multiply(const SVGMatrix*);
+ SVGMatrix* translate(double x, double y);
+ SVGMatrix* scale(double scaleFactor);
+ SVGMatrix* scaleNonUniform(double scaleFactorX, double scaleFactorY);
+ SVGMatrix* rotate(double angle);
+ SVGMatrix* rotateFromVector(double x, double y);
+ SVGMatrix* flipX();
+ SVGMatrix* flipY();
+ SVGMatrix* skewX(double angle);
+ SVGMatrix* skewY(double angle);
// Post-multiplied operations
- SVGMatrix *postMultiply(const SVGMatrix *secondMatrix);
- SVGMatrix *postTranslate(double x, double y);
- SVGMatrix *postScale(double scaleFactor);
- SVGMatrix *postScaleNonUniform(double scaleFactorX, double scaleFactorY);
- SVGMatrix *postRotate(double angle);
- SVGMatrix *postRotateFromVector(double x, double y);
- SVGMatrix *postFlipX();
- SVGMatrix *postFlipY();
- SVGMatrix *postSkewX(double angle);
- SVGMatrix *postSkewY(double angle);
+ SVGMatrix* postMultiply(const SVGMatrix*);
+ SVGMatrix* postTranslate(double x, double y);
+ SVGMatrix* postScale(double scaleFactor);
+ SVGMatrix* postScaleNonUniform(double scaleFactorX, double scaleFactorY);
+ SVGMatrix* postRotate(double angle);
+ SVGMatrix* postRotateFromVector(double x, double y);
+ SVGMatrix* postFlipX();
+ SVGMatrix* postFlipY();
+ SVGMatrix* postSkewX(double angle);
+ SVGMatrix* postSkewY(double angle);
void reset();
// KSVG helper method
- QMatrix &qmatrix();
- const QMatrix &qmatrix() const;
+ QMatrix& qmatrix();
+ const QMatrix& qmatrix() const;
// Determine the scaling component of the matrix and factor it out. After
// this operation, the matrix has x and y scale of one.
- void removeScale(double *xScale, double *yScale);
+ void removeScale(double* xScale, double* yScale);
private:
- void setMatrix(QMatrix mat);
+ void setMatrix(const QMatrix&);
QMatrix m_mat;
};
};