update dev300-m57
[ooovba.git] / applied_patches / 0608-emf+-embedded-mf-image.diff
blob442d4230625b71c3d57aa292cba13fd8ae1c6afd
1 diff -rup cppcanvas-orig-mp/source/mtfrenderer/emfplus.cxx cppcanvas/source/mtfrenderer/emfplus.cxx
2 --- cppcanvas-orig-mp/source/mtfrenderer/emfplus.cxx 2008-06-03 12:26:31.000000000 +0200
3 +++ cppcanvas/source/mtfrenderer/emfplus.cxx 2008-06-03 12:26:44.000000000 +0200
4 @@ -632,12 +632,10 @@ namespace cppcanvas
5 Graphic graphic;
8 - void Read (SvStream &s)
9 + void Read (SvMemoryStream &s)
11 sal_uInt32 header, unknown;
13 - EMFP_DEBUG (dumpWords(s, 16));
15 s >> header >> type;
17 EMFP_DEBUG (printf ("EMF+\timage\nEMF+\theader: 0x%08x type: 0x%08x\n", header, type));
18 @@ -652,6 +650,24 @@ namespace cppcanvas
19 EMFP_DEBUG (printf ("EMF+\tbitmap width: %d height: %d\n", graphic.GetBitmap ().GetSizePixel ().Width (), graphic.GetBitmap ().GetSizePixel ().Height ()));
22 + } else if (type == 2) {
23 + sal_Int32 mfType, mfSize;
25 + s >> mfType >> mfSize;
26 + EMFP_DEBUG (printf ("EMF+\tmetafile type: %d dataSize: %d\n", mfType, mfSize));
28 + GraphicFilter filter;
29 + SvMemoryStream mfStream (((char *)s.GetData()) + s.Tell(), mfSize, STREAM_READ);
31 + filter.ImportGraphic (graphic, String (), mfStream);
33 + // debug code - write the stream to debug file /tmp/emf-stream.emf
34 + EMFP_DEBUG(mfStream.Seek(0);
35 + SvFileStream file( UniString::CreateFromAscii( "/tmp/emf-embedded-stream.emf" ), STREAM_WRITE | STREAM_TRUNC );
37 + mfStream >> file;
38 + file.Flush();
39 + file.Close());
43 @@ -1040,7 +1056,7 @@ namespace cppcanvas
44 mMFlags = flags;
45 mMStream.Seek(0);
47 - EMFP_DEBUG (dumpWords(rMF, 16));
49 // 1st 4 bytes are unknown
50 mMStream.Write (((const char *)rMF.GetData()) + rMF.Tell() + 4, dataSize - 4);
51 EMFP_DEBUG (printf ("EMF+ read next object part size: %d type: %04hx flags: %04hx data size: %d\n", size, type, flags, dataSize));
52 diff -rup cppcanvas-orig-mp/source/mtfrenderer/implrenderer.cxx cppcanvas/source/mtfrenderer/implrenderer.cxx
53 --- cppcanvas-orig-mp/source/mtfrenderer/implrenderer.cxx 2008-06-03 12:26:31.000000000 +0200
54 +++ cppcanvas/source/mtfrenderer/implrenderer.cxx 2008-06-03 12:26:44.000000000 +0200
55 @@ -1845,6 +1845,7 @@ namespace cppcanvas
56 char *env;
57 if (env = getenv ("EMF_PLUS_LIMIT")) {
58 limit = atoi (env);
59 + EMFP_DEBUG (printf ("EMF+ records limit: %d\n", limit));
62 EMFP_DEBUG (printf ("EMF+ passed to canvas mtf renderer, size: %d\n", pAct->GetDataSize ()));