(minor) use getAngle() instead of trAngle(0)

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1470 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2010-08-03 14:53:30 +00:00
parent 37da5e1141
commit 463c3d9a81
3 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -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) {
opts.package = &viewer.getStylePackage();
opts.local_package = &viewer.getLocalPackage();
opts.angle = rot.trAngle(0);
opts.angle = rot.getAngle();
if (viewer.nativeLook()) {
opts.width = opts.height = 16;
opts.preserve_aspect = ASPECT_BORDER;
+9
View File
@@ -72,6 +72,7 @@ RealSize Rotation::trSize(const RealSize& size) const {
return RealSize(c * x + s * y, s * x + c * y);
}
*/
RealSize Rotation::trSizeToBB(const RealSize& size) const {
if (straight()) {
if (sideways()) {
@@ -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));
}
}
RealRect Rotation::trRectToBB(const RealRect& r) const {
if (straight()) {
RealSize s = trSizeToBB(r.size());
@@ -117,6 +119,8 @@ RealRect Rotation::trRectToBB(const RealRect& r) const {
return result;
}
}
RealRect Rotation::trRectStraight(const RealRect& r) const {
assert(angle == 0);
return RealRect(r.position() + origin, r.size());
@@ -139,6 +143,11 @@ RealPoint Rotation::trInv(const RealPoint& p) const {
return RealPoint((c * x - s * y) / zoomX,
(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 {
// This function is a bit tricky,
+2
View File
@@ -98,6 +98,8 @@ class Rotation {
/// Translate a point back to internal coordinates
RealPoint trInv(const RealPoint& p) const;
/// Translate a size back to internal coordinates
RealSize trInv(const RealSize& p) const;
protected:
int angle; ///< The angle of rotation in degrees (counterclockwise)