summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2019-06-07 19:09:18 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2019-06-08 03:30:45 +0200
commit2cb6a591b643a0f65dc58f060f60cc707ad3589c (patch)
treebda4549651efb0f6e2854d4b9124329753ff2f9b /vcl
parent9870ff897f088563426bee9567dd9cb722c2b929 (diff)
tdf#125673 KDE5 implement a KDE5SalVirtualDevice
We just need AcquireGraphics() to return a KDE5Graphics. Otherwise the BufferDevice's SVP will use a SvpSalGraphics instead of the KDE5Graphics, which knows about Qt's theming. Change-Id: I0ea646df260f2067d61c753f03dee01a003f382a Reviewed-on: https://gerrit.libreoffice.org/73673 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/headless/svpvd.cxx10
-rw-r--r--vcl/inc/headless/svpvd.hxx5
-rw-r--r--vcl/source/window/bufferdevice.cxx2
-rw-r--r--vcl/unx/kde5/KDE5SalGraphics.cxx2
-rw-r--r--vcl/unx/kde5/KDE5SalInstance.cxx19
-rw-r--r--vcl/unx/kde5/KDE5SalInstance.hxx4
-rw-r--r--vcl/unx/kde5/KDE5SalVirtualDevice.hxx36
7 files changed, 72 insertions, 6 deletions
diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index eeccf2c014a9..a1e415739d6b 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -45,14 +45,18 @@ SvpSalVirtualDevice::~SvpSalVirtualDevice()
cairo_surface_destroy(m_pRefSurface);
}
-SalGraphics* SvpSalVirtualDevice::AcquireGraphics()
+SvpSalGraphics* SvpSalVirtualDevice::AddGraphics(SvpSalGraphics* pGraphics)
{
- SvpSalGraphics* pGraphics = new SvpSalGraphics();
pGraphics->setSurface(m_pSurface, m_aFrameSize);
- m_aGraphics.push_back( pGraphics );
+ m_aGraphics.push_back(pGraphics);
return pGraphics;
}
+SalGraphics* SvpSalVirtualDevice::AcquireGraphics()
+{
+ return AddGraphics(new SvpSalGraphics());
+}
+
void SvpSalVirtualDevice::ReleaseGraphics( SalGraphics* pGraphics )
{
m_aGraphics.erase(std::remove(m_aGraphics.begin(), m_aGraphics.end(), dynamic_cast<SvpSalGraphics*>(pGraphics)), m_aGraphics.end());
diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx
index 776cee7cde15..3da74b5e1ba8 100644
--- a/vcl/inc/headless/svpvd.hxx
+++ b/vcl/inc/headless/svpvd.hxx
@@ -21,6 +21,8 @@
#define INCLUDED_VCL_INC_HEADLESS_SVPVD_HXX
#include <salvd.hxx>
+#include <vcl/salgtype.hxx>
+#include <basegfx/vector/b2ivector.hxx>
#include <vector>
@@ -35,6 +37,9 @@ class VCL_DLLPUBLIC SvpSalVirtualDevice : public SalVirtualDevice
basegfx::B2IVector m_aFrameSize;
std::vector< SvpSalGraphics* > m_aGraphics;
+protected:
+ SvpSalGraphics* AddGraphics(SvpSalGraphics* aGraphics);
+
public:
SvpSalVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface);
virtual ~SvpSalVirtualDevice() override;
diff --git a/vcl/source/window/bufferdevice.cxx b/vcl/source/window/bufferdevice.cxx
index 5db4cfff458a..d1480588d48f 100644
--- a/vcl/source/window/bufferdevice.cxx
+++ b/vcl/source/window/bufferdevice.cxx
@@ -12,7 +12,7 @@
namespace vcl
{
BufferDevice::BufferDevice(const VclPtr<vcl::Window>& pWindow, vcl::RenderContext& rRenderContext)
- : m_pBuffer(VclPtr<VirtualDevice>::Create())
+ : m_pBuffer(VclPtr<VirtualDevice>::Create(rRenderContext))
, m_pWindow(pWindow)
, m_rRenderContext(rRenderContext)
{
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 6e30b9599740..268f8331f7e7 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -40,7 +40,7 @@ static void QImage2BitmapBuffer(QImage* pImg, BitmapBuffer* pBuf)
}
KDE5SalGraphics::KDE5SalGraphics(Qt5Frame* pFrame)
- : Qt5SvpGraphics(pFrame->GetQWidget())
+ : Qt5SvpGraphics(pFrame ? pFrame->GetQWidget() : nullptr)
, m_pFrame(pFrame)
{
}
diff --git a/vcl/unx/kde5/KDE5SalInstance.cxx b/vcl/unx/kde5/KDE5SalInstance.cxx
index e2bd75277d23..e83d48007712 100644
--- a/vcl/unx/kde5/KDE5SalInstance.cxx
+++ b/vcl/unx/kde5/KDE5SalInstance.cxx
@@ -28,8 +28,9 @@
#include <Qt5Data.hxx>
#include "KDE5FilePicker.hxx"
-#include "KDE5SalInstance.hxx"
#include "KDE5SalFrame.hxx"
+#include "KDE5SalInstance.hxx"
+#include "KDE5SalVirtualDevice.hxx"
using namespace com::sun::star;
@@ -69,6 +70,22 @@ Qt5FilePicker* KDE5SalInstance::createPicker(QFileDialog::FileMode eMode)
return Qt5Instance::createPicker(eMode);
}
+std::unique_ptr<SalVirtualDevice> KDE5SalInstance::CreateVirtualDevice(SalGraphics* pGraphics,
+ long& nDX, long& nDY,
+ DeviceFormat eFormat,
+ const SystemGraphicsData*)
+{
+ std::unique_ptr<SalVirtualDevice> pVD;
+ assert(pGraphics);
+ RunInMainThread(std::function([&]() {
+ KDE5SalGraphics* pKDE5Graphics = dynamic_cast<KDE5SalGraphics*>(pGraphics);
+ assert(pKDE5Graphics);
+ pVD.reset(new KDE5SalVirtualDevice(eFormat, pKDE5Graphics->getSurface()));
+ pVD->SetSize(nDX, nDY);
+ }));
+ return pVD;
+}
+
extern "C" {
VCLPLUG_KDE5_PUBLIC SalInstance* create_SalInstance()
{
diff --git a/vcl/unx/kde5/KDE5SalInstance.hxx b/vcl/unx/kde5/KDE5SalInstance.hxx
index 53993a5ecc34..6b9f8eb29806 100644
--- a/vcl/unx/kde5/KDE5SalInstance.hxx
+++ b/vcl/unx/kde5/KDE5SalInstance.hxx
@@ -30,6 +30,10 @@ class KDE5SalInstance final : public Qt5Instance
public:
explicit KDE5SalInstance(std::unique_ptr<QApplication>& pQApp);
+
+ std::unique_ptr<SalVirtualDevice>
+ CreateVirtualDevice(SalGraphics*, long&, long&, DeviceFormat,
+ const SystemGraphicsData* = nullptr) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalVirtualDevice.hxx b/vcl/unx/kde5/KDE5SalVirtualDevice.hxx
new file mode 100644
index 000000000000..baa8a2e31aa8
--- /dev/null
+++ b/vcl/unx/kde5/KDE5SalVirtualDevice.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <headless/svpvd.hxx>
+#include "KDE5SalGraphics.hxx"
+
+class VCL_DLLPUBLIC KDE5SalVirtualDevice : public SvpSalVirtualDevice
+{
+public:
+ KDE5SalVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface)
+ : SvpSalVirtualDevice(eFormat, pRefSurface)
+ {
+ }
+
+ SalGraphics* AcquireGraphics() override { return AddGraphics(new KDE5SalGraphics(nullptr)); }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */