cppcanvas/source/mtfrenderer/emfplus.cxx | 24 +++++++++++++++++++++++- embeddedobj/Library_emboleobj.mk | 1 + embeddedobj/source/msole/graphconvert.cxx | 12 ++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-)
New commits: commit a20f9320959c112ed7d927c05ac7d5ba9604c86d Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Apr 9 10:47:25 2014 +0200 fdo#77229 EMF+ rendering: improve EmfPlusSetClipPath's CombineModeExclude case This is still not perfect, but at least we now don't do the opposite of what was asked. Change-Id: I5e144c5ec2987902e65b2eb472259d9c39bbbd11 (cherry picked from commit c2af50eb6df396c957890a6b912b8f3185893551) Conflicts: cppcanvas/source/mtfrenderer/emfplus.cxx diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 4f08c17..d9659a8 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -124,6 +124,16 @@ const sal_uInt32 EmfPlusLineJoinTypeMiterClipped = 0x00000003; #define EMFP_DEBUG(x) #endif +enum EmfPlusCombineMode +{ + EmfPlusCombineModeReplace = 0x00000000, + EmfPlusCombineModeIntersect = 0x00000001, + EmfPlusCombineModeUnion = 0x00000002, + EmfPlusCombineModeXOR = 0x00000003, + EmfPlusCombineModeExclude = 0x00000004, + EmfPlusCombineModeComplement = 0x00000005 +}; + using namespace ::com::sun::star; using namespace ::basegfx; @@ -2137,7 +2147,19 @@ namespace cppcanvas ::basegfx::B2DPolyPolygon& clipPoly (path.GetPolygon (*this)); clipPoly.transform (rState.mapModeTransform); - updateClipping (clipPoly, rFactoryParms, combineMode == 1); + switch (combineMode) + { + case EmfPlusCombineModeReplace: + case EmfPlusCombineModeIntersect: + case EmfPlusCombineModeUnion: // Is this, EmfPlusCombineModeXOR and EmfPlusCombineModeComplement correct? + case EmfPlusCombineModeXOR: + case EmfPlusCombineModeComplement: + updateClipping (clipPoly, rFactoryParms, combineMode == 1); + break; + case EmfPlusCombineModeExclude: + // Not doing anything is better then including exactly what we wanted to exclude. + break; + } break; } commit 118d27504022b6f69f24844e21a551e9e9efc399 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Apr 7 16:51:29 2014 +0200 fdo#77140 embeddedobj: avoid unneeded conversion in ConvertBufferToFormat() The primary reason is not performance: on export currently we loose some EMF+ properties. While it would be good to fix all those problems one by one, this is a small fix to avoid all kind of roundtrip problems in this situation. Change-Id: If5e1c1eabd8290f36b538e374c9707ae17097786 (cherry picked from commit 2a7fdf2a7bb7345c49c988dfd1fcdb41cebb8a1e) diff --git a/embeddedobj/Library_emboleobj.mk b/embeddedobj/Library_emboleobj.mk index 32dfe09..1e72bf2 100644 --- a/embeddedobj/Library_emboleobj.mk +++ b/embeddedobj/Library_emboleobj.mk @@ -43,6 +43,7 @@ $(eval $(call gb_Library_use_libraries,emboleobj,\ sal \ tl \ utl \ + vcl \ $(gb_UWINAPI) \ )) diff --git a/embeddedobj/source/msole/graphconvert.cxx b/embeddedobj/source/msole/graphconvert.cxx index b1f69c4..006073c 100644 --- a/embeddedobj/source/msole/graphconvert.cxx +++ b/embeddedobj/source/msole/graphconvert.cxx @@ -32,6 +32,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/seqstream.hxx> #include <tools/stream.hxx> +#include <vcl/graphicfilter.hxx> #include "mtnotification.hxx" #include "oleembobj.hxx" @@ -48,6 +49,17 @@ sal_Bool ConvertBufferToFormat( void* pBuf, // produces sequence with data in requested format and returns it in aResult if ( pBuf ) { + // First, in case the buffer is already in the requested format, then avoid a conversion. + SvMemoryStream aMemoryStream(pBuf, nBufSize, STREAM_READ); + GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); + sal_uInt16 nRetFormat = 0; + if (rFilter.CanImportGraphic(OUString(), aMemoryStream, GRFILTER_FORMAT_DONTKNOW, &nRetFormat) == GRFILTER_OK && + rFilter.GetImportFormatMediaType(nRetFormat) == aMimeType) + { + aResult <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aMemoryStream.GetData() ), aMemoryStream.Seek( STREAM_SEEK_TO_END ) ); + return sal_True; + } + uno::Sequence < sal_Int8 > aData( (sal_Int8*)pBuf, nBufSize ); uno::Reference < io::XInputStream > xIn = new comphelper::SequenceInputStream( aData ); try _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits