tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / vcl / skia / x11 / salvd.cxx
blob8979f36d32b30b02b02a64f2f46114aa14dea395
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <vcl/sysdata.hxx>
12 #include <unx/salunx.h>
13 #include <unx/saldisp.hxx>
14 #include <unx/salgdi.h>
15 #include <unx/salvd.h>
17 #include <skia/x11/salvd.hxx>
19 void X11SalGraphics::Init(X11SkiaSalVirtualDevice* pDevice)
21 SalDisplay* pDisplay = pDevice->GetDisplay();
23 m_nXScreen = pDevice->GetXScreenNumber();
24 maX11Common.m_pColormap = &pDisplay->GetColormap(m_nXScreen);
26 m_pVDev = pDevice;
27 m_pFrame = nullptr;
29 mxImpl->UpdateX11GeometryProvider();
32 X11SkiaSalVirtualDevice::X11SkiaSalVirtualDevice(const SalGraphics& rGraphics, tools::Long nDX,
33 tools::Long nDY, const SystemGraphicsData* pData,
34 std::unique_ptr<X11SalGraphics> pNewGraphics)
35 : mpGraphics(std::move(pNewGraphics))
36 , mbGraphics(false)
37 , mnXScreen(0)
39 assert(mpGraphics);
41 // TODO Check where a VirtualDevice is created from SystemGraphicsData
42 assert(pData == nullptr);
43 (void)pData;
45 mpDisplay = vcl_sal::getSalDisplay(GetGenericUnixSalData());
46 mnXScreen = static_cast<const X11SalGraphics&>(rGraphics).GetScreenNumber();
47 mnWidth = nDX;
48 mnHeight = nDY;
49 mpGraphics->Init(this);
52 X11SkiaSalVirtualDevice::~X11SkiaSalVirtualDevice() {}
54 SalGraphics* X11SkiaSalVirtualDevice::AcquireGraphics()
56 if (mbGraphics)
57 return nullptr;
59 if (mpGraphics)
60 mbGraphics = true;
62 return mpGraphics.get();
65 void X11SkiaSalVirtualDevice::ReleaseGraphics(SalGraphics*) { mbGraphics = false; }
67 bool X11SkiaSalVirtualDevice::SetSize(tools::Long nDX, tools::Long nDY)
69 if (!nDX)
70 nDX = 1;
71 if (!nDY)
72 nDY = 1;
74 mnWidth = nDX;
75 mnHeight = nDY;
76 if (mpGraphics)
77 mpGraphics->Init(this);
79 return true;
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */