Commit efc82f1d authored by Dmitry Kazakov's avatar Dmitry Kazakov

Move coordinate system enum into a separate file to avoid duplications

parent ddd549d6
......@@ -49,8 +49,8 @@ struct Q_DECL_HIDDEN KoClipMask::Private {
}
CoordinateSystem coordinates = ObjectBoundingBox;
CoordinateSystem contentCoordinates = UserSpaceOnUse;
KoFlake::CoordinateSystem coordinates = KoFlake::ObjectBoundingBox;
KoFlake::CoordinateSystem contentCoordinates = KoFlake::UserSpaceOnUse;
QRectF maskRect = QRectF(-0.1, -0.1, 1.2, 1.2);
......@@ -78,22 +78,22 @@ KoClipMask *KoClipMask::clone() const
return new KoClipMask(*this);
}
KoClipMask::CoordinateSystem KoClipMask::coordinates() const
KoFlake::CoordinateSystem KoClipMask::coordinates() const
{
return m_d->coordinates;
}
void KoClipMask::setCoordinates(KoClipMask::CoordinateSystem value)
void KoClipMask::setCoordinates(KoFlake::CoordinateSystem value)
{
m_d->coordinates = value;
}
KoClipMask::CoordinateSystem KoClipMask::contentCoordinates() const
KoFlake::CoordinateSystem KoClipMask::contentCoordinates() const
{
return m_d->contentCoordinates;
}
void KoClipMask::setContentCoordinates(KoClipMask::CoordinateSystem value)
void KoClipMask::setContentCoordinates(KoFlake::CoordinateSystem value)
{
m_d->contentCoordinates = value;
}
......@@ -130,7 +130,7 @@ void KoClipMask::setExtraShapeOffset(const QPointF &value)
* into a group and apply this transform to the group instead
*/
if (m_d->contentCoordinates == UserSpaceOnUse) {
if (m_d->contentCoordinates == KoFlake::UserSpaceOnUse) {
const QTransform t = QTransform::fromTranslate(value.x(), value.y());
Q_FOREACH (KoShape *shape, m_d->shapes) {
......@@ -138,7 +138,7 @@ void KoClipMask::setExtraShapeOffset(const QPointF &value)
}
}
if (m_d->coordinates == UserSpaceOnUse) {
if (m_d->coordinates == KoFlake::UserSpaceOnUse) {
m_d->maskRect.translate(value);
}
}
......@@ -149,7 +149,7 @@ void KoClipMask::drawMask(QPainter *painter, KoShape *shape)
QPainterPath clipPathInShapeSpace;
if (m_d->coordinates == ObjectBoundingBox) {
if (m_d->coordinates == KoFlake::ObjectBoundingBox) {
QTransform relativeToShape = KisAlgebra2D::mapToRect(shape->outlineRect());
clipPathInShapeSpace.addPolygon(relativeToShape.map(m_d->maskRect));
} else {
......@@ -159,7 +159,7 @@ void KoClipMask::drawMask(QPainter *painter, KoShape *shape)
painter->setClipPath(clipPathInShapeSpace, Qt::IntersectClip);
if (m_d->contentCoordinates == ObjectBoundingBox) {
if (m_d->contentCoordinates == KoFlake::ObjectBoundingBox) {
QTransform relativeToShape = KisAlgebra2D::mapToRect(shape->outlineRect());
painter->setTransform(relativeToShape, true);
......
......@@ -21,6 +21,7 @@
#include "kritaflake_export.h"
#include <KoFlakeCoordinateSystem.h>
#include <QScopedPointer>
#include <QList>
......@@ -33,23 +34,17 @@ class QPainter;
class KRITAFLAKE_EXPORT KoClipMask
{
public:
enum CoordinateSystem {
UserSpaceOnUse,
ObjectBoundingBox
};
public:
KoClipMask();
~KoClipMask();
KoClipMask *clone() const;
CoordinateSystem coordinates() const;
void setCoordinates(CoordinateSystem value);
KoFlake::CoordinateSystem coordinates() const;
void setCoordinates(KoFlake::CoordinateSystem value);
CoordinateSystem contentCoordinates() const;
void setContentCoordinates(CoordinateSystem value);
KoFlake::CoordinateSystem contentCoordinates() const;
void setContentCoordinates(KoFlake::CoordinateSystem value);
QRectF maskRect() const;
void setMaskRect(const QRectF &value);
......
......@@ -108,12 +108,12 @@ public:
QList<KoShape*> shapes;
QPainterPath clipPath; ///< the compiled clip path in shape coordinates of the clipped shape
Qt::FillRule clipRule = Qt::WindingFill;
CoordinateSystem coordinates = ObjectBoundingBox;
KoFlake::CoordinateSystem coordinates = KoFlake::ObjectBoundingBox;
QTransform initialTransformToShape; ///< initial transformation to shape coordinates of the clipped shape
QSizeF initialShapeSize; ///< initial size of clipped shape
};
KoClipPath::KoClipPath(QList<KoShape*> clipShapes, KoClipPath::CoordinateSystem coordinates)
KoClipPath::KoClipPath(QList<KoShape*> clipShapes, KoFlake::CoordinateSystem coordinates)
: d(new Private())
{
d->shapes = clipShapes;
......@@ -145,10 +145,11 @@ Qt::FillRule KoClipPath::clipRule() const
return d->clipRule;
}
KoClipPath::CoordinateSystem KoClipPath::coordinates() const
KoFlake::CoordinateSystem KoClipPath::coordinates() const
{
return d->coordinates;
}
void KoClipPath::applyClipping(KoShape *clippedShape, QPainter &painter, const KoViewConverter &converter)
{
QPainterPath clipPath;
......@@ -159,7 +160,7 @@ void KoClipPath::applyClipping(KoShape *clippedShape, QPainter &painter, const K
QTransform t;
if (shape->clipPath()->coordinates() == ObjectBoundingBox) {
if (shape->clipPath()->coordinates() == KoFlake::ObjectBoundingBox) {
const QRectF shapeLocalBoundingRect = shape->outline().boundingRect();
t = KisAlgebra2D::mapToRect(shapeLocalBoundingRect) * shape->absoluteTransformation(0);
......
......@@ -25,6 +25,7 @@
#include <QScopedPointer>
#include <QList>
#include <qnamespace.h>
#include <KoFlakeCoordinateSystem.h>
class KoShape;
class KoPathShape;
......@@ -37,12 +38,6 @@ class QSizeF;
/// Clip path used to clip shapes
class KRITAFLAKE_EXPORT KoClipPath
{
public:
enum CoordinateSystem {
UserSpaceOnUse,
ObjectBoundingBox
};
public:
/**
......@@ -51,12 +46,12 @@ public:
* @param coordinates shows if ObjectBoundingBox or UserSpaceOnUse coordinate
* system is used.
*/
KoClipPath(QList<KoShape*> clipShapes, CoordinateSystem coordinates);
KoClipPath(QList<KoShape*> clipShapes, KoFlake::CoordinateSystem coordinates);
~KoClipPath();
KoClipPath *clone() const;
CoordinateSystem coordinates() const;
KoFlake::CoordinateSystem coordinates() const;
/// Sets the clip rule to be used for the clip path
void setClipRule(Qt::FillRule clipRule);
......
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KOFLAKECOORDINATE_SYSTEM_H
#define KOFLAKECOORDINATE_SYSTEM_H
#include <QString>
namespace KoFlake {
enum CoordinateSystem {
UserSpaceOnUse,
ObjectBoundingBox
};
inline CoordinateSystem coordinatesFromString(const QString &value, CoordinateSystem defaultValue)
{
CoordinateSystem result = defaultValue;
if (value == "userSpaceOnUse") {
result = UserSpaceOnUse;
} else if (value == "objectBoundingBox") {
result = ObjectBoundingBox;
}
return result;
}
inline QString coordinateToString(CoordinateSystem value)
{
return
value == ObjectBoundingBox?
"objectBoundingBox" :
"userSpaceOnUse";
}
}
#endif // KOFLAKECOORDINATE_SYSTEM_H
......@@ -1844,7 +1844,7 @@ void KoShape::loadOdfClipContour(const KoXmlElement &element, KoShapeLoadingCont
ps->loadContourOdf(child, context, scaleFactor);
ps->setTransformation(transformation());
KoClipPath *clipPath = new KoClipPath({ps}, KoClipPath::UserSpaceOnUse);
KoClipPath *clipPath = new KoClipPath({ps}, KoFlake::UserSpaceOnUse);
d->clipPath.reset(clipPath);
}
}
......
......@@ -39,10 +39,10 @@ public:
}
QList<KoShape*> shapes;
KoVectorPatternBackground::CoordinateSystem referenceCoordinates =
KoVectorPatternBackground::ObjectBoundingBox;
KoVectorPatternBackground::CoordinateSystem contentCoordinates =
KoVectorPatternBackground::UserSpaceOnUse;
KoFlake::CoordinateSystem referenceCoordinates =
KoFlake::ObjectBoundingBox;
KoFlake::CoordinateSystem contentCoordinates =
KoFlake::UserSpaceOnUse;
QRectF referenceRect;
QTransform patternTransform;
};
......@@ -57,25 +57,25 @@ KoVectorPatternBackground::~KoVectorPatternBackground()
}
void KoVectorPatternBackground::setReferenceCoordinates(CoordinateSystem value)
void KoVectorPatternBackground::setReferenceCoordinates(KoFlake::CoordinateSystem value)
{
Q_D(KoVectorPatternBackground);
d->referenceCoordinates = value;
}
KoVectorPatternBackground::CoordinateSystem KoVectorPatternBackground::referenceCoordinates() const
KoFlake::CoordinateSystem KoVectorPatternBackground::referenceCoordinates() const
{
Q_D(const KoVectorPatternBackground);
return d->referenceCoordinates;
}
void KoVectorPatternBackground::setContentCoordinates(CoordinateSystem value)
void KoVectorPatternBackground::setContentCoordinates(KoFlake::CoordinateSystem value)
{
Q_D(KoVectorPatternBackground);
d->contentCoordinates = value;
}
KoVectorPatternBackground::CoordinateSystem KoVectorPatternBackground::contentCoordinates() const
KoFlake::CoordinateSystem KoVectorPatternBackground::contentCoordinates() const
{
Q_D(const KoVectorPatternBackground);
return d->contentCoordinates;
......@@ -133,9 +133,9 @@ void KoVectorPatternBackground::paint(QPainter &painter, const KoViewConverter &
KoBakedShapeRenderer renderer(dstShapeOutline, QTransform(),
QTransform(),
d->referenceRect,
d->contentCoordinates != UserSpaceOnUse,
d->contentCoordinates != KoFlake::UserSpaceOnUse,
dstShapeBoundingBox,
d->referenceCoordinates != UserSpaceOnUse,
d->referenceCoordinates != KoFlake::UserSpaceOnUse,
d->patternTransform);
QPainter *patchPainter = renderer.bakeShapePainter();
......
......@@ -20,6 +20,7 @@
#define KOVECTORPATTERNBACKGROUND_H
#include <KoShapeBackground.h>
#include <KoFlakeCoordinateSystem.h>
class KoShape;
class QPointF;
......@@ -30,24 +31,18 @@ class KoVectorPatternBackgroundPrivate;
class KoVectorPatternBackground : public KoShapeBackground
{
public:
enum CoordinateSystem {
UserSpaceOnUse,
ObjectBoundingBox
};
public:
KoVectorPatternBackground();
~KoVectorPatternBackground();
void setReferenceCoordinates(CoordinateSystem value);
CoordinateSystem referenceCoordinates() const;
void setReferenceCoordinates(KoFlake::CoordinateSystem value);
KoFlake::CoordinateSystem referenceCoordinates() const;
/**
* In ViewBox just use the same mode as for referenceCoordinates
*/
void setContentCoordinates(CoordinateSystem value);
CoordinateSystem contentCoordinates() const;
void setContentCoordinates(KoFlake::CoordinateSystem value);
KoFlake::CoordinateSystem contentCoordinates() const;
void setReferenceRect(const QRectF &value);
QRectF referenceRect() const;
......
......@@ -60,7 +60,7 @@ KoShapeClipCommand::KoShapeClipCommand(KoShapeBasedDocumentBase *controller, con
Q_FOREACH (KoShape *shape, d->shapesToClip) {
d->oldClipPaths.append(shape->clipPath());
d->newClipPaths.append(new KoClipPath(implicitCastList<KoShape*>(clipPathShapes), KoClipPath::UserSpaceOnUse));
d->newClipPaths.append(new KoClipPath(implicitCastList<KoShape*>(clipPathShapes), KoFlake::UserSpaceOnUse));
}
Q_FOREACH (KoPathShape *path, clipPathShapes) {
......@@ -76,7 +76,7 @@ KoShapeClipCommand::KoShapeClipCommand(KoShapeBasedDocumentBase *controller, KoS
d->shapesToClip.append(shape);
d->clipPathShapes = clipPathShapes;
d->oldClipPaths.append(shape->clipPath());
d->newClipPaths.append(new KoClipPath(implicitCastList<KoShape*>(clipPathShapes), KoClipPath::UserSpaceOnUse));
d->newClipPaths.append(new KoClipPath(implicitCastList<KoShape*>(clipPathShapes), KoFlake::UserSpaceOnUse));
Q_FOREACH (KoPathShape *path, clipPathShapes) {
d->oldParents.append(path->parent());
......
......@@ -20,7 +20,7 @@
#include "SvgClipPathHelper.h"
SvgClipPathHelper::SvgClipPathHelper()
: m_clipPathUnits(UserSpaceOnUse) // default as per svg spec
: m_clipPathUnits(KoFlake::UserSpaceOnUse) // default as per svg spec
{
}
......@@ -28,12 +28,12 @@ SvgClipPathHelper::~SvgClipPathHelper()
{
}
void SvgClipPathHelper::setClipPathUnits(Units clipPathUnits)
void SvgClipPathHelper::setClipPathUnits(KoFlake::CoordinateSystem clipPathUnits)
{
m_clipPathUnits = clipPathUnits;
}
SvgClipPathHelper::Units SvgClipPathHelper::clipPathUnits() const
KoFlake::CoordinateSystem SvgClipPathHelper::clipPathUnits() const
{
return m_clipPathUnits;
}
......
......@@ -20,6 +20,7 @@
#ifndef SVGCLIPPATHHELPER_H
#define SVGCLIPPATHHELPER_H
#include <KoFlakeCoordinateSystem.h>
#include <QList>
class KoShape;
......@@ -27,15 +28,13 @@ class KoShape;
class SvgClipPathHelper
{
public:
enum Units { UserSpaceOnUse, ObjectBoundingBox };
SvgClipPathHelper();
~SvgClipPathHelper();
/// Set the clip path units type
void setClipPathUnits(Units clipPathUnits);
void setClipPathUnits(KoFlake::CoordinateSystem clipPathUnits);
/// Returns the clip path units type
Units clipPathUnits() const;
KoFlake::CoordinateSystem clipPathUnits() const;
QList<KoShape *> shapes() const;
void setShapes(const QList<KoShape *> &shapes);
......@@ -43,7 +42,7 @@ public:
bool isEmpty() const;
private:
Units m_clipPathUnits;
KoFlake::CoordinateSystem m_clipPathUnits;
QList<KoShape*> m_shapes;
};
......
......@@ -21,8 +21,8 @@
#include "SvgUtil.h"
SvgFilterHelper::SvgFilterHelper()
: m_filterUnits(ObjectBoundingBox) // default as per svg spec
, m_primitiveUnits(UserSpaceOnUse) // default as per svg spec
: m_filterUnits(KoFlake::ObjectBoundingBox) // default as per svg spec
, m_primitiveUnits(KoFlake::UserSpaceOnUse) // default as per svg spec
, m_position(-0.1, -0.1) // default as per svg spec
, m_size(1.2, 1.2) // default as per svg spec
{
......@@ -32,22 +32,22 @@ SvgFilterHelper::~SvgFilterHelper()
{
}
void SvgFilterHelper::setFilterUnits(Units filterUnits)
void SvgFilterHelper::setFilterUnits(KoFlake::CoordinateSystem filterUnits)
{
m_filterUnits = filterUnits;
}
SvgFilterHelper::Units SvgFilterHelper::filterUnits() const
KoFlake::CoordinateSystem SvgFilterHelper::filterUnits() const
{
return m_filterUnits;
}
void SvgFilterHelper::setPrimitiveUnits(Units primitiveUnits)
void SvgFilterHelper::setPrimitiveUnits(KoFlake::CoordinateSystem primitiveUnits)
{
m_primitiveUnits = primitiveUnits;
}
SvgFilterHelper::Units SvgFilterHelper::primitiveUnits() const
KoFlake::CoordinateSystem SvgFilterHelper::primitiveUnits() const
{
return m_primitiveUnits;
}
......@@ -59,7 +59,7 @@ void SvgFilterHelper::setPosition(const QPointF & position)
QPointF SvgFilterHelper::position(const QRectF & objectBound) const
{
if (m_filterUnits == UserSpaceOnUse) {
if (m_filterUnits == KoFlake::UserSpaceOnUse) {
return m_position;
} else {
return SvgUtil::objectToUserSpace(m_position, objectBound);
......@@ -73,7 +73,7 @@ void SvgFilterHelper::setSize(const QSizeF & size)
QSizeF SvgFilterHelper::size(const QRectF & objectBound) const
{
if (m_filterUnits == UserSpaceOnUse) {
if (m_filterUnits == KoFlake::UserSpaceOnUse) {
return m_size;
} else {
return SvgUtil::objectToUserSpace(m_size, objectBound);
......
......@@ -23,6 +23,7 @@
#include <QSizeF>
#include <QPointF>
#include <KoFlakeCoordinateSystem.h>
#include <KoXmlReader.h>
class QRectF;
......@@ -30,20 +31,18 @@ class QRectF;
class SvgFilterHelper
{
public:
enum Units { UserSpaceOnUse, ObjectBoundingBox };
SvgFilterHelper();
~SvgFilterHelper();
/// Set the filter units type
void setFilterUnits(Units filterUnits);
void setFilterUnits(KoFlake::CoordinateSystem filterUnits);
/// Returns the filter units type
Units filterUnits() const;
KoFlake::CoordinateSystem filterUnits() const;
/// Set the filter primitive units type
void setPrimitiveUnits(Units primitiveUnits);
void setPrimitiveUnits(KoFlake::CoordinateSystem primitiveUnits);
/// Returns the filter primitive units type
Units primitiveUnits() const;
KoFlake::CoordinateSystem primitiveUnits() const;
/// Sets filter position
void setPosition(const QPointF & position);
......@@ -63,8 +62,8 @@ public:
static QPointF toUserSpace(const QPointF &position, const QRectF &objectBound);
static QSizeF toUserSpace(const QSizeF &size, const QRectF &objectBound);
private:
Units m_filterUnits;
Units m_primitiveUnits;
KoFlake::CoordinateSystem m_filterUnits;
KoFlake::CoordinateSystem m_primitiveUnits;
QPointF m_position;
QSizeF m_size;
KoXmlElement m_filterContent;
......
......@@ -28,7 +28,7 @@
#include <KoFlake.h>
SvgGradientHelper::SvgGradientHelper()
: m_gradient(new QGradient()), m_gradientUnits(ObjectBoundingBox)
: m_gradient(new QGradient()), m_gradientUnits(KoFlake::ObjectBoundingBox)
{
}
......@@ -38,7 +38,7 @@ SvgGradientHelper::~SvgGradientHelper()
}
SvgGradientHelper::SvgGradientHelper(const SvgGradientHelper &other)
: m_gradient(0), m_gradientUnits(ObjectBoundingBox)
: m_gradient(0), m_gradientUnits(KoFlake::ObjectBoundingBox)
{
m_gradientUnits = other.m_gradientUnits;
m_gradientTransform = other.m_gradientTransform;
......@@ -57,12 +57,12 @@ SvgGradientHelper & SvgGradientHelper::operator = (const SvgGradientHelper & rhs
return *this;
}
void SvgGradientHelper::setGradientUnits(Units units)
void SvgGradientHelper::setGradientUnits(KoFlake::CoordinateSystem units)
{
m_gradientUnits = units;
}
SvgGradientHelper::Units SvgGradientHelper::gradientUnits() const
KoFlake::CoordinateSystem SvgGradientHelper::gradientUnits() const
{
return m_gradientUnits;
}
......
......@@ -21,23 +21,22 @@
#ifndef SVGGRADIENTHELPER_H
#define SVGGRADIENTHELPER_H
#include <KoFlakeCoordinateSystem.h>
#include <QTransform>
#include <QGradient>
class SvgGradientHelper
{
public:
enum Units { UserSpaceOnUse, ObjectBoundingBox };
SvgGradientHelper();
~SvgGradientHelper();
/// Copy constructor
SvgGradientHelper(const SvgGradientHelper &other);
/// Sets the gradient units type
void setGradientUnits(Units units);
void setGradientUnits(KoFlake::CoordinateSystem units);
/// Returns gradient units type
Units gradientUnits() const;
KoFlake::CoordinateSystem gradientUnits() const;
/// Sets the gradient
void setGradient(QGradient * g);
......@@ -63,7 +62,7 @@ public:
private:
QGradient * m_gradient;
Units m_gradientUnits;
KoFlake::CoordinateSystem m_gradientUnits;
QTransform m_gradientTransform;
QGradient::Spread m_spreadMode;
};
......
......@@ -239,7 +239,7 @@ SvgGradientHelper* SvgParser::parseGradient(const KoXmlElement &e)
const QGradientStops defaultStops = gradHelper.gradient()->stops();
if (e.attribute("gradientUnits") == "userSpaceOnUse") {
gradHelper.setGradientUnits(SvgGradientHelper::UserSpaceOnUse);
gradHelper.setGradientUnits(KoFlake::UserSpaceOnUse);
}
m_context.pushGraphicsContext(e);
......@@ -247,7 +247,7 @@ SvgGradientHelper* SvgParser::parseGradient(const KoXmlElement &e)
if (e.tagName() == "linearGradient") {
QLinearGradient *g = new QLinearGradient();
if (gradHelper.gradientUnits() == SvgGradientHelper::ObjectBoundingBox) {
if (gradHelper.gradientUnits() == KoFlake::ObjectBoundingBox) {
g->setCoordinateMode(QGradient::ObjectBoundingMode);
g->setStart(QPointF(SvgUtil::fromPercentage(e.attribute("x1", "0%")),
SvgUtil::fromPercentage(e.attribute("y1", "0%"))));
......@@ -263,7 +263,7 @@ SvgGradientHelper* SvgParser::parseGradient(const KoXmlElement &e)
} else if (e.tagName() == "radialGradient") {
QRadialGradient *g = new QRadialGradient();
if (gradHelper.gradientUnits() == SvgGradientHelper::ObjectBoundingBox) {
if (gradHelper.gradientUnits() == KoFlake::ObjectBoundingBox) {
g->setCoordinateMode(QGradient::ObjectBoundingMode);
g->setCenter(QPointF(SvgUtil::fromPercentage(e.attribute("cx", "50%")),
SvgUtil::fromPercentage(e.attribute("cy", "50%"))));
......@@ -312,20 +312,6 @@ SvgGradientHelper* SvgParser::parseGradient(const KoXmlElement &e)
return &m_gradients[gradientId];
}
KoVectorPatternBackground::CoordinateSystem
parseUnits(const QString &value, KoVectorPatternBackground::CoordinateSystem defaultValue)
{
KoVectorPatternBackground::CoordinateSystem result = defaultValue;
if (value == "userSpaceOnUse") {
result = KoVectorPatternBackground::UserSpaceOnUse;
} else if (value == "objectBoundingBox") {
result = KoVectorPatternBackground::ObjectBoundingBox;
}
return result;
}
inline QPointF bakeShapeOffset(const QTransform &patternTransform, const QPointF &shapeOffset)
{
QTransform result =
......@@ -369,12 +355,12 @@ QSharedPointer<KoVectorPatternBackground> SvgParser::parsePattern(const KoXmlEle
}
pattHelper->setReferenceCoordinates(
parseUnits(e.attribute("patternUnits"),
pattHelper->referenceCoordinates()));
KoFlake::coordinatesFromString(e.attribute("patternUnits"),
pattHelper->referenceCoordinates()));
pattHelper->setContentCoordinates(
parseUnits(e.attribute("patternContentUnits"),
pattHelper->contentCoordinates()));
KoFlake::coordinatesFromString(e.attribute("patternContentUnits"),
pattHelper->contentCoordinates()));
if (e.hasAttribute("patternTransform")) {
SvgTransformParser p(e.attribute("patternTransform"));
......@@ -383,7 +369,7 @@ QSharedPointer<KoVectorPatternBackground> SvgParser::parsePattern(const KoXmlEle
}
}
if (pattHelper->referenceCoordinates() == KoVectorPatternBackground::ObjectBoundingBox) {
if (pattHelper->referenceCoordinates() == KoFlake::ObjectBoundingBox) {
QRectF referenceRect(
SvgUtil::fromPercentage(e.attribute("x", "0%")),
SvgUtil::fromPercentage(e.attribute("y", "0%")),
......@@ -436,14 +422,14 @@ QSharedPointer<KoVectorPatternBackground> SvgParser::parsePattern(const KoXmlEle
// into SVG
if (e.hasAttribute("viewBox")) {
gc->currentBoundingBox =
pattHelper->referenceCoordinates() == KoVectorPatternBackground::ObjectBoundingBox ?
pattHelper->referenceCoordinates() == KoFlake::ObjectBoundingBox ?
relativeToShape.mapRect(pattHelper->referenceRect()) :
pattHelper->referenceRect();
applyViewBoxTransform(e);
pattHelper->setContentCoordinates(pattHelper->referenceCoordinates());
} else if (pattHelper->contentCoordinates() == KoVectorPatternBackground::ObjectBoundingBox) {
} else if (pattHelper->contentCoordinates() == KoFlake::ObjectBoundingBox) {
gc->matrix = relativeToShape * gc->matrix;
}
......@@ -452,7 +438,7 @@ QSharedPointer<KoVectorPatternBackground> SvgParser::parsePattern(const KoXmlEle
QList<KoShape*> patternShapes = parseContainer(e);
if (pattHelper->contentCoordinates() == KoVectorPatternBackground::UserSpaceOnUse) {
if (pattHelper->contentCoordinates() == KoFlake::UserSpaceOnUse) {
// In Krita we normalize the shapes, bake this transform into the pattern shapes
const QPointF offset = bakeShapeOffset(pattHelper->patternTransform(), extraShapeOffset);
......@@ -462,7 +448,7 @@ QSharedPointer<KoVectorPatternBackground> SvgParser::parsePattern(const KoXmlEle
}
}
if (pattHelper->referenceCoordinates() == KoVectorPatternBackground::UserSpaceOnUse) {
if (pattHelper->referenceCoordinates() == KoFlake::UserSpaceOnUse) {