summaryrefslogtreecommitdiff
path: root/cppcanvas
diff options
context:
space:
mode:
authorRadek Doulik <rodo@novell.com>2013-02-25 15:05:19 +0100
committerRadek Doulik <rodo@novell.com>2013-02-25 15:08:30 +0100
commit41cfd0fd9d32b5e0a07d9f422aec2c7d97b27c01 (patch)
treeeab00a1a3d0f7b80906d6cf068a837c32730babf /cppcanvas
parent804f47a893359baa0b72f1a72df3d79302225654 (diff)
workaround for emf+ files with broken dataSize of Image object record
Change-Id: I5005961e1b618af949dc978a7ac560fc9eca3e65
Diffstat (limited to 'cppcanvas')
-rw-r--r--cppcanvas/source/inc/implrenderer.hxx2
-rw-r--r--cppcanvas/source/mtfrenderer/emfplus.cxx14
2 files changed, 8 insertions, 8 deletions
diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx
index 7f34ad88d965..7d82ea7847de 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -259,7 +259,7 @@ static float GetSwapFloat( SvStream& rSt )
ActionVector::const_iterator& o_rRangeBegin,
ActionVector::const_iterator& o_rRangeEnd ) const;
- void processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_Bool bUseWholeStream = sal_False);
+ void processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, sal_Bool bUseWholeStream = sal_False);
/* EMF+ */
void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas );
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 0c9db41dd843..9b3d92dbd6dd 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -714,7 +714,7 @@ namespace cppcanvas
Graphic graphic;
- void Read (SvMemoryStream &s, sal_Bool bUseWholeStream)
+ void Read (SvMemoryStream &s, sal_uInt32 dataSize, sal_Bool bUseWholeStream)
{
sal_uInt32 header, unknown;
@@ -736,11 +736,11 @@ namespace cppcanvas
sal_Int32 mfType, mfSize;
s >> mfType >> mfSize;
- EMFP_DEBUG (printf ("EMF+\tmetafile type: %d dataSize: %d\n", mfType, mfSize));
+ EMFP_DEBUG (printf ("EMF+\tmetafile type: %d dataSize: %d real size calculated from record dataSize: %d\n", mfType, mfSize, dataSize - 16));
GraphicFilter filter;
// workaround buggy metafiles, which have wrong mfSize set (n#705956 for example)
- SvMemoryStream mfStream (((char *)s.GetData()) + s.Tell(), bUseWholeStream ? s.remainingSize() : mfSize, STREAM_READ);
+ SvMemoryStream mfStream (((char *)s.GetData()) + s.Tell(), bUseWholeStream ? s.remainingSize() : dataSize - 16, STREAM_READ);
filter.ImportGraphic (graphic, String (), mfStream);
@@ -1090,7 +1090,7 @@ namespace cppcanvas
}
}
- void ImplRenderer::processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_Bool bUseWholeStream)
+ void ImplRenderer::processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, sal_Bool bUseWholeStream)
{
sal_uInt32 index;
@@ -1145,7 +1145,7 @@ namespace cppcanvas
{
EMFPImage *image;
aObjects [index] = image = new EMFPImage ();
- image->Read (rObjectStream, bUseWholeStream);
+ image->Read (rObjectStream, dataSize, bUseWholeStream);
break;
}
@@ -1211,7 +1211,7 @@ namespace cppcanvas
if (mbMultipart) {
EMFP_DEBUG (printf ("EMF+ multipart record flags: %04hx\n", mMFlags));
mMStream.Seek (0);
- processObjectRecord (mMStream, mMFlags, sal_True);
+ processObjectRecord (mMStream, mMFlags, dataSize, sal_True);
}
mbMultipart = false;
}
@@ -1235,7 +1235,7 @@ namespace cppcanvas
EMFP_DEBUG (printf ("EMF+\talready used in svtools wmf/emf filter parser\n"));
break;
case EmfPlusRecordTypeObject:
- processObjectRecord (rMF, flags);
+ processObjectRecord (rMF, flags, dataSize);
break;
case EmfPlusRecordTypeFillPie:
{