1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Basic Frontend (BFE):
|
---|
4 | * Declaration of SDLFramebuffer class
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
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 getBitsPerPixel(ULONG *bitsPerPixel);
|
---|
51 | virtual HRESULT getLineSize(ULONG *lineSize);
|
---|
52 | virtual HRESULT NotifyUpdate(ULONG x, ULONG y, ULONG w, ULONG h);
|
---|
53 | virtual HRESULT RequestResize(ULONG w, ULONG h, BOOL *finished);
|
---|
54 | virtual HRESULT GetVisibleRegion(BYTE *aRectangles, ULONG aCount, ULONG *aCountCopied);
|
---|
55 | virtual HRESULT SetVisibleRegion(BYTE *aRectangles, ULONG aCount);
|
---|
56 |
|
---|
57 | virtual HRESULT ProcessVHWACommand(BYTE *pCommand);
|
---|
58 |
|
---|
59 | virtual void repaint();
|
---|
60 | virtual void resize();
|
---|
61 |
|
---|
62 | virtual void update(int x, int y, int w, int h);
|
---|
63 | virtual bool getFullscreen();
|
---|
64 | virtual void setFullscreen(bool fFullscreen);
|
---|
65 | virtual int getYOffset();
|
---|
66 | virtual int getHostXres();
|
---|
67 | virtual int getHostYres();
|
---|
68 | virtual int getHostBitsPerPixel();
|
---|
69 |
|
---|
70 | #ifdef VBOX_SECURELABEL
|
---|
71 | virtual int initSecureLabel(uint32_t height, char *font, uint32_t pointsize);
|
---|
72 | virtual void setSecureLabelText(const char *text);
|
---|
73 | virtual void paintSecureLabel(int x, int y, int w, int h, bool fForce);
|
---|
74 | #endif
|
---|
75 |
|
---|
76 | private:
|
---|
77 | /** the sdl thread */
|
---|
78 | RTNATIVETHREAD mSdlNativeThread;
|
---|
79 | /** current SDL framebuffer pointer */
|
---|
80 | SDL_Surface *mScreen;
|
---|
81 | /** current guest screen width in pixels */
|
---|
82 | ULONG mWidth;
|
---|
83 | /** current guest screen height in pixels */
|
---|
84 | ULONG mHeight;
|
---|
85 | /** Y offset in pixels, i.e. screen_height - guest_screen_height */
|
---|
86 | uint32_t mTopOffset;
|
---|
87 | /** flag whether we're in fullscreen mode */
|
---|
88 | bool mfFullscreen;
|
---|
89 | /** framebuffer update semaphore */
|
---|
90 | RTCRITSECT mUpdateLock;
|
---|
91 | #ifdef VBOX_SECURELABEL
|
---|
92 | /** current secure label text */
|
---|
93 | Utf8Str mSecureLabelText;
|
---|
94 | /** secure label font handle */
|
---|
95 | TTF_Font *mLabelFont;
|
---|
96 | /** secure label height in pixels */
|
---|
97 | uint32_t mLabelHeight;
|
---|
98 | #endif
|
---|
99 | #ifdef RT_OS_WINDOWS
|
---|
100 | long refcnt;
|
---|
101 | #endif
|
---|
102 | };
|
---|
103 |
|
---|
104 | #endif // __H_SDLFRAMEBUFFER
|
---|