diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-04-07 21:27:11 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-04-07 17:46:14 +0200 |
commit | 33da78c21f4243a3e469fb7df79ed1745df70078 (patch) | |
tree | d00edd801e3f574c3177a70a3eaa2a0939639cba /vcl/qt5/Qt5Graphics.cxx | |
parent | 5a251208fe423b8f102886368da0e7e9dddc1a9c (diff) |
vcl: move graphic handling into Qt5GraphicsBackend
This is an effort to make SalGraphicsImpl mandatory for all
backends.
This introduces Qt5GraphicsBackend: a subclass of SalGraphicsImpl,
which now handles graphic rendering.
Change-Id: I42aece59d0c692ca1dd33e30f31c5bcceab02008
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113734
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/qt5/Qt5Graphics.cxx')
-rw-r--r-- | vcl/qt5/Qt5Graphics.cxx | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx index c769b4e13795..c89747f98869 100644 --- a/vcl/qt5/Qt5Graphics.cxx +++ b/vcl/qt5/Qt5Graphics.cxx @@ -32,14 +32,10 @@ Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame, QImage *pQImage ) : m_pFrame( pFrame ) - , m_pQImage( pQImage ) - , m_aLineColor( 0x00, 0x00, 0x00 ) - , m_aFillColor( 0xFF, 0xFF, 0XFF ) - , m_eCompositionMode( QPainter::CompositionMode_SourceOver ) , m_pTextStyle{ nullptr, } , m_aTextColor( 0x00, 0x00, 0x00 ) { - ResetClipRegion(); + m_pBackend = std::make_unique<Qt5GraphicsBackend>(m_pFrame, pQImage); if (!initWidgetDrawBackends(false)) { @@ -54,26 +50,14 @@ Qt5Graphics::~Qt5Graphics() { ReleaseFonts(); } void Qt5Graphics::ChangeQImage(QImage* pQImage) { - m_pQImage = pQImage; - ResetClipRegion(); + m_pBackend->setQImage(pQImage); + m_pBackend->ResetClipRegion(); } -SalGraphicsImpl* Qt5Graphics::GetImpl() const { return nullptr; } +SalGraphicsImpl* Qt5Graphics::GetImpl() const { return m_pBackend.get(); } SystemGraphicsData Qt5Graphics::GetGraphicsData() const { return SystemGraphicsData(); } -bool Qt5Graphics::supportsOperation(OutDevSupportType eType) const -{ - switch (eType) - { - case OutDevSupportType::B2DDraw: - case OutDevSupportType::TransparentRect: - return true; - default: - return false; - } -} - #if ENABLE_CAIRO_CANVAS bool Qt5Graphics::SupportsCairo() const { return false; } @@ -114,7 +98,7 @@ void Qt5Graphics::handleDamage(const tools::Rectangle& rDamagedRegion) QImage* pImage = static_cast<Qt5Graphics_Controls*>(m_pWidgetDraw.get())->getImage(); QImage blit(*pImage); blit.setDevicePixelRatio(1); - Qt5Painter aPainter(*this); + Qt5Painter aPainter(*m_pBackend); aPainter.drawImage(QPoint(rDamagedRegion.getX(), rDamagedRegion.getY()), blit); aPainter.update(toQRect(rDamagedRegion)); } |