vcl/inc/headless/svpgdi.hxx | 5 +++-- vcl/qt5/Qt5Widget.cxx | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-)
New commits: commit f541da4f6d61d089c8d7a7c25b58795705c787eb Author: Aleksei Nikiforov <darktemp...@basealt.ru> AuthorDate: Wed Oct 31 15:13:42 2018 +0300 Commit: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> CommitDate: Thu Nov 1 09:34:56 2018 +0100 tdf#120777 KDE5: Dialogs get blank when they are resized On window resize qt5 only redraws changed parts of widgets. If resize is minor (i.e. height has increased by 1 pixel, for example), qt5 may consider most parts of widget not changed and skip redrawing them and redraw only certain widget elements. But if cairo is used for drawing, on resize previously drawed image of widget is discarded and new one of different size is created. New image is empty, but qt5 doesn't issue redraw for whole widget. To mitigate this issue, data from old image of widget should be copied over to image of new widget, qt5 will redraw it partially or fully if necessary. Change-Id: Id950074efece9072bbfc002dfcb6ead813d5aeff Reviewed-on: https://gerrit.libreoffice.org/62698 Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> Tested-by: Jenkins diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 1b24f2fa8c5d..89fe682d3223 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -119,11 +119,12 @@ public: double fMiterMinimumAngle, bool bPixelSnapHairline); -private: - void invert(const basegfx::B2DPolygon &rPoly, SalInvert nFlags); void copySource(const SalTwoRect& rTR, cairo_surface_t* source); void copyWithOperator(const SalTwoRect& rTR, cairo_surface_t* source, cairo_operator_t eOp = CAIRO_OPERATOR_SOURCE); + +private: + void invert(const basegfx::B2DPolygon &rPoly, SalInvert nFlags); void applyColor(cairo_t *cr, Color rColor); protected: diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index a47aaca8b853..1055ccd9fb16 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -24,12 +24,14 @@ #include <Qt5Graphics.hxx> #include <Qt5Tools.hxx> +#include <QtCore/QtGlobal> #include <QtGui/QFocusEvent> #include <QtGui/QImage> #include <QtGui/QKeyEvent> #include <QtGui/QMouseEvent> #include <QtGui/QPainter> #include <QtGui/QPaintEvent> +#include <QtGui/QResizeEvent> #include <QtGui/QShowEvent> #include <QtGui/QWheelEvent> #include <QtWidgets/QtWidgets> @@ -57,7 +59,7 @@ void Qt5Widget::paintEvent(QPaintEvent* pEvent) p.drawImage(pEvent->rect().topLeft(), *m_pFrame->m_pQImage, pEvent->rect()); } -void Qt5Widget::resizeEvent(QResizeEvent* /*event*/) +void Qt5Widget::resizeEvent(QResizeEvent* pEvent) { if (m_pFrame->m_bUseCairo) { @@ -71,7 +73,15 @@ void Qt5Widget::resizeEvent(QResizeEvent* /*event*/) cairo_surface_set_user_data(pSurface, SvpSalGraphics::getDamageKey(), &m_pFrame->m_aDamageHandler, nullptr); m_pFrame->m_pSvpGraphics->setSurface(pSurface, basegfx::B2IVector(width, height)); + UniqueCairoSurface old_surface(m_pFrame->m_pSurface.release()); m_pFrame->m_pSurface.reset(pSurface); + + int min_width = qMin(pEvent->oldSize().width(), pEvent->size().width()); + int min_height = qMin(pEvent->oldSize().height(), pEvent->size().height()); + + SalTwoRect rect(0, 0, min_width, min_height, 0, 0, min_width, min_height); + + m_pFrame->m_pSvpGraphics->copySource(rect, old_surface.get()); } } else _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits