summaryrefslogtreecommitdiff
path: root/filter/source/graphicfilter/eps/eps.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/graphicfilter/eps/eps.cxx')
-rw-r--r--filter/source/graphicfilter/eps/eps.cxx111
1 files changed, 84 insertions, 27 deletions
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 454d683393ed..12a18e69de14 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -1649,15 +1649,16 @@ void PSWriter::ImplSetClipRegion( Region& rClipRegion )
{
if ( !rClipRegion.IsEmpty() )
{
- Rectangle aRect;
- RegionHandle hRegionHandle = rClipRegion.BeginEnumRects();
+ RectangleVector aRectangles;
+ rClipRegion.GetRegionRectangles(aRectangles);
- while ( rClipRegion.GetNextEnumRect( hRegionHandle, aRect ) )
+ for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
{
- double nX1 = aRect.Left();
- double nY1 = aRect.Top();
- double nX2 = aRect.Right();
- double nY2 = aRect.Bottom();
+ double nX1(aRectIter->Left());
+ double nY1(aRectIter->Top());
+ double nX2(aRectIter->Right());
+ double nY2(aRectIter->Bottom());
+
ImplWriteDouble( nX1 );
ImplWriteDouble( nY1 );
ImplWriteByte( 'm' );
@@ -1673,8 +1674,34 @@ void PSWriter::ImplSetClipRegion( Region& rClipRegion )
ImplWriteDouble( nX1 );
ImplWriteDouble( nY1 );
ImplWriteByte( 'l', PS_SPACE | PS_WRAP );
- };
- rClipRegion.EndEnumRects( hRegionHandle );
+ }
+
+ //Rectangle aRect;
+ //RegionHandle hRegionHandle = rClipRegion.BeginEnumRects();
+ //
+ //while ( rClipRegion.GetEnumRects( hRegionHandle, aRect ) )
+ //{
+ // double nX1 = aRect.Left();
+ // double nY1 = aRect.Top();
+ // double nX2 = aRect.Right();
+ // double nY2 = aRect.Bottom();
+ // ImplWriteDouble( nX1 );
+ // ImplWriteDouble( nY1 );
+ // ImplWriteByte( 'm' );
+ // ImplWriteDouble( nX2 );
+ // ImplWriteDouble( nY1 );
+ // ImplWriteByte( 'l' );
+ // ImplWriteDouble( nX2 );
+ // ImplWriteDouble( nY2 );
+ // ImplWriteByte( 'l' );
+ // ImplWriteDouble( nX1 );
+ // ImplWriteDouble( nY2 );
+ // ImplWriteByte( 'l' );
+ // ImplWriteDouble( nX1 );
+ // ImplWriteDouble( nY1 );
+ // ImplWriteByte( 'l', PS_SPACE | PS_WRAP );
+ //};
+ //rClipRegion.EndEnumRects( hRegionHandle );
ImplWriteLine( "eoclip newpath" );
}
}
@@ -1723,12 +1750,18 @@ void PSWriter::ImplBmp( Bitmap* pBitmap, Bitmap* pMaskBitmap, const Point & rPoi
aRect = Rectangle( Point( 0, nHeightOrg - nHeightLeft ), Size( (long)nWidth, (long)nHeight ) );
aRegion = Region( pMaskBitmap->CreateRegion( COL_BLACK, aRect ) );
- if ( ( mnLevel == 1 ) && ( aRegion.GetRectCount() * 5 > 1000 ) )
+ if( mnLevel == 1 )
{
- nHeight >>= 1;
- if ( nHeight < 2 )
- return;
- continue;
+ RectangleVector aRectangleVector;
+ aRegion.GetRegionRectangles(aRectangleVector);
+
+ if ( aRectangleVector.size() * 5 > 1000 )
+ {
+ nHeight >>= 1;
+ if ( nHeight < 2 )
+ return;
+ continue;
+ }
}
break;
}
@@ -1743,26 +1776,50 @@ void PSWriter::ImplBmp( Bitmap* pBitmap, Bitmap* pMaskBitmap, const Point & rPoi
ImplWriteLine( "gs\npum" );
ImplTranslate( aSourcePos.X(), aSourcePos.Y() );
ImplScale( nXWidth / nWidth, nYHeight / nHeight );
- RegionHandle hRegionHandle = aRegion.BeginEnumRects();
- while ( aRegion.GetNextEnumRect( hRegionHandle, aRect ) )
+ RectangleVector aRectangles;
+ aRegion.GetRegionRectangles(aRectangles);
+ const long nMoveVertical(nHeightLeft - nHeightOrg);
+
+ for(RectangleVector::iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
{
- aRect.Move( 0, - ( nHeightOrg - nHeightLeft ) );
- ImplWriteLong( aRect.Left() );
- ImplWriteLong( aRect.Top() );
+ aRectIter->Move(0, nMoveVertical);
+
+ ImplWriteLong( aRectIter->Left() );
+ ImplWriteLong( aRectIter->Top() );
ImplWriteByte( 'm' );
- ImplWriteLong( aRect.Right() + 1 );
- ImplWriteLong( aRect.Top() );
+ ImplWriteLong( aRectIter->Right() + 1 );
+ ImplWriteLong( aRectIter->Top() );
ImplWriteByte( 'l' );
- ImplWriteLong( aRect.Right() + 1 );
- ImplWriteLong( aRect.Bottom() + 1 );
+ ImplWriteLong( aRectIter->Right() + 1 );
+ ImplWriteLong( aRectIter->Bottom() + 1 );
ImplWriteByte( 'l' );
- ImplWriteLong( aRect.Left() );
- ImplWriteLong( aRect.Bottom() + 1 );
+ ImplWriteLong( aRectIter->Left() );
+ ImplWriteLong( aRectIter->Bottom() + 1 );
ImplWriteByte( 'l' );
ImplWriteByte( 'p', PS_SPACE | PS_WRAP );
- };
- aRegion.EndEnumRects( hRegionHandle );
+ }
+
+ //RegionHandle hRegionHandle = aRegion.BeginEnumRects();
+ //
+ //while ( aRegion.GetEnumRects( hRegionHandle, aRect ) )
+ //{
+ // aRect.Move( 0, - ( nHeightOrg - nHeightLeft ) );
+ // ImplWriteLong( aRect.Left() );
+ // ImplWriteLong( aRect.Top() );
+ // ImplWriteByte( 'm' );
+ // ImplWriteLong( aRect.Right() + 1 );
+ // ImplWriteLong( aRect.Top() );
+ // ImplWriteByte( 'l' );
+ // ImplWriteLong( aRect.Right() + 1 );
+ // ImplWriteLong( aRect.Bottom() + 1 );
+ // ImplWriteByte( 'l' );
+ // ImplWriteLong( aRect.Left() );
+ // ImplWriteLong( aRect.Bottom() + 1 );
+ // ImplWriteByte( 'l' );
+ // ImplWriteByte( 'p', PS_SPACE | PS_WRAP );
+ //};
+ //aRegion.EndEnumRects( hRegionHandle );
ImplWriteLine( "eoclip newpath" );
ImplWriteLine( "pom" );
}