summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-06-11 08:38:23 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-04-14 21:33:59 +0100
commit4fa8df7320f6bdc8333f5936537d2ed93e8892ce (patch)
tree3b3d06d3ba0dd698e1fb168171e4de1b4d60c12a /vcl
parent9bc0ca091b7037f7c8f4782103a81b7287bc1de3 (diff)
Resolves: #i119735# missing css.svg.SVGWriter when using GraphicProvider
missing implementation for com.sun.star.svg.SVGWriter when using GraphicProvider Adapted patch provided by Sven Jacobi (thanks), added some fixes/cleanups to make it work with all kind of graphics (SVG, Bitmap, Metafile) (cherry picked from commit 891011181285d7ad54984ffd05ed44d825a70647) Conflicts: filter/inc/filter/msfilter/msdffimp.hxx filter/source/graphicfilter/epict/epict.cxx filter/source/svg/svgexport.cxx filter/source/svg/svguno.cxx filter/source/svg/svgwriter.cxx filter/source/svg/svgwriter.hxx svtools/source/filter/filter.cxx Change-Id: Ie53f995614060a00c709f620f89d132913a25c5c
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/filter/graphicfilter.cxx58
-rw-r--r--vcl/source/gdi/impgraph.cxx34
2 files changed, 44 insertions, 48 deletions
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index ecfd46976800..eb861046b4cd 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1902,69 +1902,30 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String&
sal_Int32 nVersion = aConfigItem.ReadInt32( "Version", 0 ) ;
if ( nVersion )
rOStm.SetVersion( nVersion );
- GDIMetaFile aMTF;
- if ( eType != GRAPHIC_BITMAP )
- aMTF = aGraphic.GetGDIMetaFile();
- else
- {
- VirtualDevice aVirDev;
+ // #i119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
+ GDIMetaFile aMTF(aGraphic.GetGDIMetaFile());
- aMTF.Record( &aVirDev );
- aGraphic.Draw( &aVirDev, Point(), aGraphic.GetPrefSize() );
- aMTF.Stop();
- aMTF.SetPrefSize( aGraphic.GetPrefSize() );
- aMTF.SetPrefMapMode( aGraphic.GetPrefMapMode() );
- }
aMTF.Write( rOStm );
+
if( rOStm.GetError() )
nStatus = GRFILTER_IOERROR;
}
else if ( aFilterName.EqualsIgnoreCaseAscii( EXP_WMF ) )
{
- if( eType == GRAPHIC_GDIMETAFILE )
- {
- if ( !ConvertGDIMetaFileToWMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) )
- nStatus = GRFILTER_FORMATERROR;
- }
- else
- {
- Bitmap aBmp( aGraphic.GetBitmap() );
- GDIMetaFile aMTF;
- VirtualDevice aVirDev;
-
- aMTF.Record( &aVirDev );
- aVirDev.DrawBitmap( Point(), aBmp );
- aMTF.Stop();
- aMTF.SetPrefSize( aBmp.GetSizePixel() );
+ // #i119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
+ if ( !ConvertGDIMetaFileToWMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) )
+ nStatus = GRFILTER_FORMATERROR;
- if( !ConvertGDIMetaFileToWMF( aMTF, rOStm, &aConfigItem ) )
- nStatus = GRFILTER_FORMATERROR;
- }
if( rOStm.GetError() )
nStatus = GRFILTER_IOERROR;
}
else if ( aFilterName.EqualsIgnoreCaseAscii( EXP_EMF ) )
{
- if( eType == GRAPHIC_GDIMETAFILE )
- {
- if ( !ConvertGDIMetaFileToEMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) )
- nStatus = GRFILTER_FORMATERROR;
- }
- else
- {
- Bitmap aBmp( aGraphic.GetBitmap() );
- GDIMetaFile aMTF;
- VirtualDevice aVirDev;
-
- aMTF.Record( &aVirDev );
- aVirDev.DrawBitmap( Point(), aBmp );
- aMTF.Stop();
- aMTF.SetPrefSize( aBmp.GetSizePixel() );
+ // #i119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
+ if ( !ConvertGDIMetaFileToEMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) )
+ nStatus = GRFILTER_FORMATERROR;
- if( !ConvertGDIMetaFileToEMF( aMTF, rOStm, &aConfigItem ) )
- nStatus = GRFILTER_FORMATERROR;
- }
if( rOStm.GetError() )
nStatus = GRFILTER_IOERROR;
}
@@ -2080,6 +2041,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String&
SvMemoryStream aMemStm( 65535, 65535 );
+ // #i119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( aMemStm );
xActiveDataSource->setOutputStream( ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >(
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index d980fc5f09c4..be5663754b6a 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -595,6 +595,40 @@ Animation ImpGraphic::ImplGetAnimation() const
const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
{
+ if (GRAPHIC_BITMAP == meType && !maMetaFile.GetActionSize())
+ {
+ // #i119735#
+ // Use the local maMetaFile as container for a metafile-representation
+ // of the bitmap graphic. This will be done only once, thus be buffered.
+ // I checked all usages of maMetaFile, it is only used when type is not
+ // GRAPHIC_BITMAP. In operator= it will get copied, thus buffering will
+ // survive copying (change this if not wanted)
+ ImpGraphic* pThat = const_cast< ImpGraphic* >(this);
+
+ if(maSvgData.get() && !maEx)
+ {
+ // use maEx as local buffer for rendered svg
+ pThat->maEx = maSvgData->getReplacement();
+ }
+
+ VirtualDevice aVirDev;
+ const Size aSizePixel(maEx.GetSizePixel());
+
+ pThat->maMetaFile.Record(&aVirDev);
+
+ if(maEx.IsTransparent())
+ {
+ aVirDev.DrawBitmapEx(Point(), maEx);
+ }
+ else
+ {
+ aVirDev.DrawBitmap(Point(), maEx.GetBitmap());
+ }
+
+ pThat->maMetaFile.Stop();
+ pThat->maMetaFile.SetPrefSize(aSizePixel);
+ }
+
return maMetaFile;
}