Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : */
9 :
10 : #include <vcl/sysdata.hxx>
11 :
12 : #include <unx/salunx.h>
13 : #include <unx/saldata.hxx>
14 : #include <unx/saldisp.hxx>
15 : #include <unx/salgdi.h>
16 : #include <unx/salvd.h>
17 :
18 : #include <opengl/x11/salvd.hxx>
19 :
20 0 : void X11SalGraphics::Init( X11OpenGLSalVirtualDevice *pDevice )
21 : {
22 0 : SalDisplay *pDisplay = pDevice->GetDisplay();
23 :
24 0 : m_nXScreen = pDevice->GetXScreenNumber();
25 0 : m_pColormap = &pDisplay->GetColormap( m_nXScreen );
26 :
27 0 : m_pVDev = pDevice;
28 0 : m_pFrame = NULL;
29 :
30 0 : bWindow_ = pDisplay->IsDisplay();
31 0 : bVirDev_ = true;
32 :
33 0 : mxImpl->Init();
34 0 : }
35 :
36 0 : X11OpenGLSalVirtualDevice::X11OpenGLSalVirtualDevice( SalGraphics* pGraphics,
37 : long &nDX, long &nDY,
38 : sal_uInt16 nBitCount,
39 : const SystemGraphicsData *pData ) :
40 : mbGraphics( false ),
41 0 : mnXScreen( 0 )
42 : {
43 : // TODO Do we really need the requested bit count?
44 0 : if( !nBitCount && pGraphics )
45 0 : nBitCount = pGraphics->GetBitCount();
46 :
47 : // TODO Check where a VirtualDevice is created from SystemGraphicsData
48 : assert( pData == NULL ); (void)pData;
49 :
50 0 : mpDisplay = vcl_sal::getSalDisplay(GetGenericData());
51 0 : mnDepth = nBitCount;
52 : mnXScreen = pGraphics ? static_cast<X11SalGraphics*>(pGraphics)->GetScreenNumber() :
53 0 : vcl_sal::getSalDisplay(GetGenericData())->GetDefaultXScreen();
54 0 : mnWidth = nDX;
55 0 : mnHeight = nDY;
56 0 : mpGraphics = new X11SalGraphics();
57 0 : mpGraphics->SetLayout( SalLayoutFlags::NONE );
58 0 : mpGraphics->Init( this );
59 0 : }
60 :
61 0 : X11OpenGLSalVirtualDevice::~X11OpenGLSalVirtualDevice()
62 : {
63 0 : if( mpGraphics )
64 0 : delete mpGraphics;
65 0 : }
66 :
67 0 : SalGraphics* X11OpenGLSalVirtualDevice::AcquireGraphics()
68 : {
69 0 : if( mbGraphics )
70 0 : return NULL;
71 :
72 0 : if( mpGraphics )
73 0 : mbGraphics = true;
74 :
75 0 : return mpGraphics;
76 : }
77 :
78 0 : void X11OpenGLSalVirtualDevice::ReleaseGraphics( SalGraphics* )
79 : {
80 0 : mbGraphics = false;
81 0 : }
82 :
83 :
84 0 : bool X11OpenGLSalVirtualDevice::SetSize( long nDX, long nDY )
85 : {
86 0 : if( !nDX ) nDX = 1;
87 0 : if( !nDY ) nDY = 1;
88 :
89 0 : mnWidth = nDX;
90 0 : mnHeight = nDY;
91 0 : if( mpGraphics )
92 0 : mpGraphics->Init( this );
93 :
94 0 : return true;
95 9 : }
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|