diff options
-rw-r--r-- | vcl/inc/headless/svpgdi.hxx | 5 | ||||
-rw-r--r-- | vcl/qt5/Qt5Widget.cxx | 12 |
2 files changed, 14 insertions, 3 deletions
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 |