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,
|
---|
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 | virtual HRESULT GetVisibleRegion(BYTE *aRectangles, ULONG aCount, ULONG *aCountCopied);
|
---|
60 | virtual HRESULT SetVisibleRegion(BYTE *aRectangles, ULONG aCount);
|
---|
61 |
|
---|
62 | virtual void repaint();
|
---|
63 | virtual void resize();
|
---|
64 |
|
---|
65 | virtual void update(int x, int y, int w, int h);
|
---|
66 | virtual bool getFullscreen();
|
---|
67 | virtual void setFullscreen(bool fFullscreen);
|
---|
68 | virtual int getYOffset();
|
---|
69 | virtual int getHostXres();
|
---|
70 | virtual int getHostYres();
|
---|
71 | virtual int getHostBitsPerPixel();
|
---|
72 |
|
---|
73 | #ifdef VBOX_SECURELABEL
|
---|
74 | virtual int initSecureLabel(uint32_t height, char *font, uint32_t pointsize);
|
---|
75 | virtual void setSecureLabelText(const char *text);
|
---|
76 | virtual void paintSecureLabel(int x, int y, int w, int h, bool fForce);
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | private:
|
---|
80 | /** the sdl thread */
|
---|
81 | RTNATIVETHREAD mSdlNativeThread;
|
---|
82 | /** current SDL framebuffer pointer */
|
---|
83 | SDL_Surface *mScreen;
|
---|
84 | /** current guest screen width in pixels */
|
---|
85 | ULONG mWidth;
|
---|
86 | /** current guest screen height in pixels */
|
---|
87 | ULONG mHeight;
|
---|
88 | /** Y offset in pixels, i.e. screen_height - guest_screen_height */
|
---|
89 | uint32_t mTopOffset;
|
---|
90 | /** flag whether we're in fullscreen mode */
|
---|
91 | bool mfFullscreen;
|
---|
92 | /** framebuffer update semaphore */
|
---|
93 | RTCRITSECT mUpdateLock;
|
---|
94 | #ifdef VBOX_SECURELABEL
|
---|
95 | /** current secure label text */
|
---|
96 | Utf8Str mSecureLabelText;
|
---|
97 | /** secure label font handle */
|
---|
98 | TTF_Font *mLabelFont;
|
---|
99 | /** secure label height in pixels */
|
---|
100 | uint32_t mLabelHeight;
|
---|
101 | #endif
|
---|
102 | #ifdef RT_OS_WINDOWS
|
---|
103 | long refcnt;
|
---|
104 | #endif
|
---|
105 | };
|
---|
106 |
|
---|
107 | #endif // __H_SDLFRAMEBUFFER
|
---|