sw/source/core/layout/wsfrm.cxx | 11 ++- vcl/qt5/QtFrame.cxx | 5 - vcl/qt5/QtGraphics_GDI.cxx | 66 ++++-------------- xmloff/source/text/XMLSectionFootnoteConfigImport.cxx | 4 - 4 files changed, 29 insertions(+), 57 deletions(-)
New commits: commit e550dc702299fdaa146a24ff872ef3a3b2adeafd Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Fri May 27 19:08:41 2022 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun May 29 21:39:48 2022 +0200 tdf#144601 Qt fix creating QImage with alpha mask Rechecking the QImage documentation, this actually can be easily done; no more bit twiddling, which I got wrong to begin with. LO's alpha mask is inverted to Qt's expectations, but we have invertPixels() and then apply it with setAlphaChannel(). And we can even set the fAlpha using setOpacity()! Change-Id: If2030d3f87d3a4698d1cd9af005d307c2ee63061 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135044 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de> Tested-by: Jenkins (cherry picked from commit 6959a18d1a8fea4d65498083dc3ba05f640d0f39) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135060 diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx index f87de50827df..6849a3bc7bde 100644 --- a/vcl/qt5/QtGraphics_GDI.cxx +++ b/vcl/qt5/QtGraphics_GDI.cxx @@ -601,55 +601,24 @@ bool QtGraphicsBackend::blendAlphaBitmap(const SalTwoRect&, const SalBitmap& /*r return false; } -static bool getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap, - QImage& rAlphaImage) +static QImage getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap) { - if (rAlphaBitmap.GetBitCount() != 8 && rAlphaBitmap.GetBitCount() != 1) - { - SAL_WARN("vcl.gdi", "unsupported alpha depth case: " << rAlphaBitmap.GetBitCount()); - return false; - } + assert(rSourceBitmap.GetSize() == rAlphaBitmap.GetSize()); + assert(rAlphaBitmap.GetBitCount() == 8 || rAlphaBitmap.GetBitCount() == 1); - const QImage* pBitmap = static_cast<const QtBitmap*>(&rSourceBitmap)->GetQImage(); - const QImage* pAlpha = static_cast<const QtBitmap*>(&rAlphaBitmap)->GetQImage(); - rAlphaImage = pBitmap->convertToFormat(Qt_DefaultFormat32); + QImage aAlphaMask = *static_cast<const QtBitmap*>(&rAlphaBitmap)->GetQImage(); + aAlphaMask.invertPixels(); - if (rAlphaBitmap.GetBitCount() == 8) - { - for (int y = 0; y < rAlphaImage.height(); ++y) - { - uchar* image_line = rAlphaImage.scanLine(y); - const uchar* alpha_line = pAlpha->scanLine(y); - for (int x = 0; x < rAlphaImage.width(); ++x, image_line += 4) - image_line[3] = 255 - alpha_line[x]; - } - } - else - { - for (int y = 0; y < rAlphaImage.height(); ++y) - { - uchar* image_line = rAlphaImage.scanLine(y); - const uchar* alpha_line = pAlpha->scanLine(y); - for (int x = 0; x < rAlphaImage.width(); ++x, image_line += 4) - { - if (x && !(x % 8)) - ++alpha_line; - if (0 != (*alpha_line & (1 << (7 - x % 8)))) - image_line[3] = 0; - } - } - } - - return true; + const QImage* pBitmap = static_cast<const QtBitmap*>(&rSourceBitmap)->GetQImage(); + QImage aImage = pBitmap->convertToFormat(Qt_DefaultFormat32); + aImage.setAlphaChannel(aAlphaMask); + return aImage; } bool QtGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap) { - QImage aImage; - if (!getAlphaImage(rSourceBitmap, rAlphaBitmap, aImage)) - return false; - drawScaledImage(rPosAry, aImage); + drawScaledImage(rPosAry, getAlphaImage(rSourceBitmap, rAlphaBitmap)); return true; } @@ -659,20 +628,17 @@ bool QtGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull, const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap, double fAlpha) { - if (fAlpha != 1.0) - return false; QImage aImage; - if (pAlphaBitmap && !getAlphaImage(rSourceBitmap, *pAlphaBitmap, aImage)) - return false; + if (!pAlphaBitmap) + aImage = *static_cast<const QtBitmap*>(&rSourceBitmap)->GetQImage(); else - { - const QImage* pBitmap = static_cast<const QtBitmap*>(&rSourceBitmap)->GetQImage(); - aImage = pBitmap->convertToFormat(Qt_DefaultFormat32); - } + aImage = getAlphaImage(rSourceBitmap, *pAlphaBitmap); - QtPainter aPainter(*this); const basegfx::B2DVector aXRel = rX - rNull; const basegfx::B2DVector aYRel = rY - rNull; + + QtPainter aPainter(*this); + aPainter.setOpacity(fAlpha); aPainter.setTransform(QTransform(aXRel.getX() / aImage.width(), aXRel.getY() / aImage.width(), aYRel.getX() / aImage.height(), aYRel.getY() / aImage.height(), rNull.getX(), rNull.getY())); commit fb675d307ab0e75aa36eabeb764b1fbbb0f459f1 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue May 24 15:20:42 2022 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun May 29 21:39:48 2022 +0200 sw: fix mysterious layout loop in CppunitTest_sw_uiwriter3 testTdf104649 This didn't happen with master from a week ago on Fedora 35, but happens with Monday's master on Fedora 36. Also happens with libreoffice-7-3 branch. Fundamentally the problem with the bugdoc is that there are tables in footnotes, which aren't really supported and can't split across pages like they would need to. The loop happens because a footnote on page 48 invalidates position of its anchor frame 549 on page 45. This is probably pointless, let's only invalidate if the anchor is on the same page (it should be on the same page, but probably the tables in other footnotes get in the way). Change-Id: I87976c7f8b35725bc8e642133bebb396d37ff0be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134877 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 0496252c2c7fd2d694c4a73f387ef75e0021de3e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134894 Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 62c99a5f6e87..43bd9a7037a1 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -3001,7 +3001,16 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) pTmp->InvalidateSize(); } else - pCnt->InvalidatePos(); + { + if (pCnt->FindPageFrame() == FindPageFrame()) + { + pCnt->InvalidatePos(); + } + else + { + SAL_WARN("sw.layout", "footnote frame on different page than ref frame?"); + } + } } } return nReal; commit 59ccf95247f81706c22cc600edca953943a36cec Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Fri May 27 23:36:20 2022 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun May 29 21:39:47 2022 +0200 tdf#149329 Qt change cursor via QWidget ... instead of its QWindow No idea, why my initial implementation used the QWindow. Neither do I know, why it's now somehow broken. The code is called, but the cursor doesn't change. But it seems to work via QWidget, so just do that. IMHO less QWindow is preferable generally; let Qt handle more of the low-level stuff. Change-Id: Id23fba719c9a4d7e760991c51e6021c6f89be345 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135051 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de> Tested-by: Jenkins (cherry picked from commit caf862fc843c89cceae2121f743a3822e09bbd46) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135080 diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index b9a5f40bea91..8af59966dcd7 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -819,14 +819,11 @@ void QtFrame::ToTop(SalFrameToTop nFlags) void QtFrame::SetPointer(PointerStyle ePointerStyle) { - QWindow* pWindow = m_pQWidget->window()->windowHandle(); - if (!pWindow) - return; if (ePointerStyle == m_ePointerStyle) return; m_ePointerStyle = ePointerStyle; - pWindow->setCursor(static_cast<QtData*>(GetSalData())->getCursor(ePointerStyle)); + m_pQWidget->setCursor(static_cast<QtData*>(GetSalData())->getCursor(ePointerStyle)); } void QtFrame::CaptureMouse(bool bMouse) commit d669c48ec78105b06b56692c4cb1eac4f645c8ee Author: Louis Possoz <louis.pos...@quelfutur.org> AuthorDate: Sat Apr 30 06:39:38 2022 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun May 29 21:39:47 2022 +0200 tdf#145178 Formats in section Foot/Endnotes not read from saved files Imported, 'num-suffix' & 'num-format' properties generate debug warnings: warn:xmloff:10220:10220:xmloff/source/text/ XMLSectionFootnoteConfigImport.cxx:123: unknown attribute urn:oasis :names:tc:opendocument:xmlns:style:1.0 style:num-suffix value=]] warn:xmloff:10220:10220:xmloff/source/text/ XMLSectionFootnoteConfigImport.cxx:123: unknown attribute urn:oasis :names:tc:opendocument:xmlns:style:1.0 style:num-format value=One The faulty code is within XMLSectionFootnoteConfigImport::startFastElement() The namespace for these two properties must be set to 'STYLE' (it is wrongly set to 'TEXT') Change-Id: I923f12e19ed15779c67b2159d88d80a2ccb04e17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133605 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit bbec710bd25fc5da27636cde73fe4ab23c76904f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135054 Tested-by: Jenkins diff --git a/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx b/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx index fcdbf2221b5a..ef408c0c13c8 100644 --- a/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx +++ b/xmloff/source/text/XMLSectionFootnoteConfigImport.cxx @@ -101,13 +101,13 @@ void XMLSectionFootnoteConfigImport::startFastElement( bNumOwn = true; break; } - case XML_ELEMENT(TEXT, XML_NUM_SUFFIX): + case XML_ELEMENT(STYLE, XML_NUM_SUFFIX): { sNumSuffix = aIter.toString(); bNumOwn = true; break; } - case XML_ELEMENT(TEXT, XML_NUM_FORMAT): + case XML_ELEMENT(STYLE, XML_NUM_FORMAT): { sNumFormat = aIter.toString(); bNumOwn = true;