diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2017-09-21 02:05:06 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2017-10-01 21:11:38 +0200 |
commit | 6996c65015703b6aaa6d44f76c492371f47b138d (patch) | |
tree | 92c42a443a973f99b40c9dfdc7cc5c0638cebb29 | |
parent | d64dd40552bdcfe4fd2ab0d10f0c72796e579487 (diff) |
tdf#31814 drawinglayer: dump EmfPlusRecordTypeComment records
When we get an EMF+ comment record (which is NOT an EMF comment
record, EMF has comment records which is how you store EMF+
records, EMF+ records also have comment records for "private
data") then if we are a debug build then dump the private data
to stdout.
To make this work, set:
SAL_LOG=+INFO.cppcanvas.emf+WARN.cppcanvas.emf
Change-Id: I293875f45b692971379a5945ff7feb273bc54c73
Reviewed-on: https://gerrit.libreoffice.org/42558
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
-rw-r--r-- | drawinglayer/source/tools/emfphelperdata.cxx | 29 | ||||
-rw-r--r-- | drawinglayer/source/tools/emfphelperdata.hxx | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 2962193b9e5f..73422124c2d5 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -46,6 +46,7 @@ namespace emfplushelper { case EmfPlusRecordTypeHeader: return "EmfPlusRecordTypeHeader"; case EmfPlusRecordTypeEndOfFile: return "EmfPlusRecordTypeEndOfFile"; + case EmfPlusRecordTypeComment: return "EmfPlusRecordTypeComment"; case EmfPlusRecordTypeGetDC: return "EmfPlusRecordTypeGetDC"; case EmfPlusRecordTypeObject: return "EmfPlusRecordTypeObject"; case EmfPlusRecordTypeFillRects: return "EmfPlusRecordTypeFillRects"; @@ -809,6 +810,33 @@ namespace emfplushelper SAL_INFO("cppcanvas.emf", "EMF+ EndOfFile"); break; } + case EmfPlusRecordTypeComment: + { +#if OSL_DEBUG_LEVEL > 1 + unsigned char data; + OUString hexdata; + + SAL_INFO("cppcanvas.emf", "EMF+ Comment"); + SAL_INFO("cppcanvas.emf", "\tdatasize: 0x" << std::hex << dataSize << std::dec); + + for (sal_uInt32 i=0; i<dataSize; i++) + { + rMS.ReadUChar(data); + + if (i % 16 == 0) + hexdata += "\n"; + + OUString padding; + if ((data & 0xF0) == 0) + padding = "0"; + + hexdata += "0x" + padding + OUString::number(data, 16) + " "; + } + + SAL_INFO("cppcanvas.emf", "\t" << hexdata); +#endif + break; + } case EmfPlusRecordTypeGetDC: { SAL_INFO("cppcanvas.emf", "EMF+ GetDC"); @@ -1194,6 +1222,7 @@ namespace emfplushelper // read the layout rectangle float lx, ly, lw, lh; rMS.ReadFloat(lx).ReadFloat(ly).ReadFloat(lw).ReadFloat(lh); + SAL_INFO("cppcanvas.emf", "EMF+ DrawString layoutRect: " << lx << "," << ly << " - " << lw << "x" << lh); // parse the string OUString text = read_uInt16s_ToOUString(rMS, stringLength); diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx index c36626139b4d..99ef9964b945 100644 --- a/drawinglayer/source/tools/emfphelperdata.hxx +++ b/drawinglayer/source/tools/emfphelperdata.hxx @@ -37,7 +37,7 @@ namespace emfplushelper // EMF+ commands #define EmfPlusRecordTypeHeader 0x4001 #define EmfPlusRecordTypeEndOfFile 0x4002 - //TODO EmfPlusRecordTypeComment 0x4003 + #define EmfPlusRecordTypeComment 0x4003 #define EmfPlusRecordTypeGetDC 0x4004 //TODO EmfPlusRecordTypeMultiFormatStart 0x4005 //TODO EmfPlusRecordTypeMultiFormatSection 0x4006 |