1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Basic Frontend (BFE):
|
---|
4 | * Declaration of SDLFramebuffer class
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License as published by the Free Software Foundation,
|
---|
14 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
15 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
16 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * If you received this file as part of a commercial VirtualBox
|
---|
19 | * distribution, then only the terms of your commercial VirtualBox
|
---|
20 | * license agreement apply instead of the previous paragraph.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __H_SDLFRAMEBUFFER
|
---|
24 | #define __H_SDLFRAMEBUFFER
|
---|
25 |
|
---|
26 | #include "VBoxBFE.h"
|
---|
27 | #include "SDLConsole.h"
|
---|
28 |
|
---|
29 | #include <iprt/thread.h>
|
---|
30 |
|
---|
31 | #include <iprt/critsect.h>
|
---|
32 |
|
---|
33 | #ifdef VBOX_SECURELABEL
|
---|
34 | #include <SDL_ttf.h>
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | #include "Framebuffer.h"
|
---|
38 |
|
---|
39 | class SDLFramebuffer : public Framebuffer
|
---|
40 | {
|
---|
41 | public:
|
---|
42 | SDLFramebuffer();
|
---|
43 | virtual ~SDLFramebuffer();
|
---|
44 |
|
---|
45 | virtual HRESULT getWidth(ULONG *width);
|
---|
46 | virtual HRESULT getHeight(ULONG *height);
|
---|
47 | virtual HRESULT Lock();
|
---|
48 | virtual HRESULT Unlock();
|
---|
49 | virtual HRESULT getAddress(uintptr_t *address);
|
---|
50 | virtual HRESULT getColorDepth(ULONG *colorDepth);
|
---|
51 | virtual HRESULT getLineSize(ULONG *lineSize);
|
---|
52 | virtual HRESULT NotifyUpdate(ULONG x, ULONG y,
|
---|
53 | ULONG w, ULONG h, BOOL *finished);
|
---|
54 | virtual HRESULT RequestResize(ULONG w, ULONG h, BOOL *finished);
|
---|
55 | virtual HRESULT SolidFill(ULONG x, ULONG y, ULONG width, ULONG height,
|
---|
56 | ULONG color, BOOL *handled);
|
---|
57 | virtual HRESULT CopyScreenBits(ULONG xDst, ULONG yDst, ULONG xSrc, ULONG ySrc,
|
---|
58 | ULONG width, ULONG height, BOOL *handled);
|
---|
59 |
|
---|
60 | virtual void repaint();
|
---|
61 | virtual void resize();
|
---|
62 |
|
---|
63 | virtual void update(int x, int y, int w, int h);
|
---|
64 | virtual bool getFullscreen();
|
---|
65 | virtual void setFullscreen(bool fFullscreen);
|
---|
66 | virtual int getYOffset();
|
---|
67 | virtual int getHostXres();
|
---|
68 | virtual int getHostYres();
|
---|
69 | virtual int getHostBitsPerPixel();
|
---|
70 |
|
---|
71 | #ifdef VBOX_SECURELABEL
|
---|
72 | virtual int initSecureLabel(uint32_t height, char *font, uint32_t pointsize);
|
---|
73 | virtual void setSecureLabelText(const char *text);
|
---|
74 | virtual void paintSecureLabel(int x, int y, int w, int h, bool fForce);
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | private:
|
---|
78 | /** the sdl thread */
|
---|
79 | RTNATIVETHREAD mSdlNativeThread;
|
---|
80 | /** current SDL framebuffer pointer */
|
---|
81 | SDL_Surface *mScreen;
|
---|
82 | /** current guest screen width in pixels */
|
---|
83 | ULONG mWidth;
|
---|
84 | /** current guest screen height in pixels */
|
---|
85 | ULONG mHeight;
|
---|
86 | /** Y offset in pixels, i.e. screen_height - guest_screen_height */
|
---|
87 | uint32_t mTopOffset;
|
---|
88 | /** flag whether we're in fullscreen mode */
|
---|
89 | bool mfFullscreen;
|
---|
90 | /** framebuffer update semaphore */
|
---|
91 | RTCRITSECT mUpdateLock;
|
---|
92 | #ifdef VBOX_SECURELABEL
|
---|
93 | /** current secure label text */
|
---|
94 | Utf8Str mSecureLabelText;
|
---|
95 | /** secure label font handle */
|
---|
96 | TTF_Font *mLabelFont;
|
---|
97 | /** secure label height in pixels */
|
---|
98 | uint32_t mLabelHeight;
|
---|
99 | #endif
|
---|
100 | #ifdef __WIN__
|
---|
101 | long refcnt;
|
---|
102 | #endif
|
---|
103 | };
|
---|
104 |
|
---|
105 | #endif // __H_SDLFRAMEBUFFER
|
---|