ooo-build r15076 - in branches/ooo-build-3-0-1: . patches/dev300



Author: thorstenb
Date: Thu Jan 15 10:07:34 2009
New Revision: 15076
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15076&view=rev

Log:
    * patches/dev300/vcl-pdf-drawarc-fix.diff: fix for i#97399,
    handles a corner case in the drawArc pdf output command leading to
    ugly extra polygon edges.



Added:
   branches/ooo-build-3-0-1/patches/dev300/vcl-pdf-drawarc-fix.diff
Modified:
   branches/ooo-build-3-0-1/ChangeLog
   branches/ooo-build-3-0-1/patches/dev300/apply

Modified: branches/ooo-build-3-0-1/patches/dev300/apply
==============================================================================
--- branches/ooo-build-3-0-1/patches/dev300/apply	(original)
+++ branches/ooo-build-3-0-1/patches/dev300/apply	Thu Jan 15 10:07:34 2009
@@ -2701,6 +2701,7 @@
 win32-tooltips.diff, tml
 # fix problem with outline numbering broken in master document
 sw-outline-numbering-broken-fix.diff, i#96092, n#445536, Amelia Wang
+vcl-pdf-drawarc-fix.diff, i#97399, thorsten
 
 [ OxygenOfficeDefaultSettings ]
 #Create langpack and full installers

Added: branches/ooo-build-3-0-1/patches/dev300/vcl-pdf-drawarc-fix.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-3-0-1/patches/dev300/vcl-pdf-drawarc-fix.diff	Thu Jan 15 10:07:34 2009
@@ -0,0 +1,81 @@
+diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
+index 43f52d8..85015a5 100644
+--- vcl/source/gdi/pdfwriter_impl.cxx
++++ vcl/source/gdi/pdfwriter_impl.cxx
+@@ -8254,18 +8254,18 @@ void PDFWriterImpl::drawArc( const Rectangle& rRect, const Point& rStart, const
+         return;
+ 
+     // calculate start and stop angles
+-    double fStartAngle = calcAngle( rRect, rStart );
++    const double fStartAngle = calcAngle( rRect, rStart );
+     double fStopAngle  = calcAngle( rRect, rStop );
+     while( fStopAngle < fStartAngle )
+         fStopAngle += 2.0*M_PI;
+-    int nFragments = (int)((fStopAngle-fStartAngle)/(M_PI/2.0))+1;
+-    double fFragmentDelta = (fStopAngle-fStartAngle)/(double)nFragments;
+-    double kappa = fabs( 4.0 * (1.0-cos(fFragmentDelta/2.0))/sin(fFragmentDelta/2.0) / 3.0);
+-    double halfWidth = (double)rRect.GetWidth()/2.0;
+-    double halfHeight = (double)rRect.GetHeight()/2.0;
++    const int nFragments = (int)((fStopAngle-fStartAngle)/(M_PI/2.0))+1;
++    const double fFragmentDelta = (fStopAngle-fStartAngle)/(double)nFragments;
++    const double kappa = fabs( 4.0 * (1.0-cos(fFragmentDelta/2.0))/sin(fFragmentDelta/2.0) / 3.0);
++    const double halfWidth = (double)rRect.GetWidth()/2.0;
++    const double halfHeight = (double)rRect.GetHeight()/2.0;
+ 
+-    Point aCenter( (rRect.Left()+rRect.Right()+1)/2,
+-                   (rRect.Top()+rRect.Bottom()+1)/2 );
++    const Point aCenter( (rRect.Left()+rRect.Right()+1)/2,
++                         (rRect.Top()+rRect.Bottom()+1)/2 );
+ 
+     OStringBuffer aLine( 30*nFragments );
+     Point aPoint( (int)(halfWidth * cos(fStartAngle) ),
+@@ -8273,27 +8273,30 @@ void PDFWriterImpl::drawArc( const Rectangle& rRect, const Point& rStart, const
+     aPoint += aCenter;
+     m_aPages.back().appendPoint( aPoint, aLine );
+     aLine.append( " m " );
+-    for( int i = 0; i < nFragments; i++ )
+-    {
+-        double fStartFragment = fStartAngle + (double)i*fFragmentDelta;
+-        double fStopFragment = fStartFragment + fFragmentDelta;
+-        aPoint = Point( (int)(halfWidth * (cos(fStartFragment) - kappa*sin(fStartFragment) ) ),
+-                        -(int)(halfHeight * (sin(fStartFragment) + kappa*cos(fStartFragment) ) ) );
+-        aPoint += aCenter;
+-        m_aPages.back().appendPoint( aPoint, aLine );
+-        aLine.append( ' ' );
++    if( !basegfx::fTools::equal(fStartAngle, fStopAngle) )
++    {
++        for( int i = 0; i < nFragments; i++ )
++        {
++            const double fStartFragment = fStartAngle + (double)i*fFragmentDelta;
++            const double fStopFragment = fStartFragment + fFragmentDelta;
++            aPoint = Point( (int)(halfWidth * (cos(fStartFragment) - kappa*sin(fStartFragment) ) ),
++                            -(int)(halfHeight * (sin(fStartFragment) + kappa*cos(fStartFragment) ) ) );
++            aPoint += aCenter;
++            m_aPages.back().appendPoint( aPoint, aLine );
++            aLine.append( ' ' );
+ 
+-        aPoint = Point( (int)(halfWidth * (cos(fStopFragment) + kappa*sin(fStopFragment) ) ),
+-                        -(int)(halfHeight * (sin(fStopFragment) - kappa*cos(fStopFragment) ) ) );
+-        aPoint += aCenter;
+-        m_aPages.back().appendPoint( aPoint, aLine );
+-        aLine.append( ' ' );
++            aPoint = Point( (int)(halfWidth * (cos(fStopFragment) + kappa*sin(fStopFragment) ) ),
++                            -(int)(halfHeight * (sin(fStopFragment) - kappa*cos(fStopFragment) ) ) );
++            aPoint += aCenter;
++            m_aPages.back().appendPoint( aPoint, aLine );
++            aLine.append( ' ' );
+ 
+-        aPoint = Point( (int)(halfWidth * cos(fStopFragment) ),
+-                        -(int)(halfHeight * sin(fStopFragment) ) );
+-        aPoint += aCenter;
+-        m_aPages.back().appendPoint( aPoint, aLine );
+-        aLine.append( " c\n" );
++            aPoint = Point( (int)(halfWidth * cos(fStopFragment) ),
++                            -(int)(halfHeight * sin(fStopFragment) ) );
++            aPoint += aCenter;
++            m_aPages.back().appendPoint( aPoint, aLine );
++            aLine.append( " c\n" );
++        }
+     }
+     if( bWithChord || bWithPie )
+     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]