1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Basic Frontend (BFE):
|
---|
4 | * Declaration of SDLFramebuffer class
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2007 innotek 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 (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,
|
---|
49 | ULONG w, ULONG h, BOOL *finished);
|
---|
50 | virtual HRESULT RequestResize(ULONG w, ULONG h, BOOL *finished);
|
---|
51 | virtual HRESULT SolidFill(ULONG x, ULONG y, ULONG width, ULONG height,
|
---|
52 | ULONG color, BOOL *handled);
|
---|
53 | virtual HRESULT CopyScreenBits(ULONG xDst, ULONG yDst, ULONG xSrc, ULONG ySrc,
|
---|
54 | ULONG width, ULONG height, BOOL *handled);
|
---|
55 | virtual HRESULT GetVisibleRegion(BYTE *aRectangles, ULONG aCount, ULONG *aCountCopied);
|
---|
56 | virtual HRESULT SetVisibleRegion(BYTE *aRectangles, ULONG aCount);
|
---|
57 |
|
---|
58 | virtual void repaint();
|
---|
59 | virtual void resize();
|
---|
60 |
|
---|
61 | virtual void update(int x, int y, int w, int h);
|
---|
62 | virtual bool getFullscreen();
|
---|
63 | virtual void setFullscreen(bool fFullscreen);
|
---|
64 | virtual int getYOffset();
|
---|
65 | virtual int getHostXres();
|
---|
66 | virtual int getHostYres();
|
---|
67 | virtual int getHostBitsPerPixel();
|
---|
68 |
|
---|
69 | #ifdef VBOX_SECURELABEL
|
---|
70 | virtual int initSecureLabel(uint32_t height, char *font, uint32_t pointsize);
|
---|
71 | virtual void setSecureLabelText(const char *text);
|
---|
72 | virtual void paintSecureLabel(int x, int y, int w, int h, bool fForce);
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | private:
|
---|
76 | /** the sdl thread */
|
---|
77 | RTNATIVETHREAD mSdlNativeThread;
|
---|
78 | /** current SDL framebuffer pointer */
|
---|
79 | SDL_Surface *mScreen;
|
---|
80 | /** current guest screen width in pixels */
|
---|
81 | ULONG mWidth;
|
---|
82 | /** current guest screen height in pixels */
|
---|
83 | ULONG mHeight;
|
---|
84 | /** Y offset in pixels, i.e. screen_height - guest_screen_height */
|
---|
85 | uint32_t mTopOffset;
|
---|
86 | /** flag whether we're in fullscreen mode */
|
---|
87 | bool mfFullscreen;
|
---|
88 | /** framebuffer update semaphore */
|
---|
89 | RTCRITSECT mUpdateLock;
|
---|
90 | #ifdef VBOX_SECURELABEL
|
---|
91 | /** current secure label text */
|
---|
92 | Utf8Str mSecureLabelText;
|
---|
93 | /** secure label font handle */
|
---|
94 | TTF_Font *mLabelFont;
|
---|
95 | /** secure label height in pixels */
|
---|
96 | uint32_t mLabelHeight;
|
---|
97 | #endif
|
---|
98 | #ifdef RT_OS_WINDOWS
|
---|
99 | long refcnt;
|
---|
100 | #endif
|
---|
101 | };
|
---|
102 |
|
---|
103 | #endif // __H_SDLFRAMEBUFFER
|
---|