summaryrefslogtreecommitdiff
path: root/cppcanvas
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2013-05-12 11:11:52 +1000
committerDavid Tardon <dtardon@redhat.com>2013-05-12 05:19:56 +0000
commit00fbf73b07adc4d8f0e37e36bb844f2e9d19ae15 (patch)
tree3e03e570c21ebf722f90d8a4ce1729fa12c4a66d /cppcanvas
parentfe93ea66cc3d75209ec535f34c260fd7414b0660 (diff)
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@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'cppcanvas')
-rw-r--r--cppcanvas/source/mtfrenderer/emfplus.cxx35
1 files changed, 26 insertions, 9 deletions
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index c0f9172668fe..7203cc320e72 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;
}
}