From 14d604ddfa3cc7dc7a5a5c92e03e17956239f06b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 25 Jul 2010 08:51:35 +0000 Subject: [PATCH] Fix compiler warning about hiding Transformable::ScaleBy() by enabled the ChannelTransform version of ScaleBy() which was commented out in the code. I have no idea if this code was tested or not, I've added a comment to the effect. It certainly isn't used in Icon-O-Matic at the moment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37732 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../transformable/ChannelTransform.cpp | 43 ++++++++++--------- .../transformable/ChannelTransform.h | 6 ++- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/apps/icon-o-matic/transformable/ChannelTransform.cpp b/src/apps/icon-o-matic/transformable/ChannelTransform.cpp index ce082863a3..49e95b443d 100644 --- a/src/apps/icon-o-matic/transformable/ChannelTransform.cpp +++ b/src/apps/icon-o-matic/transformable/ChannelTransform.cpp @@ -162,28 +162,29 @@ ChannelTransform::RotateBy(double degrees) } -//// ScaleBy -//// -//// converts a scalation in world coordinates into -//// a combined local scalation and a translation -//void -//ChannelTransform::ScaleBy(BPoint origin, double xScale, double yScale) -//{ -// if (xScale == 1.0 && yScale == 1.0) -// return; +// ScaleBy // -// fXScale *= xScale; -// fYScale *= yScale; -// -// // scale fTranslation -// double xOffset = fTranslation.x - origin.x; -// double yOffset = fTranslation.y - origin.y; -// -// fTranslation.x = origin.x + (xOffset * xScale); -// fTranslation.y = origin.y + (yOffset * yScale); -// -// _UpdateMatrix(); -//} +// converts a scalation in world coordinates into +// a combined local scalation and a translation +void +ChannelTransform::ScaleBy(BPoint origin, double xScale, double yScale) +{ + // TODO: Untested? + if (xScale == 1.0 && yScale == 1.0) + return; + + fXScale *= xScale; + fYScale *= yScale; + + // scale fTranslation + double xOffset = fTranslation.x - origin.x; + double yOffset = fTranslation.y - origin.y; + + fTranslation.x = origin.x + (xOffset * xScale); + fTranslation.y = origin.y + (yOffset * yScale); + + _UpdateMatrix(); +} // ScaleBy void diff --git a/src/apps/icon-o-matic/transformable/ChannelTransform.h b/src/apps/icon-o-matic/transformable/ChannelTransform.h index bb1d70bbf5..f041816cf7 100644 --- a/src/apps/icon-o-matic/transformable/ChannelTransform.h +++ b/src/apps/icon-o-matic/transformable/ChannelTransform.h @@ -32,10 +32,12 @@ class ChannelTransform : public Transformable { virtual void TranslateBy(BPoint offset); virtual void RotateBy(BPoint origin, double degrees); - - void ScaleBy(double xScale, double yScale); void RotateBy(double degrees); + virtual void ScaleBy(BPoint origin, double xScale, + double yScale); + void ScaleBy(double xScale, double yScale); + void SetTranslationAndScale(BPoint offset, double xScale, double yScale);