calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / vcl / skia / x11 / salvd.cxx
blob73488b8a10bc80f9f2b524d18d1c0a7b10f9ec8b
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 bWindow_ = pDisplay->IsDisplay();
30 bVirDev_ = true;
32 mxImpl->Init();
35 X11SkiaSalVirtualDevice::X11SkiaSalVirtualDevice(const SalGraphics& rGraphics, tools::Long nDX,
36 tools::Long nDY, const SystemGraphicsData* pData,
37 std::unique_ptr<X11SalGraphics> pNewGraphics)
38 : mpGraphics(std::move(pNewGraphics))
39 , mbGraphics(false)
40 , mnXScreen(0)
42 assert(mpGraphics);
44 // TODO Check where a VirtualDevice is created from SystemGraphicsData
45 assert(pData == nullptr);
46 (void)pData;
48 mpDisplay = vcl_sal::getSalDisplay(GetGenericUnixSalData());
49 mnXScreen = static_cast<const X11SalGraphics&>(rGraphics).GetScreenNumber();
50 mnWidth = nDX;
51 mnHeight = nDY;
52 mpGraphics->Init(this);
55 X11SkiaSalVirtualDevice::~X11SkiaSalVirtualDevice() {}
57 SalGraphics* X11SkiaSalVirtualDevice::AcquireGraphics()
59 if (mbGraphics)
60 return nullptr;
62 if (mpGraphics)
63 mbGraphics = true;
65 return mpGraphics.get();
68 void X11SkiaSalVirtualDevice::ReleaseGraphics(SalGraphics*) { mbGraphics = false; }
70 bool X11SkiaSalVirtualDevice::SetSize(tools::Long nDX, tools::Long nDY)
72 if (!nDX)
73 nDX = 1;
74 if (!nDY)
75 nDY = 1;
77 mnWidth = nDX;
78 mnHeight = nDY;
79 if (mpGraphics)
80 mpGraphics->Init(this);
82 return true;
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */