[Libreoffice-commits] .: 2 commits - filter/source

Caolán McNamara caolan at kemper.freedesktop.org
Tue Feb 1 03:15:02 PST 2011


 filter/source/graphicfilter/eps/eps.cxx |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 4d1cac0ef5b18d7b84422d80ebb43394b6accd54
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 1 11:12:57 2011 +0000

    and use the existing metafile if it exists and has some actions in it

diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 88c2b86..427cbeb 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -371,8 +371,10 @@ BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
     ChrSet* 		pCS;
     StackMember*	pGS;
 
-    if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
+    if (rGraphic.GetType() == GRAPHIC_GDIMETAFILE)
         pMTF = &rGraphic.GetGDIMetaFile();
+    else if (rGraphic.GetGDIMetaFile.GetActionCount())
+        pMTF = pAMTF = new GDIMetaFile( rGraphic.GetGDIMetaFile() );
     else
     {
         Bitmap aBmp( rGraphic.GetBitmap() );
commit 195fa0a4fa2a7a1529d13caeb36567989863edef
Author: Takeshi Kurosawa <taken.spc at gmail.com>
Date:   Tue Feb 1 13:30:33 2011 +0900

    Fix "Save as Picture"
    
    Currently "Save as Picture" produces a broken eps file.

diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index dd127e0..88c2b86 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -374,7 +374,16 @@ BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
     if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
         pMTF = &rGraphic.GetGDIMetaFile();
     else
-        pMTF = pAMTF = new GDIMetaFile( rGraphic.GetGDIMetaFile() );
+    {
+        Bitmap aBmp( rGraphic.GetBitmap() );
+        pAMTF = new GDIMetaFile();
+        VirtualDevice aTmpVDev;
+        pAMTF->Record( &aTmpVDev );
+        aTmpVDev.DrawBitmap( Point(), aBmp );
+        pAMTF->Stop();
+        pAMTF->SetPrefSize( aBmp.GetSizePixel() );
+        pMTF = pAMTF;
+    }
     aVDev.SetMapMode( pMTF->GetPrefMapMode() );
     nBoundingX1 = nBoundingY1 = 0;
     nBoundingX2 = pMTF->GetPrefSize().Width();


More information about the Libreoffice-commits mailing list