Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Krita
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tusooa Zhu
Krita
Commits
89d3203a
Commit
89d3203a
authored
Dec 19, 2009
by
Thomas Zander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move applyViewboxTransformation to the private
svn path=/trunk/koffice/; revision=1063864
parent
de4075a1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
33 deletions
+45
-33
libs/flake/KoConnectionShape.cpp
libs/flake/KoConnectionShape.cpp
+1
-0
libs/flake/KoConnectionShape_p.h
libs/flake/KoConnectionShape_p.h
+2
-0
libs/flake/KoPathShape.cpp
libs/flake/KoPathShape.cpp
+30
-27
libs/flake/KoPathShape.h
libs/flake/KoPathShape.h
+0
-2
libs/flake/KoPathShape_p.h
libs/flake/KoPathShape_p.h
+4
-0
libs/flake/KoShape.cpp
libs/flake/KoShape.cpp
+4
-1
libs/flake/KoShape_p.h
libs/flake/KoShape_p.h
+4
-3
No files found.
libs/flake/KoConnectionShape.cpp
View file @
89d3203a
...
...
@@ -49,6 +49,7 @@ KoConnectionShapePrivate::KoConnectionShapePrivate(KoConnectionShape *q)
QPointF
KoConnectionShapePrivate
::
escapeDirection
(
int
handleId
)
const
{
Q_Q
(
const
KoConnectionShape
);
QPointF
direction
;
if
(
handleConnected
(
handleId
))
{
QMatrix
absoluteMatrix
=
q
->
absoluteTransformation
(
0
);
...
...
libs/flake/KoConnectionShape_p.h
View file @
89d3203a
...
...
@@ -53,6 +53,8 @@ public:
int
connectionPointIndex2
;
KoConnectionShape
::
Type
connectionType
;
bool
forceUpdate
;
Q_DECLARE_PUBLIC
(
KoConnectionShape
)
};
#endif
libs/flake/KoPathShape.cpp
View file @
89d3203a
...
...
@@ -55,6 +55,34 @@ QRectF KoPathShapePrivate::handleRect(const QPointF &p, qreal radius) const
return
QRectF
(
p
.
x
()
-
radius
,
p
.
y
()
-
radius
,
2
*
radius
,
2
*
radius
);
}
void
KoPathShapePrivate
::
applyViewboxTransformation
(
const
KoXmlElement
&
element
)
{
Q_Q
(
KoPathShape
);
// apply viewbox transformation
QRectF
viewBox
=
q
->
loadOdfViewbox
(
element
);
if
(
!
viewBox
.
isEmpty
())
{
// load the desired size
QSizeF
size
;
size
.
setWidth
(
KoUnit
::
parseValue
(
element
.
attributeNS
(
KoXmlNS
::
svg
,
"width"
,
QString
())));
size
.
setHeight
(
KoUnit
::
parseValue
(
element
.
attributeNS
(
KoXmlNS
::
svg
,
"height"
,
QString
())));
// load the desired position
QPointF
pos
;
pos
.
setX
(
KoUnit
::
parseValue
(
element
.
attributeNS
(
KoXmlNS
::
svg
,
"x"
,
QString
())));
pos
.
setY
(
KoUnit
::
parseValue
(
element
.
attributeNS
(
KoXmlNS
::
svg
,
"y"
,
QString
())));
// create matrix to transform original path data into desired size and position
QMatrix
viewMatrix
;
viewMatrix
.
translate
(
-
viewBox
.
left
(),
-
viewBox
.
top
());
viewMatrix
.
scale
(
size
.
width
()
/
viewBox
.
width
(),
size
.
height
()
/
viewBox
.
height
());
viewMatrix
.
translate
(
pos
.
x
(),
pos
.
y
());
// transform the path data
q
->
map
(
viewMatrix
);
}
}
/////////////////////////
KoPathShape
::
KoPathShape
()
:
KoShape
(
*
(
new
KoPathShapePrivate
(
this
)))
...
...
@@ -85,6 +113,7 @@ void KoPathShape::saveOdf(KoShapeSavingContext & context) const
bool
KoPathShape
::
loadOdf
(
const
KoXmlElement
&
element
,
KoShapeLoadingContext
&
context
)
{
Q_D
(
KoPathShape
);
loadOdfAttributes
(
element
,
context
,
OdfMandatories
|
OdfAdditionalAttributes
|
OdfCommonChildElements
);
// first clear the path data from the default path
...
...
@@ -125,7 +154,7 @@ bool KoPathShape::loadOdf(const KoXmlElement & element, KoShapeLoadingContext &c
loadNodeTypes
(
element
);
}
applyViewboxTransformation
(
element
);
d
->
applyViewboxTransformation
(
element
);
QPointF
pos
=
normalize
();
setTransformation
(
QMatrix
());
...
...
@@ -189,32 +218,6 @@ QRectF KoPathShape::loadOdfViewbox(const KoXmlElement & element) const
return
viewbox
;
}
void
KoPathShape
::
applyViewboxTransformation
(
const
KoXmlElement
&
element
)
{
// apply viewbox transformation
QRectF
viewBox
=
loadOdfViewbox
(
element
);
if
(
!
viewBox
.
isEmpty
())
{
// load the desired size
QSizeF
size
;
size
.
setWidth
(
KoUnit
::
parseValue
(
element
.
attributeNS
(
KoXmlNS
::
svg
,
"width"
,
QString
())));
size
.
setHeight
(
KoUnit
::
parseValue
(
element
.
attributeNS
(
KoXmlNS
::
svg
,
"height"
,
QString
())));
// load the desired position
QPointF
pos
;
pos
.
setX
(
KoUnit
::
parseValue
(
element
.
attributeNS
(
KoXmlNS
::
svg
,
"x"
,
QString
())));
pos
.
setY
(
KoUnit
::
parseValue
(
element
.
attributeNS
(
KoXmlNS
::
svg
,
"y"
,
QString
())));
// create matrix to transform original path data into desired size and position
QMatrix
viewMatrix
;
viewMatrix
.
translate
(
-
viewBox
.
left
(),
-
viewBox
.
top
());
viewMatrix
.
scale
(
size
.
width
()
/
viewBox
.
width
(),
size
.
height
()
/
viewBox
.
height
());
viewMatrix
.
translate
(
pos
.
x
(),
pos
.
y
());
// transform the path data
map
(
viewMatrix
);
}
}
void
KoPathShape
::
clear
()
{
foreach
(
KoSubpath
*
subpath
,
m_subpaths
)
{
...
...
libs/flake/KoPathShape.h
View file @
89d3203a
...
...
@@ -489,8 +489,6 @@ protected:
/// Returns the viewbox from the given xml element.
QRectF
loadOdfViewbox
(
const
KoXmlElement
&
element
)
const
;
/// Applies the viewbox transformation defined in the given element
void
applyViewboxTransformation
(
const
KoXmlElement
&
element
);
/**
* @brief Saves the node types
...
...
libs/flake/KoPathShape_p.h
View file @
89d3203a
...
...
@@ -27,8 +27,12 @@ public:
KoPathShapePrivate
(
KoPathShape
*
q
);
QRectF
handleRect
(
const
QPointF
&
p
,
qreal
radius
)
const
;
/// Applies the viewbox transformation defined in the given element
void
applyViewboxTransformation
(
const
KoXmlElement
&
element
);
Qt
::
FillRule
fillRule
;
Q_DECLARE_PUBLIC
(
KoPathShape
)
};
#endif
libs/flake/KoShape.cpp
View file @
89d3203a
...
...
@@ -76,7 +76,7 @@ KoShapePrivate::KoShapePrivate(KoShape *shape)
appData
(
0
),
fill
(
0
),
border
(
0
),
q
(
shape
),
q
_ptr
(
shape
),
shadow
(
0
),
filterEffectStack
(
0
),
transparency
(
0.0
),
...
...
@@ -97,6 +97,7 @@ KoShapePrivate::KoShapePrivate(KoShape *shape)
KoShapePrivate
::~
KoShapePrivate
()
{
Q_Q
(
KoShape
);
if
(
parent
)
parent
->
removeChild
(
q
);
foreach
(
KoShapeManager
*
manager
,
shapeManagers
)
{
...
...
@@ -118,6 +119,7 @@ KoShapePrivate::~KoShapePrivate()
void
KoShapePrivate
::
shapeChanged
(
KoShape
::
ChangeType
type
)
{
Q_Q
(
KoShape
);
if
(
parent
)
parent
->
model
()
->
childChanged
(
q
,
type
);
q
->
shapeChanged
(
type
);
...
...
@@ -127,6 +129,7 @@ void KoShapePrivate::shapeChanged(KoShape::ChangeType type)
void
KoShapePrivate
::
updateBorder
()
{
Q_Q
(
KoShape
);
if
(
border
==
0
)
return
;
KoInsets
insets
;
...
...
libs/flake/KoShape_p.h
View file @
89d3203a
...
...
@@ -35,7 +35,6 @@ public:
void
addShapeManager
(
KoShapeManager
*
manager
);
void
removeShapeManager
(
KoShapeManager
*
manager
);
/// calls update on the shape where the border is.
void
updateBorder
();
...
...
@@ -53,7 +52,7 @@ public:
KoShapeApplicationData
*
appData
;
KoShapeBackground
*
fill
;
///< Stands for the background color / fill etc.
KoShapeBorderModel
*
border
;
///< points to a border, or 0 if there is no border
KoShape
*
q
;
KoShape
*
q
_ptr
;
QList
<
KoShape
*>
dependees
;
///< list of shape dependent on this shape
KoShapeShadow
*
shadow
;
///< the current shape shadow
QMap
<
QByteArray
,
QString
>
additionalAttributes
;
...
...
@@ -61,7 +60,7 @@ public:
QList
<
KoEventAction
*>
eventActions
;
///< list of event actions the shape has
KoFilterEffectStack
*
filterEffectStack
;
///< stack of filter effects applied to the shape
qreal
transparency
;
///< the shapes tranparency
static
const
int
MaxZIndex
=
32767
;
int
zIndex
:
16
;
// keep maxZIndex in sync!
int
visible
:
1
;
...
...
@@ -71,6 +70,8 @@ public:
int
selectable
:
1
;
int
detectCollision
:
1
;
int
protectContent
:
1
;
Q_DECLARE_PUBLIC
(
KoShape
)
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment