1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Basic Frontend (BFE):
|
---|
4 | * Declaration of SDLFramebuffer class
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 Oracle Corporation
|
---|
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 (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef __H_SDLFRAMEBUFFER
|
---|
20 | #define __H_SDLFRAMEBUFFER
|
---|
21 |
|
---|
22 | #include "VBoxBFE.h"
|
---|
23 | #include "SDLConsole.h"
|
---|
24 |
|
---|
25 | #include <iprt/thread.h>
|
---|
26 |
|
---|
27 | #include <iprt/critsect.h>
|
---|
28 |
|
---|
29 | #ifdef VBOX_SECURELABEL
|
---|
30 | #include <SDL_ttf.h>
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include "Framebuffer.h"
|
---|
34 |
|
---|
35 | class SDLFramebuffer : public Framebuffer
|
---|
36 | {
|
---|
37 | public:
|
---|
38 | SDLFramebuffer();
|
---|
39 | virtual ~SDLFramebuffer();
|
---|
40 |
|
---|
41 | virtual HRESULT getWidth(ULONG *width);
|
---|
42 | virtual HRESULT getHeight(ULONG *height);
|
---|
43 | virtual HRESULT Lock();
|
---|
44 | virtual HRESULT Unlock();
|
---|
45 | virtual HRESULT getAddress(uintptr_t *address);
|
---|
46 | virtual HRESULT getBitsPerPixel(ULONG *bitsPerPixel);
|
---|
47 | virtual HRESULT getLineSize(ULONG *lineSize);
|
---|
48 | virtual HRESULT NotifyUpdate(ULONG x, ULONG y, ULONG w, ULONG h);
|
---|
49 | virtual HRESULT RequestResize(ULONG w, ULONG h, BOOL *finished);
|
---|
50 | virtual HRESULT GetVisibleRegion(BYTE *aRectangles, ULONG aCount, ULONG *aCountCopied);
|
---|
51 | virtual HRESULT SetVisibleRegion(BYTE *aRectangles, ULONG aCount);
|
---|
52 |
|
---|
53 | virtual HRESULT ProcessVHWACommand(BYTE *pCommand);
|
---|
54 |
|
---|
55 | virtual void repaint();
|
---|
56 | virtual void resize();
|
---|
57 |
|
---|
58 | virtual void update(int x, int y, int w, int h);
|
---|
59 | virtual bool getFullscreen();
|
---|
60 | virtual void setFullscreen(bool fFullscreen);
|
---|
61 | virtual int getYOffset();
|
---|
62 | virtual int getHostXres();
|
---|
63 | virtual int getHostYres();
|
---|
64 | virtual int getHostBitsPerPixel();
|
---|
65 |
|
---|
66 | #ifdef VBOX_SECURELABEL
|
---|
67 | virtual int initSecureLabel(uint32_t height, char *font, uint32_t pointsize);
|
---|
68 | virtual void setSecureLabelText(const char *text);
|
---|
69 | virtual void paintSecureLabel(int x, int y, int w, int h, bool fForce);
|
---|
70 | #endif
|
---|
71 |
|
---|
72 | private:
|
---|
73 | /** the sdl thread */
|
---|
74 | RTNATIVETHREAD mSdlNativeThread;
|
---|
75 | /** current SDL framebuffer pointer */
|
---|
76 | SDL_Surface *mScreen;
|
---|
77 | /** current guest screen width in pixels */
|
---|
78 | ULONG mWidth;
|
---|
79 | /** current guest screen height in pixels */
|
---|
80 | ULONG mHeight;
|
---|
81 | /** Y offset in pixels, i.e. screen_height - guest_screen_height */
|
---|
82 | uint32_t mTopOffset;
|
---|
83 | /** flag whether we're in fullscreen mode */
|
---|
84 | bool mfFullscreen;
|
---|
85 | /** framebuffer update semaphore */
|
---|
86 | RTCRITSECT mUpdateLock;
|
---|
87 | #ifdef VBOX_SECURELABEL
|
---|
88 | /** current secure label text */
|
---|
89 | Utf8Str mSecureLabelText;
|
---|
90 | /** secure label font handle */
|
---|
91 | TTF_Font *mLabelFont;
|
---|
92 | /** secure label height in pixels */
|
---|
93 | uint32_t mLabelHeight;
|
---|
94 | #endif
|
---|
95 | #ifdef RT_OS_WINDOWS
|
---|
96 | long refcnt;
|
---|
97 | #endif
|
---|
98 | };
|
---|
99 |
|
---|
100 | #endif // __H_SDLFRAMEBUFFER
|
---|