[Libreoffice-commits] core.git: cppcanvas/source
Bartosz Kosiorek
gang65 at poczta.onet.pl
Mon May 8 22:05:21 UTC 2017
cppcanvas/source/mtfrenderer/emfplus.cxx | 6 ++++++
cppcanvas/source/mtfrenderer/emfppath.cxx | 17 +++++++++--------
2 files changed, 15 insertions(+), 8 deletions(-)
New commits:
commit 4c40aeeaf37bb3c0b780e7b0c2f9afe8c06091f5
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date: Mon May 8 23:10:42 2017 +0200
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 at poczta.onet.pl>
Tested-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>
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]);
}
}
More information about the Libreoffice-commits
mailing list