diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2017-05-08 23:10:42 +0200 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2017-05-09 00:04:44 +0200 |
commit | 4c40aeeaf37bb3c0b780e7b0c2f9afe8c06091f5 (patch) | |
tree | 3040652119a06387f029731023b61db28ab47c7f /cppcanvas/source | |
parent | 7b186db4be163dbbbac313310c60c724a87532d9 (diff) |
tdf#31814 EMF+ Fix an issue when not all elements were displayed
On on EMF+ images generated by ChemDraw, some elements were not displayed.
After investigation, occurs that position of points was not read
properly in same cases. This commit fixes such cases.
Change-Id: I1d01d8defc41f4e437a669ef1268b8e33823cfc1
Reviewed-on: https://gerrit.libreoffice.org/37406
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Tested-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'cppcanvas/source')
-rw-r--r-- | cppcanvas/source/mtfrenderer/emfplus.cxx | 6 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/emfppath.cxx | 17 |
2 files changed, 15 insertions, 8 deletions
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 4d4bfb528d61..9db632d19413 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -233,6 +233,12 @@ namespace cppcanvas void ImplRenderer::ReadPoint (SvStream& s, float& x, float& y, sal_uInt32 flags) { + if (flags & 0x800) { + // specifies a location in the coordinate space that is relative to + // the location specified by the previous element in the array. In the case of the first element in + // PointData, a previous location at coordinates (0,0) is assumed. + SAL_WARN("cppcanvas.emf", "EMF+\t\t TODO Relative coordinates bit detected. Implement parse EMFPlusPointR"); + } if (flags & 0x4000) { sal_Int16 ix, iy; diff --git a/cppcanvas/source/mtfrenderer/emfppath.cxx b/cppcanvas/source/mtfrenderer/emfppath.cxx index 034e6419ccd7..d924ce61d816 100644 --- a/cppcanvas/source/mtfrenderer/emfppath.cxx +++ b/cppcanvas/source/mtfrenderer/emfppath.cxx @@ -67,22 +67,23 @@ namespace cppcanvas void EMFPPath::Read (SvStream& s, sal_uInt32 pathFlags, ImplRenderer& rR) { for (int i = 0; i < nPoints; i ++) { - if (pathFlags & 0x4000) { + if (pathFlags & 0x800) { + // EMFPlusPointR: points are stored in EMFPlusInteger7 or + // EMFPlusInteger15 objects, see section 2.2.2.21/22 + // If 0x800 bit is set, the 0x4000 bit is undefined and must be ignored + SAL_WARN("cppcanvas.emf", "EMF+\t\t TODO - parse EMFPlusPointR object (section 2.2.1.6)"); + } else if (pathFlags & 0x4000) { // EMFPlusPoint: stored in signed short 16bit integer format sal_Int16 x, y; s.ReadInt16( x ).ReadInt16( y ); - SAL_INFO ("cppcanvas.emf", "EMF+\tEMFPlusPoint [x,y]: " << x << "," << y); + SAL_INFO ("cppcanvas.emf", "EMF+\t EMFPlusPoint [x,y]: " << x << "," << y); pPoints [i*2] = x; pPoints [i*2 + 1] = y; - } else if (!(pathFlags & 0xC000)) { + } else { // EMFPlusPointF: stored in Single (float) format s.ReadFloat( pPoints [i*2] ).ReadFloat( pPoints [i*2 + 1] ); - SAL_INFO ("cppcanvas.emf", "EMF+\tEMFPlusPointF [x,y]: " << pPoints [i*2] << "," << pPoints [i*2 + 1]); - } else { //if (pathFlags & 0x8000) - // EMFPlusPointR: points are stored in EMFPlusInteger7 or - // EMFPlusInteger15 objects, see section 2.2.2.21/22 - SAL_INFO("cppcanvas.emf", "EMF+\t\tTODO - parse EMFPlusPointR object (section 2.2.1.6)"); + SAL_INFO ("cppcanvas.emf", "EMF+\t EMFPlusPointF [x,y]: " << pPoints [i*2] << "," << pPoints [i*2 + 1]); } } |