[Libreoffice-commits] core.git: cppcanvas/source vcl/source
Chris Sherlock
chris.sherlock79 at gmail.com
Sat May 11 22:20:15 PDT 2013
cppcanvas/source/mtfrenderer/emfplus.cxx | 35 +++++++++++++++++++++++--------
vcl/source/filter/wmf/enhwmf.cxx | 3 +-
2 files changed, 28 insertions(+), 10 deletions(-)
New commits:
commit 00fbf73b07adc4d8f0e37e36bb844f2e9d19ae15
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Sun May 12 11:11:52 2013 +1000
EMF+ fixes
A number of fixes have been made to commit
256e42646bedbeb9cba900f962f36ba4b1a1cda3:
* Missing redirect in SAL_WARN - only gets picked up when DBG_LEVEL > 1
* Some errant newlines in SAL_INFO
* Some missing braces
* Missing semi-colon fixed (!)
* Changed int to sal_Int32 (causing ambiguity error)
* Add dumpWords to the SAL_WARN that ensures that size is not greater
than length
* Show values when proessing EMF+ comment record (only enabled when
DBG_LEVEL > 2)
* Missing std::hex in SAL_INFO
Change-Id: I059ba24964dd428a56a31d100109cfec938a8a49
Reviewed-on: https://gerrit.libreoffice.org/3861
Reviewed-by: David Tardon <dtardon at redhat.com>
Tested-by: David Tardon <dtardon at redhat.com>
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index c0f9172..7203cc3 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -102,10 +102,12 @@ namespace cppcanvas
{
sal_uInt32 pos = s.Tell ();
sal_Int16 data;
+ SAL_INFO ("cppcanvas.emf", "EMF+ dumping words");
for (; i > 0; i --) {
s >> data;
SAL_INFO ("cppcanvas.emf", "EMF+\tdata: " << std::hex << data << std::dec);
}
+ SAL_INFO ("cppcanvas.emf", "EMF+ end dumping words");
s.Seek (pos);
}
#endif
@@ -226,7 +228,7 @@ namespace cppcanvas
}
}
- if (polygon.count ())
+ if (polygon.count ()) {
aPolygon.append (polygon);
#if OSL_DEBUG_LEVEL > 1
@@ -238,15 +240,16 @@ namespace cppcanvas
SAL_INFO ("cppcanvas.emf", "point: " << point.getX() << "," << point.getY());
if (polygon.isPrevControlPointUsed(j)) {
point = polygon.getPrevControlPoint(j);
- SAL_INFO ("cppcanvas.emf", "prev: " << point.getX() "," << point.getY());
+ SAL_INFO ("cppcanvas.emf", "prev: " << point.getX() << "," << point.getY());
}
if (polygon.isNextControlPointUsed(j)) {
point = polygon.getNextControlPoint(j);
- SAL_INFO ("cppcanvas.emf", "next: " << point.getX() "," << point.getY());
+ SAL_INFO ("cppcanvas.emf", "next: " << point.getX() << "," << point.getY());
}
}
}
#endif
+ }
return aPolygon;
}
@@ -370,7 +373,8 @@ namespace cppcanvas
s >> header >> type;
- SAL_INFO ("cppcanvas.emf", "EMF+\tbrush\nEMF+\theader: 0x" << std::hex << header << " type: " << type << std::dec);
+ SAL_INFO ("cppcanvas.emf", "EMF+\tbrush");
+ SAL_INFO ("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header << " type: " << << std::hex << type << std::dec);
switch (type) {
case 0:
@@ -607,6 +611,7 @@ namespace cppcanvas
#if OSL_DEBUG_LEVEL > 1
if (width == 0.0) {
SAL_INFO ("cppcanvas.emf", "TODO: pen with zero width - using minimal which might not be correct\n");
+ }
#endif
rStrokeAttributes.StrokeWidth = (rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX ();
}
@@ -618,7 +623,8 @@ namespace cppcanvas
s >> header >> unknown >> penFlags >> unknown2 >> width;
- SAL_INFO("cppcanvas.emf", "EMF+\tpen\nEMF+\theader: 0x" << std::hex << header << " unknown: 0x" << unknown <<
+ SAL_INFO("cppcanvas.emf", "EMF+\tpen");
+ SAL_INFO("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header << " unknown: 0x" << unknown <<
" additional flags: 0x" << penFlags << " unknown: 0x" << unknown2 << " width: " << std::dec << width );
if (penFlags & 1)
@@ -751,7 +757,7 @@ namespace cppcanvas
// debug code - write the stream to debug file /tmp/emf-stream.emf
#if OSL_DEBUG_LEVEL > 1
mfStream.Seek(0);
- static int emfp_debug_stream_number = 0;
+ static sal_Int32 emfp_debug_stream_number = 0;
OUString emfp_debug_filename("/tmp/emf-embedded-stream");
emfp_debug_filename += OUString::valueOf(emfp_debug_stream_number++);
emfp_debug_filename += OUString(".emf");
@@ -760,7 +766,7 @@ namespace cppcanvas
mfStream >> file;
file.Flush();
- file.Close()
+ file.Close();
#endif
}
}
@@ -1253,6 +1259,10 @@ namespace cppcanvas
sal_uInt32 length = pAct->GetDataSize ();
SvMemoryStream rMF ((void*) pAct->GetData (), length, STREAM_READ);
+#if OSL_DEBUG_LEVEL > 2
+ SAL_INFO("cppcanvas.emf", "EMF+\tDump of EMF+ record");
+ dumpWords(rMF, length);
+#endif
length -= 4;
while (length > 0) {
@@ -1264,6 +1274,10 @@ namespace cppcanvas
next = rMF.Tell() + ( size - 12 );
+ if (size < 12) {
+ SAL_INFO("cppcanvas.emf", "Size field is less than 12 bytes");
+ }
+
SAL_INFO("cppcanvas.emf", "EMF+ record size: " << size << " type: " << type << " flags: " << flags << " data size: " << dataSize);
if (type == EmfPlusRecordTypeObject && ((mbMultipart && (flags & 0x7fff) == (mMFlags & 0x7fff)) || (flags & 0x8000))) {
@@ -1911,10 +1925,10 @@ namespace cppcanvas
}
break;
- }
+ }
default:
SAL_INFO("cppcanvas.emf", "EMF+ unhandled record type: " << type);
- SAL_INFO("cppcanvas.emf", "EMF+\tTODO\n");
+ SAL_INFO("cppcanvas.emf", "EMF+\tTODO");
}
}
@@ -1928,6 +1942,9 @@ namespace cppcanvas
{
SAL_WARN("cppcanvas.emf", "ImplRenderer::processEMFPlus: "
"size " << size << " > length " << length);
+#if OSL_DEBUG_LEVEL > 1
+ dumpWords(rMF, length);
+#endif
length = 0;
}
}
diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index 9857c4c..e0e69cf 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -466,7 +466,8 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
*pWMF >> length;
- SAL_INFO("vcl.emf", "\tGDI comment\n\t\tlength: " << length);
+ SAL_INFO("vcl.emf", "\tGDI comment");
+ SAL_INFO("vcl.emf", "\t\tlength: " << length);
if( pWMF->good() && length >= 4 ) {
sal_uInt32 id;
More information about the Libreoffice-commits
mailing list