1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * UIFrameBufferSDL class declarations
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2010 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 ___UIFrameBufferSDL_h___
|
---|
24 | #define ___UIFrameBufferSDL_h___
|
---|
25 |
|
---|
26 | #ifdef VBOX_GUI_USE_SDL
|
---|
27 |
|
---|
28 | /* Local includes */
|
---|
29 | # include "UIFrameBuffer.h"
|
---|
30 |
|
---|
31 | /* Global includes */
|
---|
32 | # include <SDL.h>
|
---|
33 | # include <signal.h>
|
---|
34 |
|
---|
35 | class UIFrameBufferSDL : public UIFrameBuffer
|
---|
36 | {
|
---|
37 | public:
|
---|
38 |
|
---|
39 | UIFrameBufferSDL(UIMachineView *pMachineView);
|
---|
40 | virtual ~UIFrameBufferSDL();
|
---|
41 |
|
---|
42 | STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY, ULONG aW, ULONG aH);
|
---|
43 |
|
---|
44 | uchar* address()
|
---|
45 | {
|
---|
46 | SDL_Surface *surf = m_pSurfVRAM ? m_pSurfVRAM : m_pScreen;
|
---|
47 | return surf ? (uchar*) (uintptr_t) surf->pixels : 0;
|
---|
48 | }
|
---|
49 |
|
---|
50 | ulong bitsPerPixel()
|
---|
51 | {
|
---|
52 | SDL_Surface *surf = m_pSurfVRAM ? m_pSurfVRAM : m_pScreen;
|
---|
53 | return surf ? surf->format->BitsPerPixel : 0;
|
---|
54 | }
|
---|
55 |
|
---|
56 | ulong bytesPerLine()
|
---|
57 | {
|
---|
58 | SDL_Surface *surf = m_pSurfVRAM ? m_pSurfVRAM : m_pScreen;
|
---|
59 | return surf ? surf->pitch : 0;
|
---|
60 | }
|
---|
61 |
|
---|
62 | ulong pixelFormat()
|
---|
63 | {
|
---|
64 | return m_uPixelFormat;
|
---|
65 | }
|
---|
66 |
|
---|
67 | bool usesGuestVRAM()
|
---|
68 | {
|
---|
69 | return m_pSurfVRAM != NULL;
|
---|
70 | }
|
---|
71 |
|
---|
72 | void paintEvent(QPaintEvent *pEvent);
|
---|
73 | void resizeEvent(UIResizeEvent *pEvent);
|
---|
74 |
|
---|
75 | private:
|
---|
76 |
|
---|
77 | SDL_Surface *m_pScreen;
|
---|
78 | SDL_Surface *m_pSurfVRAM;
|
---|
79 |
|
---|
80 | ulong m_uPixelFormat;
|
---|
81 | };
|
---|
82 |
|
---|
83 | #endif /* VBOX_GUI_USE_SDL */
|
---|
84 |
|
---|
85 | #endif /* !___UIFrameBufferSDL_h___ */
|
---|
86 |
|
---|