[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 4a63deaebf99d92525ff9c4349792c6ab9d5e5a7 Author: Caolán McNamara AuthorDate: Thu Sep 20 09:39:26 2018 +0100 Commit: Caolán McNamara CommitDate: Thu Sep 20 12:41:03 2018 +0200 ofz#10526 check with dynamic_cast its really a EMFPStringFormat Change-Id: Ifbe81b851b17858a915105c102af6f4d8f2c81fa Reviewed-on: https://gerrit.libreoffice.org/60800 Reviewed-by: Michael Stahl Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 509ce5339a55..0adc6c30651b 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -1316,7 +1316,7 @@ namespace emfplushelper const OUString text = read_uInt16s_ToOUString(rMS, stringLength); SAL_INFO("drawinglayer", "EMF+ DrawString string: " << text); // get the stringFormat from the Object table ( this is OPTIONAL and may be nullptr ) -const EMFPStringFormat *stringFormat = static_cast< EMFPStringFormat* >(maEMFPObjects[formatId & 0xff].get()); +const EMFPStringFormat *stringFormat = dynamic_cast(maEMFPObjects[formatId & 0xff].get()); // get the font from the flags const EMFPFont *font = static_cast< EMFPFont* >( maEMFPObjects[flags & 0xff].get() ); if (!font) @@ -1347,7 +1347,7 @@ namespace emfplushelper double stringAlignmentHorizontalOffset = 0.0; if (stringFormat) { -SAL_WARN_IF(stringFormat && stringFormat->DirectionRightToLeft(), "drawinglayer", "EMF+ DrawString Alignment TODO For a right-to-left layout rectangle, the origin should be at the upper right."); + SAL_WARN_IF(stringFormat->DirectionRightToLeft(), "drawinglayer", "EMF+ DrawString Alignment TODO For a right-to-left layout rectangle, the origin should be at the upper right."); if (stringFormat->stringAlignment == StringAlignmentNear) // Alignment is to the left side of the layout rectangle (lx, ly, lw, lh) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx |6 +++--- drawinglayer/source/tools/emfphelperdata.hxx |4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 6f609433730ecdbc23096b9362df596a0b703d37 Author: Bartosz Kosiorek Date: Fri Dec 1 23:11:45 2017 +0100 tdf#109340 Improve performance by reducing matrix multiplication Multiplication of two B2DHomMatrix with operator* is very CPU expensive, because 24 of double-precision floating point multiplication needs to be performed. With this patch I have reduced Multiplication of matrix, by creating combined Scale and Transform matrix at once. It allows to reduce matrix multiplication by one, and improve import time. Change-Id: I85fde6354e458659a0214514c6e05b8e2ee04185 Reviewed-on: https://gerrit.libreoffice.org/45828 Tested-by: Jenkins Reviewed-by: Patrick Jaap Reviewed-by: Thorsten Behrens diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index bd1f9e9b071a..a5dda5d2ad96 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -283,8 +283,8 @@ namespace emfplushelper // To evtl. correct and see where this came from, please compare with the implementations // of EmfPlusHelperData::MapToDevice and EmfPlusHelperData::Map* in prev versions maMapTransform = maWorldTransform; -maMapTransform *= basegfx::utils::createScaleB2DHomMatrix(100.0 * mnMmX / mnPixX, 100.0 * mnMmY / mnPixY); -maMapTransform *= basegfx::utils::createTranslateB2DHomMatrix(double(-mnFrameLeft), double(-mnFrameTop)); +maMapTransform *= basegfx::utils::createScaleTranslateB2DHomMatrix(100.0 * mnMmX / mnPixX, 100.0 * mnMmY / mnPixY, + double(-mnFrameLeft), double(-mnFrameTop)); maMapTransform *= maBaseTransform; } @@ -812,7 +812,7 @@ namespace emfplushelper { sal_uInt32 header, version; - rMS.ReadUInt32(header).ReadUInt32(version).ReadInt32(mnHDPI).ReadInt32(mnVDPI); + rMS.ReadUInt32(header).ReadUInt32(version).ReadUInt32(mnHDPI).ReadUInt32(mnVDPI); SAL_INFO("drawinglayer", "EMF+ Header"); SAL_INFO("drawinglayer", "EMF+\theader: 0x" << std::hex << header << " version: " << std::dec << version << " horizontal DPI: " << mnHDPI << " vertical DPI: " << mnVDPI << " dual: " << (flags & 1)); break; diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx index 431e9b0a5c72..729835307633 100644 --- a/drawinglayer/source/tools/emfphelperdata.hxx +++ b/drawinglayer/source/tools/emfphelperdata.hxx @@ -198,8 +198,8 @@ namespace emfplushelper float mfPageScale; sal_Int32 mnOriginX; sal_Int32 mnOriginY; -sal_Int32 mnHDPI; -sal_Int32 mnVDPI; +sal_uInt32 mnHDPI; +sal_uInt32 mnVDPI; /* EMF+ emf header info */ sal_Int32 mnFrameLeft; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source
drawinglayer/source/texture/texture3d.cxx | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) New commits: commit 0a2035492c66bc323d84ad6c2c4cbc0dc3c9d9aa Author: Caolán McNamara Date: Mon May 28 21:36:16 2018 +0100 forcepoint#41 null deref Change-Id: I16e9e083811c6e14861da1ba1df7d46e8c8771d7 Reviewed-on: https://gerrit.libreoffice.org/54974 Tested-by: Jenkins Reviewed-by: Christian Lohmaier diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx index 2120b8f04280..91604803f8eb 100644 --- a/drawinglayer/source/texture/texture3d.cxx +++ b/drawinglayer/source/texture/texture3d.cxx @@ -74,8 +74,6 @@ namespace drawinglayer { // #121194# Todo: use alpha channel, too (for 3d) maBitmap = maBitmapEx.GetBitmap(); -mpReadBitmap = Bitmap::ScopedReadAccess(maBitmap); -OSL_ENSURE(mpReadBitmap, "GeoTexSvxBitmapEx: Got no read access to Bitmap (!)"); if(mbIsTransparent) { @@ -92,8 +90,13 @@ namespace drawinglayer mpReadTransparence = Bitmap::ScopedReadAccess(maTransparence); } -mfMulX = (double)mpReadBitmap->Width() / maSize.getX(); -mfMulY = (double)mpReadBitmap->Height() / maSize.getY(); +mpReadBitmap = Bitmap::ScopedReadAccess(maBitmap); +SAL_WARN_IF(!mpReadBitmap, "drawinglayer", "GeoTexSvxBitmapEx: Got no read access to Bitmap"); +if (mpReadBitmap) +{ +mfMulX = static_cast(mpReadBitmap->Width()) / maSize.getX(); +mfMulY = static_cast(mpReadBitmap->Height()) / maSize.getY(); +} if(maSize.getX() <= 1.0) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit d5db9b8a8f99bed76c9a3e195a28049d677610a9 Author: Caolán McNamara Date: Tue Jun 12 12:14:36 2018 +0100 forcepoint#45 object may not be a EMFPPen Change-Id: Ifb5c17e13faf6e9d246e1668ef7916957a5296b6 Reviewed-on: https://gerrit.libreoffice.org/55679 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index ee0bf69c4ac0..2c49949870f4 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -396,7 +396,7 @@ namespace emfplushelper void EmfPlusHelperData::EMFPPlusDrawPolygon(const ::basegfx::B2DPolyPolygon& polygon, sal_uInt32 penIndex) { -const EMFPPen* pen = static_cast(maEMFPObjects[penIndex & 0xff].get()); +const EMFPPen* pen = dynamic_cast(maEMFPObjects[penIndex & 0xff].get()); SAL_WARN_IF(!pen, "drawinglayer", "emf+ missing pen"); if (pen && polygon.count()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx |9 + 1 file changed, 9 insertions(+) New commits: commit 8e5441469e07e85c5bd278ac5777eb2b550f900a Author: Caolán McNamara Date: Tue Jun 26 11:58:30 2018 +0100 forcepoint#47 bail when we detect the emf is broken Change-Id: I065635393763af774b45cbba6bd85c4334383b93 Reviewed-on: https://gerrit.libreoffice.org/56458 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 2c49949870f4..509ce5339a55 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -837,12 +837,21 @@ namespace emfplushelper next = rMS.Tell() + (size - 12); if (size < 12) +{ SAL_WARN("drawinglayer", "Size field is less than 12 bytes"); +break; +} else if (size > length) +{ SAL_WARN("drawinglayer", "Size field is greater than bytes left"); +break; +} if (dataSize > (size - 12)) +{ SAL_WARN("drawinglayer", "DataSize field is greater than Size-12"); +break; +} SAL_INFO("drawinglayer", "EMF+ record size: " << size << " type: " << emfTypeToName(type) << " flags: " << flags << " data size: " << dataSize); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) New commits: commit 94c1f958d381b715816921f80e4142a052b77242 Author: Caolán McNamara Date: Mon Mar 26 12:14:23 2018 +0100 forcepoint #32 survive missing emf paths Change-Id: Ic27c3bbac12f66b30ff2f30f558180127cc73a51 Reviewed-on: https://gerrit.libreoffice.org/51874 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index a5dda5d2ad96..09c3a2854aab 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -938,7 +938,11 @@ namespace emfplushelper rMS.ReadUInt32(brushIndexOrColor); SAL_INFO("drawinglayer", "EMF+ FillPath slot: " << index); - EMFPPlusFillPolygon(static_cast(maEMFPObjects[index].get())->GetPolygon(*this), flags & 0x8000, brushIndexOrColor); +EMFPPath* path = static_cast(maEMFPObjects[index].get()); +if (path) +EMFPPlusFillPolygon(path->GetPolygon(*this), flags & 0x8000, brushIndexOrColor); +else +SAL_WARN("drawinglayer", "EmfPlusRecordTypeFillPath missing path"); } break; case EmfPlusRecordTypeFillRegion: @@ -1061,10 +1065,12 @@ namespace emfplushelper rMS.ReadUInt32(penIndex); SAL_INFO("drawinglayer", "EMF+ DrawPath"); SAL_INFO("drawinglayer", "EMF+\tpen: " << penIndex); -EMFPPath* path = static_cast(maEMFPObjects[flags & 0xff].get()); -SAL_WARN_IF(!path, "drawinglayer", "EmfPlusRecordTypeDrawPath missing path"); -EMFPPlusDrawPolygon(path->GetPolygon(*this), penIndex); +EMFPPath* path = static_cast(maEMFPObjects[flags & 0xff].get()); +if (path) +EMFPPlusDrawPolygon(path->GetPolygon(*this), penIndex); +else +SAL_WARN("drawinglayer", "EmfPlusRecordTypeDrawPath missing path"); break; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 7127598586faf612250129f1914c8a0ee9de5a5a Author: Caolán McNamara Date: Mon Mar 26 12:49:54 2018 +0100 forcepoint #33 ensure payload is a EMFPPath Change-Id: I0a9f332cc66e43caa4e1611006fa765cad063539 Reviewed-on: https://gerrit.libreoffice.org/51915 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 09c3a2854aab..679a47c1a7f3 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -938,7 +938,7 @@ namespace emfplushelper rMS.ReadUInt32(brushIndexOrColor); SAL_INFO("drawinglayer", "EMF+ FillPath slot: " << index); -EMFPPath* path = static_cast(maEMFPObjects[index].get()); +EMFPPath* path = dynamic_cast(maEMFPObjects[index].get()); if (path) EMFPPlusFillPolygon(path->GetPolygon(*this), flags & 0x8000, brushIndexOrColor); else @@ -1066,7 +1066,7 @@ namespace emfplushelper SAL_INFO("drawinglayer", "EMF+ DrawPath"); SAL_INFO("drawinglayer", "EMF+\tpen: " << penIndex); -EMFPPath* path = static_cast(maEMFPObjects[flags & 0xff].get()); +EMFPPath* path = dynamic_cast(maEMFPObjects[flags & 0xff].get()); if (path) EMFPPlusDrawPolygon(path->GetPolygon(*this), penIndex); else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx | 33 + drawinglayer/source/tools/emfpstringformat.cxx | 16 ++-- drawinglayer/source/tools/emfpstringformat.hxx |8 +++--- 3 files changed, 46 insertions(+), 11 deletions(-) New commits: commit 32e7640dc6113945fcd48ce3c0e74cf095da9670 Author: Bartosz Kosiorek Date: Tue Apr 10 22:15:01 2018 +0200 tdf#106084 EMF+ Implement String aligment and Leading/Trailing Margin. Many users noticing that EMF DrawString is shifted horizontally in same cases. It is caused by missing implementation of: - StringAlignment: Near: Alignment is to the left side of the layout rectangle Center: Specifies that alignment is centered between the origin and extent of the layout rectangle. Far: Alignment is to the right side of the layout rectangle - Leading Margin: specifies the length of the space to add to the starting position of a string - trailing Margin: Length of the space to leave following a string. With this path this missing parameters are implemented. It was tested with document: https://bugs.documentfoundation.org/attachment.cgi?id=131334 In following document StringAlignmentCenter and LeadingMargin is not set: https://bugs.documentfoundation.org/attachment.cgi?id=124180 I make sure that there is no regression (the image should be displayed as without the patch. Change-Id: I7909a1d02ffd558a3bf91bd41f6945830252724d Reviewed-on: https://gerrit.libreoffice.org/52696 Tested-by: Jenkins Reviewed-by: Patrick Jaap Reviewed-by: Bartosz Kosiorek (cherry picked from commit ba662ea44083107f10184a4f01b94f9b8e3ed3dc) Reviewed-on: https://gerrit.libreoffice.org/52808 Reviewed-by: Armin Le Grand diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 0afabe77302d..8991b2f381b9 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -107,6 +107,13 @@ namespace emfplushelper { } +typedef enum +{ +StringAlignmentNear = 0x, +StringAlignmentCenter = 0x0001, +StringAlignmentFar = 0x0002 +} StringAlignment; + void EmfPlusHelperData::processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, bool bUseWholeStream) { sal_uInt32 index; @@ -1251,12 +1258,12 @@ namespace emfplushelper SAL_INFO("drawinglayer", "EMF+ DrawString layoutRect: " << lx << "," << ly << " - " << lw << "x" << lh); // parse the string -OUString text = read_uInt16s_ToOUString(rMS, stringLength); +const OUString text = read_uInt16s_ToOUString(rMS, stringLength); SAL_INFO("drawinglayer", "EMF+ DrawString string: " << text); // get the stringFormat from the Object table ( this is OPTIONAL and may be nullptr ) -EMFPStringFormat *stringFormat = static_cast< EMFPStringFormat* >(maEMFPObjects[formatId & 0xff].get()); +const EMFPStringFormat *stringFormat = static_cast< EMFPStringFormat* >(maEMFPObjects[formatId & 0xff].get()); // get the font from the flags -EMFPFont *font = static_cast< EMFPFont* >( maEMFPObjects[flags & 0xff].get() ); +const EMFPFont *font = static_cast< EMFPFont* >( maEMFPObjects[flags & 0xff].get() ); if (!font) { break; @@ -1282,8 +1289,24 @@ namespace emfplushelper false); // BiDiStrong css::lang::Locale locale; +double stringAlignmentHorizontalOffset = 0.0; if (stringFormat) { +SAL_WARN_IF(stringFormat && stringFormat->DirectionRightToLeft(), "drawinglayer", "EMF+ DrawString Alignment TODO For a right-to-left layout rectangle, the origin should be at the upper right."); +if (stringFormat->stringAlignment == StringAlignmentNear) +// Alignment is to the left side of the layout rectangle (lx, ly, lw, lh) +{ +stringAlignmentHorizontalOffset = stringFormat->leadingMargin * font->emSize; +} else if (stringFormat->stringAlignment == StringAlignmentCenter) +// Alignment is centered between the origin and extent of the layout rectangle +
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx | 12 ++-- drawinglayer/source/tools/emfppath.cxx |5 + 2 files changed, 7 insertions(+), 10 deletions(-) New commits: commit 5024688f5e2d99b704fff05d2dddf12c397a4aa9 Author: Bartosz Kosiorek Date: Fri Apr 13 16:56:29 2018 +0200 tdf#55058 EMF+ Properly close shapes with "setClosed" method. With previous implementation of closing shapes, we are adding new line between last and first point. It was causing wrong border shape during displaying. With this patch proper method was used to fix that. Change-Id: If0a084700401edd9d3b8a57cb27154079828e6ed Reviewed-on: https://gerrit.libreoffice.org/52857 Tested-by: Jenkins Reviewed-by: Patrick Jaap Reviewed-by: Armin Le Grand diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 8991b2f381b9..2b123372b908 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -1020,7 +1020,7 @@ namespace emfplushelper // Silent MSVC warning C4701: potentially uninitialized local variable 'brushIndexOrColor' used sal_uInt32 brushIndexOrColor = 999; sal_Int32 rectangles; -bool isColor = (flags & 0x8000); +const bool isColor = (flags & 0x8000); ::basegfx::B2DPolygon polygon; if (EmfPlusRecordTypeFillRects == type) @@ -1040,14 +1040,14 @@ namespace emfplushelper { float x, y, width, height; ReadRectangle(rMS, x, y, width, height, bool(flags & 0x4000)); - +polygon.clear(); polygon.append(Map(x, y)); polygon.append(Map(x + width, y)); polygon.append(Map(x + width, y + height)); polygon.append(Map(x, y + height)); -polygon.append(Map(x, y)); +polygon.setClosed(true); -SAL_INFO("drawinglayer", "EMF+\trectangle: " << x << ", " << width << "x" << height); +SAL_INFO("drawinglayer", "EMF+\t rectangle: " << x << ", "<< y << " " << width << "x" << height); ::basegfx::B2DPolyPolygon polyPolygon(polygon); if (type == EmfPlusRecordTypeFillRects) @@ -1059,13 +1059,13 @@ namespace emfplushelper } case EmfPlusRecordTypeFillPolygon: { -sal_uInt8 index = flags & 0xff; +const sal_uInt8 index = flags & 0xff; sal_uInt32 brushIndexOrColor; sal_Int32 points; rMS.ReadUInt32(brushIndexOrColor); rMS.ReadInt32(points); -SAL_INFO("drawinglayer", "EMF+ FillPolygon in slot: " << +index << " points: " << points); +SAL_INFO("drawinglayer", "EMF+ FillPolygon in slot: " << index << " points: " << points); SAL_INFO("drawinglayer", "EMF+\t: " << ((flags & 0x8000) ? "color" : "brush index") << " 0x" << std::hex << brushIndexOrColor << std::dec); EMFPPath path(points, true); diff --git a/drawinglayer/source/tools/emfppath.cxx b/drawinglayer/source/tools/emfppath.cxx index 8e0d2b159a20..5ba8048d0bd4 100644 --- a/drawinglayer/source/tools/emfppath.cxx +++ b/drawinglayer/source/tools/emfppath.cxx @@ -156,10 +156,7 @@ namespace emfplushelper // Draw an extra line between the last point and the first point, to close the shape. if (bAddLineToCloseShape) { -if (bMapIt) -polygon.append (rR.Map (pPoints [0], pPoints [1]) ); -else -polygon.append (::basegfx::B2DPoint (pPoints [0], pPoints [1]) ); +polygon.setClosed (true); } if (polygon.count ()) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source
drawinglayer/source/tools/emfphelperdata.cxx | 10 +- drawinglayer/source/tools/emfphelperdata.hxx |1 + 2 files changed, 10 insertions(+), 1 deletion(-) New commits: commit 674e8c5412e938191ad3e928e9a52b5420bec85c Author: Bartosz Kosiorek Date: Sun Apr 15 02:00:16 2018 +0200 tdf#53485 tdf#117015 EMF+ Fix for displaying EMF+ files where GetDC is used With EMF+ Only mode, still the EMF records could be used for displaying objects, by using Get Device Context (GetDC). Files identified as EMF+ Only can contain both EMF+ records and EMF records. All EMF+ records are used to render the image. The EMF records that are part of the drawing are those preceded by a Get Device Context record. Unfortunately after finishing EMF drawing, the clip region was not reset. As a result records after EMF record was not displayed. With this patch, the issue was fixed by resetting clip region. Change-Id: I998b14e7c3b56a7711ba6a7bec08ec2097e0dfce Reviewed-on: https://gerrit.libreoffice.org/52897 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek (cherry picked from commit a2851d562cdfaf06e5f767030677846f3f129b1c) Reviewed-on: https://gerrit.libreoffice.org/53093 Reviewed-by: Armin Le Grand Tested-by: Bartosz Kosiorek diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 2b123372b908..bd7b4d90a40f 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -714,7 +714,8 @@ namespace emfplushelper mMFlags(0), mMStream(), mrTargetHolders(rTargetHolders), -mrPropertyHolders(rPropertyHolders) +mrPropertyHolders(rPropertyHolders), +bIsGetDCProcessing(false) { rMS.ReadInt32(mnFrameLeft).ReadInt32(mnFrameTop).ReadInt32(mnFrameRight).ReadInt32(mnFrameBottom); SAL_INFO("drawinglayer", "EMF+ picture frame: " << mnFrameLeft << "," << mnFrameTop << " - " << mnFrameRight << "," << mnFrameBottom); @@ -807,6 +808,12 @@ namespace emfplushelper SAL_INFO("drawinglayer", "EMF+ record size: " << size << " type: " << emfTypeToName(type) << " flags: " << flags << " data size: " << dataSize); +if (bIsGetDCProcessing) +{ +SAL_INFO("drawinglayer", "EMF+ Resets the current clipping region for the world space to infinity."); +wmfemfhelper::HandleNewClipRegion(::basegfx::B2DPolyPolygon(), mrTargetHolders, mrPropertyHolders); +bIsGetDCProcessing = false; +} if (type == EmfPlusRecordTypeObject && ((mbMultipart && (flags & 0x7fff) == (mMFlags & 0x7fff)) || (flags & 0x8000))) { if (!mbMultipart) @@ -881,6 +888,7 @@ namespace emfplushelper } case EmfPlusRecordTypeGetDC: { +bIsGetDCProcessing = true; SAL_INFO("drawinglayer", "EMF+ GetDC"); SAL_INFO("drawinglayer", "EMF+\talready used in svtools wmf/emf filter parser"); break; diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx index ba58686088f9..3c03af6d17f3 100644 --- a/drawinglayer/source/tools/emfphelperdata.hxx +++ b/drawinglayer/source/tools/emfphelperdata.hxx @@ -223,6 +223,7 @@ namespace emfplushelper /// data holders wmfemfhelper::TargetHolders&mrTargetHolders; wmfemfhelper::PropertyHolders& mrPropertyHolders; +boolbIsGetDCProcessing; // readers void processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, bool bUseWholeStream = false); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source
drawinglayer/source/tools/emfpfont.cxx |3 + drawinglayer/source/tools/emfphelperdata.cxx | 49 --- drawinglayer/source/tools/emfphelperdata.hxx |2 + drawinglayer/source/tools/emfppen.cxx|2 + 4 files changed, 51 insertions(+), 5 deletions(-) New commits: commit e58dc868a6ac0df24adf88f32f90a9e4fc6fdae9 Author: Bartosz Kosiorek Date: Wed Apr 11 01:05:01 2018 +0200 tdf#113624 EMF+ Add support for different units conversion With previous implementation only Pixel unit was supported. Other units (eg. inch, milimeters, points, world) was treated as Pixel. With this patch the correct unit conversion was implemented to following records: - FontObject - PenObject - SetWorldTransform As a result records are properly scaled. Tested with DrawString record from: https://bugs.documentfoundation.org/attachment.cgi?id=140287 Change-Id: I77435ad8f1bbac08f298a03d91d0c7f1f1734e5c Reviewed-on: https://gerrit.libreoffice.org/52825 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek diff --git a/drawinglayer/source/tools/emfpfont.cxx b/drawinglayer/source/tools/emfpfont.cxx index 6c1b1a8e06c3..4c6d162dac11 100644 --- a/drawinglayer/source/tools/emfpfont.cxx +++ b/drawinglayer/source/tools/emfpfont.cxx @@ -49,6 +49,9 @@ namespace emfplushelper SAL_INFO("drawinglayer", "EMF+\tfont\nEMF+\theader: 0x" << std::hex << (header >> 12) << " version: 0x" << (header & 0x1fff) << " size: " << std::dec << emSize << " unit: 0x" << std::hex << sizeUnit << std::dec); SAL_INFO("drawinglayer", "EMF+\tflags: 0x" << std::hex << fontFlags << " reserved: 0x" << reserved << " length: 0x" << std::hex << length << std::dec); +//tdf#113624 Convert unit to Pixels +emSize = emSize * EmfPlusHelperData::getUnitToPixelMultiplier(static_cast(sizeUnit)); + if (length > 0 && length < 0x4000) { rtl_uString *pStr = rtl_uString_alloc(length); diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index bd7b4d90a40f..ee0bf69c4ac0 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -114,6 +114,44 @@ namespace emfplushelper StringAlignmentFar = 0x0002 } StringAlignment; +float EmfPlusHelperData::getUnitToPixelMultiplier(const UnitType aUnitType) +{ +switch (aUnitType) +{ +case UnitTypePixel: +{ +return 1.0f; +} +case UnitTypePoint: +{ +SAL_INFO("drawinglayer", "EMF+\t Converting Points to Pixels."); +return 1.33f; +} +case UnitTypeInch: +{ +SAL_INFO("drawinglayer", "EMF+\t TODO Test Converting Inches to Pixels, if it is working correctly."); +return 96.0f; +} +case UnitTypeMillimeter: +{ +SAL_INFO("drawinglayer", "EMF+\t TODO Test Converting Milimeters to Pixels, if it is working correctly."); +return 3.779528f; +} +case UnitTypeDocument: +{ +SAL_INFO("drawinglayer", "EMF+\t TODO Test Converting Documents to Pixels, if it is working correctly."); +return 0.32f; +} +case UnitTypeWorld: +case UnitTypeDisplay: +default: +{ +SAL_WARN("drawinglayer", "EMF+\tTODO Unimplemented support of Unit Type: 0x" << std::hex << aUnitType); +} +} +return 1.0f; +} + void EmfPlusHelperData::processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, bool bUseWholeStream) { sal_uInt32 index; @@ -1245,7 +1283,7 @@ namespace emfplushelper } else { -SAL_WARN("drawinglayer", "EMF+ DrawImage(Points) Wrong EMF+ file. Only Unit Type Pixel is support by EMF+ standard in DrawImage(Points)"); +SAL_WARN("drawinglayer", "EMF+ DrawImage(Points) Wrong EMF+ file. Only Unit Type Pixel is support by EMF+ specification for DrawImage(Points)"); } break; } @@ -1380,14 +1418,15 @@ namespace emfplushelper SAL_INFO("drawinglayer", "EMF+ SetPageTransform"); SAL_INFO("drawinglayer", "EMF+\tscale: " << mfPageScale << " unit: " << flags); -if (flags != UnitTypePixel) +if ((flags == UnitTypeDisplay) || (flags == UnitTypeWorld)) { -SAL_WARN("drawinglayer", "EMF+\t TODO Only UnitTypePixel is supported. "); +
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source vcl/quartz
drawinglayer/source/primitive2d/metafileprimitive2d.cxx | 60 ++-- vcl/quartz/salbmp.cxx | 32 +++- 2 files changed, 52 insertions(+), 40 deletions(-) New commits: commit 6e591f06e39c69c270c8c01e9ed138d315720624 Author: Armin Le Grand Date: Mon Oct 30 16:29:09 2017 +0100 tdf#113197 Add MaskPrimitive (clip) to EMF/WMF if needed Added code to quartz vcl implementation that takes care when BitmapPalette.count != (depth^^2)-1 - which may be the case anytime. If then a bitmap value exists that goes beyond that count, a invalid access was executed Change-Id: Iab332c91b8753aab85e9d365323f5c9e531efab2 Reviewed-on: https://gerrit.libreoffice.org/44058 Reviewed-by: Bartosz Kosiorek Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/53085 Reviewed-by: Armin Le Grand diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index bb3d243b4beb..5ace807a264d 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -20,43 +20,10 @@ #include #include -//#include #include -//#include -//#include -//#include -//#include -//#include -//#include -//#include #include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include +#include +#include using namespace com::sun::star; @@ -74,6 +41,29 @@ namespace drawinglayer { // get target size const ::tools::Rectangle aMtfTarget(getMetaFile().GetPrefMapMode().GetOrigin(), getMetaFile().GetPrefSize()); +const basegfx::B2DRange aMtfRange(aMtfTarget.Left(), aMtfTarget.Top(), aMtfTarget.Right(), aMtfTarget.Bottom()); + +// tdf#113197 get content range and check if we have an overlap with +// defined target range (aMtfRange) +if (!aMtfRange.isEmpty()) +{ +const basegfx::B2DRange aContentRange(xRetval.getB2DRange(rViewInformation)); + +// also test equal since isInside gives also true for equal +if (!aMtfRange.equal(aContentRange) && !aMtfRange.isInside(aContentRange)) +{ +// contentRange is partly larger than aMtfRange (stuff sticks +// outside), clipping is needed +const drawinglayer::primitive2d::Primitive2DReference xMask( +new drawinglayer::primitive2d::MaskPrimitive2D( +basegfx::B2DPolyPolygon( +basegfx::utils::createPolygonFromRect( +aMtfRange)), +xRetval)); + +xRetval = drawinglayer::primitive2d::Primitive2DContainer{ xMask }; +} +} // create transformation basegfx::B2DHomMatrix aAdaptedTransform; diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx index b96e25421686..a74f6096bf5a 100644 --- a/vcl/quartz/salbmp.cxx +++ b/vcl/quartz/salbmp.cxx @@ -451,11 +451,13 @@ class ImplPixelFormat8 : public ImplPixelFormat private: sal_uInt8* pData; const BitmapPalette& mrPalette; +const sal_uInt8 mnPaletteCount; public: explicit ImplPixelFormat8( const BitmapPalette& rPalette ) : pData(nullptr) , mrPalette(rPalette) +, mnPaletteCount(static_cast< sal_uInt8 >(rPalette.GetEntryCount())) { } virtual void StartLine( sal_uInt8* pLine ) override { pData = pLine; } @@ -465,7 +467,13 @@ public: } virtual ColorData ReadPixel() override { -return mrPalette[ *pData++ ].operator Color().GetColor(); +const sal_uInt8 nIndex(*pData++); + +// Caution(!) rPalette.GetEntryCount() may be != (depth^^2)-1 (!) +if(nIndex < mnPaletteCount) +return mrPalette[nIndex].operator Color().GetColor(); +else +return Color(COL_BLACK).GetColor(); } virtual void WritePixel( ColorData nColor ) override { @@ -481,6 +489,7 @@ class ImplPixelFormat4 : public ImplPixelFormat private: sal_uInt8* pData; const BitmapPalette& mrPalette; +const sal_uInt8 mnPaletteCount; sal_uInt32 mnX; sal_uInt32 mnShift; @@ -488,6 +497,7 @@ public: explicit ImplPixelFormat4( const BitmapPalette& rPalette ) : pData(nullptr) , mrPalette(rPalette) +, mnPaletteC
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source emfio/qa svgio/source
drawinglayer/source/tools/emfphelperdata.cxx| 149 +++- drawinglayer/source/tools/emfphelperdata.hxx|4 emfio/qa/cppunit/emf/EmfImportTest.cxx | 26 ++ emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emf |binary svgio/source/svgreader/svganode.cxx |2 svgio/source/svgreader/svggnode.cxx |2 6 files changed, 138 insertions(+), 45 deletions(-) New commits: commit aee1904446cd0508cdf06fd23155373b5018dfed Author: Bartosz Kosiorek Date: Fri Mar 2 01:07:57 2018 +0100 tdf#114738 Add support for transparency for EMF+ records With current EMF+ implementation all filled figures, does not support transparency. This patch add transparency support for following EMF+ records: - DrawDriverString - DrawString - FillEllipse - FillRects - FillPolygon - FillPie - FillPath - FillRegion Change-Id: I1e59ea90bdf5fafc07ff9417fccace44872bbecd Reviewed-on: https://gerrit.libreoffice.org/52021 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 679a47c1a7f3..0afabe77302d 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -27,8 +27,8 @@ #include "emfpstringformat.hxx" #include #include +#include #include -#include #include #include #include @@ -300,19 +300,19 @@ namespace emfplushelper return maMapTransform * ::basegfx::B2DSize(iwidth, iheight); } -::basegfx::BColor EmfPlusHelperData::EMFPGetBrushColorOrARGBColor(sal_uInt16 flags, sal_uInt32 brushIndexOrColor) const { -basegfx::BColor color; +Color EmfPlusHelperData::EMFPGetBrushColorOrARGBColor(const sal_uInt16 flags, const sal_uInt32 brushIndexOrColor) const { +Color color; if (flags & 0x8000) // we use a color { color = Color(0xff - (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, - (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff).getBColor(); + (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff); } else // we use a pen { const EMFPPen* pen = static_cast(maEMFPObjects[brushIndexOrColor & 0xff].get()); if (pen) { -color = pen->GetColor().getBColor(); +color = pen->GetColor(); } } return color; @@ -452,7 +452,7 @@ namespace emfplushelper } } -void EmfPlusHelperData::EMFPPlusFillPolygon(const ::basegfx::B2DPolyPolygon& polygon, bool isColor, sal_uInt32 brushIndexOrColor) +void EmfPlusHelperData::EMFPPlusFillPolygon(const ::basegfx::B2DPolyPolygon& polygon, const bool isColor, const sal_uInt32 brushIndexOrColor) { if (!polygon.count()) return; @@ -460,12 +460,35 @@ namespace emfplushelper if (isColor) // use Color { SAL_INFO("drawinglayer", "EMF+\t Fill polygon, ARGB color: 0x" << std::hex << brushIndexOrColor << std::dec); -mrTargetHolders.Current().append( - o3tl::make_unique( -polygon, -::Color(0xff - (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff).getBColor())); -mrPropertyHolders.Current().setFillColor(::Color(0xff - (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff).getBColor()); +// EMF Alpha (1 byte): An 8-bit unsigned integer that specifies the transparency of the background, +// ranging from 0 for completely transparent to 0xFF for completely opaque. +const Color color = Color(0xff - (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff); +if (color.GetTransparency() < 255) +{ +if (color.GetTransparency() == 0) +{ +// not transparent +mrTargetHolders.Current().append( + o3tl::make_unique( +polygon, +color.getBColor())); +} +else +{ +const drawinglayer::primitive2d::Primitive2DReference aPrimitive( +new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( +polygon, +color.getBColor())); + +mrTargetHolders.Current().append( + o3tl::make_unique( + dr