Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
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
MyCard
magicseteditor
Commits
a39c53ba
Commit
a39c53ba
authored
Aug 03, 2010
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(minor) use getAngle() instead of trAngle(0)
parent
4578cae7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
src/render/value/choice.cpp
src/render/value/choice.cpp
+1
-1
src/util/rotation.cpp
src/util/rotation.cpp
+9
-0
src/util/rotation.hpp
src/util/rotation.hpp
+2
-0
No files found.
src/render/value/choice.cpp
View file @
a39c53ba
...
@@ -110,7 +110,7 @@ void draw_choice_viewer(RotatedDC& dc, ValueViewer& viewer, ChoiceStyle& style,
...
@@ -110,7 +110,7 @@ void draw_choice_viewer(RotatedDC& dc, ValueViewer& viewer, ChoiceStyle& style,
void
get_options
(
Rotation
&
rot
,
ValueViewer
&
viewer
,
const
ChoiceStyle
&
style
,
GeneratedImage
::
Options
&
opts
)
{
void
get_options
(
Rotation
&
rot
,
ValueViewer
&
viewer
,
const
ChoiceStyle
&
style
,
GeneratedImage
::
Options
&
opts
)
{
opts
.
package
=
&
viewer
.
getStylePackage
();
opts
.
package
=
&
viewer
.
getStylePackage
();
opts
.
local_package
=
&
viewer
.
getLocalPackage
();
opts
.
local_package
=
&
viewer
.
getLocalPackage
();
opts
.
angle
=
rot
.
trAngle
(
0
);
opts
.
angle
=
rot
.
getAngle
(
);
if
(
viewer
.
nativeLook
())
{
if
(
viewer
.
nativeLook
())
{
opts
.
width
=
opts
.
height
=
16
;
opts
.
width
=
opts
.
height
=
16
;
opts
.
preserve_aspect
=
ASPECT_BORDER
;
opts
.
preserve_aspect
=
ASPECT_BORDER
;
...
...
src/util/rotation.cpp
View file @
a39c53ba
...
@@ -72,6 +72,7 @@ RealSize Rotation::trSize(const RealSize& size) const {
...
@@ -72,6 +72,7 @@ RealSize Rotation::trSize(const RealSize& size) const {
return RealSize(c * x + s * y, s * x + c * y);
return RealSize(c * x + s * y, s * x + c * y);
}
}
*/
*/
RealSize
Rotation
::
trSizeToBB
(
const
RealSize
&
size
)
const
{
RealSize
Rotation
::
trSizeToBB
(
const
RealSize
&
size
)
const
{
if
(
straight
())
{
if
(
straight
())
{
if
(
sideways
())
{
if
(
sideways
())
{
...
@@ -85,6 +86,7 @@ RealSize Rotation::trSizeToBB(const RealSize& size) const {
...
@@ -85,6 +86,7 @@ RealSize Rotation::trSizeToBB(const RealSize& size) const {
return
RealSize
(
fabs
(
c
*
x
)
+
fabs
(
s
*
y
),
fabs
(
s
*
x
)
+
fabs
(
c
*
y
));
return
RealSize
(
fabs
(
c
*
x
)
+
fabs
(
s
*
y
),
fabs
(
s
*
x
)
+
fabs
(
c
*
y
));
}
}
}
}
RealRect
Rotation
::
trRectToBB
(
const
RealRect
&
r
)
const
{
RealRect
Rotation
::
trRectToBB
(
const
RealRect
&
r
)
const
{
if
(
straight
())
{
if
(
straight
())
{
RealSize
s
=
trSizeToBB
(
r
.
size
());
RealSize
s
=
trSizeToBB
(
r
.
size
());
...
@@ -117,6 +119,8 @@ RealRect Rotation::trRectToBB(const RealRect& r) const {
...
@@ -117,6 +119,8 @@ RealRect Rotation::trRectToBB(const RealRect& r) const {
return
result
;
return
result
;
}
}
}
}
RealRect
Rotation
::
trRectStraight
(
const
RealRect
&
r
)
const
{
RealRect
Rotation
::
trRectStraight
(
const
RealRect
&
r
)
const
{
assert
(
angle
==
0
);
assert
(
angle
==
0
);
return
RealRect
(
r
.
position
()
+
origin
,
r
.
size
());
return
RealRect
(
r
.
position
()
+
origin
,
r
.
size
());
...
@@ -139,6 +143,11 @@ RealPoint Rotation::trInv(const RealPoint& p) const {
...
@@ -139,6 +143,11 @@ RealPoint Rotation::trInv(const RealPoint& p) const {
return
RealPoint
((
c
*
x
-
s
*
y
)
/
zoomX
,
return
RealPoint
((
c
*
x
-
s
*
y
)
/
zoomX
,
(
s
*
x
+
c
*
y
)
/
zoomY
);
(
s
*
x
+
c
*
y
)
/
zoomY
);
}
}
RealSize
Rotation
::
trInv
(
const
RealSize
&
x
)
const
{
double
a
=
deg_to_rad
(
angle
),
s
=
sin
(
a
),
c
=
cos
(
a
);
return
RealSize
((
c
*
x
.
width
-
s
*
x
.
height
)
/
zoomX
,
(
s
*
x
.
width
+
c
*
x
.
height
)
/
zoomY
);
}
RealPoint
Rotation
::
boundingBoxCorner
(
const
RealSize
&
size
)
const
{
RealPoint
Rotation
::
boundingBoxCorner
(
const
RealSize
&
size
)
const
{
// This function is a bit tricky,
// This function is a bit tricky,
...
...
src/util/rotation.hpp
View file @
a39c53ba
...
@@ -98,6 +98,8 @@ class Rotation {
...
@@ -98,6 +98,8 @@ class Rotation {
/// Translate a point back to internal coordinates
/// Translate a point back to internal coordinates
RealPoint
trInv
(
const
RealPoint
&
p
)
const
;
RealPoint
trInv
(
const
RealPoint
&
p
)
const
;
/// Translate a size back to internal coordinates
RealSize
trInv
(
const
RealSize
&
p
)
const
;
protected:
protected:
int
angle
;
///< The angle of rotation in degrees (counterclockwise)
int
angle
;
///< The angle of rotation in degrees (counterclockwise)
...
...
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