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