summaryrefslogtreecommitdiffstats
path: root/emfio/source/reader
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2023-02-03 22:55:54 +0100
committerBartosz Kosiorek <gang65@poczta.onet.pl>2023-02-11 21:24:18 +0000
commitbbdbe8ea2ef176ef6f08b30b3c18876c2c4f0c22 (patch)
treedbe3a2fc31e0290fdafde09102dec42592ed57c5 /emfio/source/reader
parenttdf#45705 Make SID_ZOOM_IN and SID_ZOOM_OUT smoother in Impress (diff)
downloadcore-bbdbe8ea2ef176ef6f08b30b3c18876c2c4f0c22.tar.gz
core-bbdbe8ea2ef176ef6f08b30b3c18876c2c4f0c22.zip
tdf#142018 Properly create Pen width if style is COSMETIC
Change-Id: I6453058c4af352a3b0e14cbccbc1a67c73cd1426 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146551 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'emfio/source/reader')
-rw-r--r--emfio/source/reader/emfreader.cxx25
-rw-r--r--emfio/source/reader/mtftools.cxx4
2 files changed, 18 insertions, 11 deletions
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index c24a053d3bc1..be4c8319238b 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1154,13 +1154,17 @@ namespace emfio
mpInputStream->ReadUInt32(nIndex);
if ((nIndex & ENHMETA_STOCK_OBJECT) == 0)
{
- sal_uInt32 nStyle(0);
+ sal_uInt32 nPenStyle(0);
sal_Int32 nPenWidth(0), nIgnored;
- mpInputStream->ReadUInt32(nStyle).ReadInt32(nPenWidth).ReadInt32(nIgnored);
+ mpInputStream->ReadUInt32(nPenStyle).ReadInt32(nPenWidth).ReadInt32(nIgnored);
SAL_INFO("emfio", "\t\tIndex: " << nIndex << " Style: 0x" << std::hex
- << nStyle << std::dec
+ << nPenStyle << std::dec
<< " PenWidth: " << nPenWidth);
- CreateObjectIndexed(nIndex, std::make_unique<WinMtfLineStyle>(ReadColor(), nStyle, nPenWidth));
+ if ((nPenStyle & PS_STYLE_MASK) > PS_INSIDEFRAME)
+ nPenStyle = PS_COSMETIC;
+ if ((nPenStyle & PS_GEOMETRIC) == 0)
+ nPenWidth = 0;
+ CreateObjectIndexed(nIndex, std::make_unique<WinMtfLineStyle>(ReadColor(), nPenStyle, nPenWidth));
}
}
break;
@@ -1170,12 +1174,15 @@ namespace emfio
mpInputStream->ReadUInt32(nIndex);
if ((nIndex & ENHMETA_STOCK_OBJECT) == 0)
{
- sal_uInt32 offBmi, cbBmi, offBits, cbBits, nStyle, nWidth, nBrushStyle, elpNumEntries;
+ sal_uInt32 offBmi, cbBmi, offBits, cbBits, nPenStyle, nWidth, nBrushStyle, elpNumEntries;
sal_Int32 elpHatch;
mpInputStream->ReadUInt32(offBmi).ReadUInt32(cbBmi).ReadUInt32(offBits).ReadUInt32(cbBits);
- mpInputStream->ReadUInt32(nStyle).ReadUInt32(nWidth).ReadUInt32(nBrushStyle);
-
- SAL_INFO("emfio", "\t\tStyle: 0x" << std::hex << nStyle << std::dec);
+ mpInputStream->ReadUInt32(nPenStyle).ReadUInt32(nWidth).ReadUInt32(nBrushStyle);
+ SAL_INFO("emfio", "\t\tStyle: 0x" << std::hex << nPenStyle << std::dec);
+ if ((nPenStyle & PS_STYLE_MASK) > PS_INSIDEFRAME)
+ nPenStyle = PS_COSMETIC;
+ if ((nPenStyle & PS_GEOMETRIC) == 0)
+ nWidth = 0;
SAL_INFO("emfio", "\t\tWidth: " << nWidth);
Color aColorRef = ReadColor();
mpInputStream->ReadInt32(elpHatch).ReadUInt32(elpNumEntries);
@@ -1183,7 +1190,7 @@ namespace emfio
if (!mpInputStream->good())
bStatus = false;
else
- CreateObjectIndexed(nIndex, std::make_unique<WinMtfLineStyle>(aColorRef, nStyle, nWidth));
+ CreateObjectIndexed(nIndex, std::make_unique<WinMtfLineStyle>(aColorRef, nPenStyle, nWidth));
}
}
break;
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 7f067e4fcd15..5b82c54daa21 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -791,12 +791,12 @@ namespace emfio
break;
case StockObject::WHITE_PEN :
{
- maLineStyle = WinMtfLineStyle( COL_WHITE );
+ maLineStyle = WinMtfLineStyle(COL_WHITE, PS_COSMETIC, 0);
}
break;
case StockObject::BLACK_PEN :
{
- maLineStyle = WinMtfLineStyle( COL_BLACK );
+ maLineStyle = WinMtfLineStyle(COL_BLACK, PS_COSMETIC, 0);
}
break;
case StockObject::NULL_PEN :