editeng/source/editeng/editeng.cxx  |    2 +-
 editeng/source/editeng/impedit.hxx  |    1 -
 editeng/source/editeng/impedit3.cxx |   26 ++------------------------
 include/tools/gen.hxx               |    3 ++-
 slideshow/Library_OGLTrans.mk       |    1 +
 vcl/CppunitTest_vcl_animation.mk    |    1 +
 6 files changed, 7 insertions(+), 27 deletions(-)

New commits:
commit 38372f103aa5035ec32570972e55656e07647791
Author:     Dr. David Alan Gilbert <d...@treblig.org>
AuthorDate: Thu Jul 13 14:32:44 2023 +0100
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Jul 16 12:54:58 2023 +0200

    editeng: Use Tools::Point::RotateAround instead of our own
    
    Remove our own Rotate function by calls to Tools::Point's
    RotateAround method.
    Add a comment on RotateAround to emphasise that the point rotated
    is the parameter and the This object is used as the origin.
    
    Using TOOLS_DLLPUBLIC to fix link error (as suggested by Arnaud)
    Added tl to slideshow (from Neil)
    
    Signed-off-by: Dr. David Alan Gilbert <d...@treblig.org>
    Change-Id: I296bbdf910d262401bfa18f0fc4f431b9e79b8f4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154392
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 19ed11229645..9e6696cd5546 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -217,7 +217,7 @@ void EditEngine::Draw( OutputDevice& rOutDev, const Point& 
rStartPos, Degree10 n
     if ( IsEffectivelyVertical() )
     {
         aStartPos.AdjustX(GetPaperSize().Width() );
-        aStartPos = Rotate( aStartPos, nOrientation, rStartPos );
+        rStartPos.RotateAround(aStartPos, nOrientation);
     }
     pImpEditEngine->Paint(rOutDev, aBigRect, aStartPos, false, nOrientation);
     if( rOutDev.GetConnectMetaFile() )
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index b59d934beadf..815c42328ba8 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -1360,7 +1360,6 @@ inline vcl::Cursor* ImpEditView::GetCursor()
 void ConvertItem( std::unique_ptr<SfxPoolItem>& rPoolItem, MapUnit 
eSourceUnit, MapUnit eDestUnit );
 void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const 
MapUnit* pSourceUnit = nullptr, const MapUnit* pDestUnit = nullptr );
 AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar );
-Point Rotate( const Point& rPoint, Degree10 nOrientation, const Point& rOrigin 
);
 
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index ba7c2ed04ae3..dff400a5517d 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -114,28 +114,6 @@ struct TabInfo
 
 }
 
-Point Rotate( const Point& rPoint, Degree10 nOrientation, const Point& rOrigin 
)
-{
-    double nRealOrientation = toRadians(nOrientation);
-    double nCos = cos( nRealOrientation );
-    double nSin = sin( nRealOrientation );
-
-    Point aRotatedPos;
-    Point aTranslatedPos( rPoint );
-
-    // Translation
-    aTranslatedPos -= rOrigin;
-
-    // Rotation...
-    aRotatedPos.setX( static_cast<tools::Long>( nCos*aTranslatedPos.X() + 
nSin*aTranslatedPos.Y() ) );
-    aRotatedPos.setY( static_cast<tools::Long>(- ( nSin*aTranslatedPos.X() - 
nCos*aTranslatedPos.Y() )) );
-    aTranslatedPos = aRotatedPos;
-
-    // Translation...
-    aTranslatedPos += rOrigin;
-    return aTranslatedPos;
-}
-
 AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar )
 {
     switch ( cChar )
@@ -231,8 +209,8 @@ static void lcl_DrawRedLines( OutputDevice& rOutDev,
 
         if (nOrientation)
         {
-            aPoint1 = Rotate(aPoint1, nOrientation, rOrigin);
-            aPoint2 = Rotate(aPoint2, nOrientation, rOrigin);
+            rOrigin.RotateAround(aPoint1, nOrientation);
+            rOrigin.RotateAround(aPoint2, nOrientation);
         }
 
         {
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 11d26b0372f2..c6372d7c92dc 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -74,7 +74,7 @@ inline bool equal(Pair const & p1, Pair const & p2)
 // Point
 
 class Size;
-class SAL_WARN_UNUSED UNLESS_MERGELIBS(SAL_DLLPUBLIC_EXPORT) Point final : 
protected Pair
+class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Point final : protected Pair
 {
 public:
     constexpr Point() {}
@@ -88,6 +88,7 @@ public:
     tools::Long                AdjustX( tools::Long nHorzMove ) { mnA += 
nHorzMove; return mnA; }
     tools::Long                AdjustY( tools::Long nVertMove ) { mnB += 
nVertMove; return mnB; }
 
+    // Rotate parameter point using This as origin; store result back into 
parameter point
     void                RotateAround( tools::Long& rX, tools::Long& rY, 
Degree10 nOrientation ) const;
     void                RotateAround( Point&, Degree10 nOrientation ) const;
 
diff --git a/slideshow/Library_OGLTrans.mk b/slideshow/Library_OGLTrans.mk
index d059dc1813d6..85051483df66 100644
--- a/slideshow/Library_OGLTrans.mk
+++ b/slideshow/Library_OGLTrans.mk
@@ -28,6 +28,7 @@ $(eval $(call gb_Library_use_libraries,OGLTrans,\
     cppu \
     cppuhelper \
     sal \
+       tl \
     vcl \
 ))
 
diff --git a/vcl/CppunitTest_vcl_animation.mk b/vcl/CppunitTest_vcl_animation.mk
index 3881005e6d4b..e64d908fa839 100644
--- a/vcl/CppunitTest_vcl_animation.mk
+++ b/vcl/CppunitTest_vcl_animation.mk
@@ -21,6 +21,7 @@ $(eval $(call 
gb_CppunitTest_add_exception_objects,vcl_animation, \
 
 $(eval $(call gb_CppunitTest_use_libraries,vcl_animation, \
        test \
+       tl \
        unotest \
        vcl \
 ))

Reply via email to