Changeset 41215 in vbox
- Timestamp:
- May 8, 2012 6:00:42 PM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxSDL
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
r41002 r41215 75 75 // 76 76 77 /** 78 * SDL framebuffer constructor. It is called from the main 77 HRESULT VBoxSDLFB::FinalConstruct() 78 { 79 return S_OK; 80 } 81 82 /** 83 * SDL framebuffer init method. It is called from the main 79 84 * (i.e. SDL) thread. Therefore it is safe to use SDL calls 80 85 * here. 86 * @returns COM status code 81 87 * @param fFullscreen flag whether we start in fullscreen mode 82 88 * @param fResizable flag whether the SDL window should be resizable … … 87 93 * @param iFixedHeight fixed SDL height (-1 means not set) 88 94 */ 89 VBoxSDLFB::VBoxSDLFB(uint32_t uScreenId,90 bool fFullscreen, bool fResizable, bool fShowSDLConfig,91 bool fKeepHostRes, uint32_t u32FixedWidth,92 uint32_t u32FixedHeight, uint32_t u32FixedBPP)95 HRESULT VBoxSDLFB::init(uint32_t uScreenId, 96 bool fFullscreen, bool fResizable, bool fShowSDLConfig, 97 bool fKeepHostRes, uint32_t u32FixedWidth, 98 uint32_t u32FixedHeight, uint32_t u32FixedBPP) 93 99 { 94 100 int rc; 95 LogFlow(("VBoxSDLFB::VBoxSDLFB\n")); 96 97 #if defined (RT_OS_WINDOWS) 98 refcnt = 0; 99 #endif 101 LogFlow(("VBoxSDLFB::init\n")); 100 102 101 103 mScreenId = uScreenId; … … 138 140 Assert(mScreen); 139 141 mfInitialized = true; 140 } 141 142 VBoxSDLFB::~VBoxSDLFB() 143 { 144 LogFlow(("VBoxSDLFB::~VBoxSDLFB\n")); 142 143 return S_OK; 144 } 145 146 void VBoxSDLFB::FinalRelease() 147 { 148 uninit(); 149 } 150 151 void VBoxSDLFB::uninit() 152 { 153 LogFlow(("VBoxSDLFB::uninit\n")); 145 154 if (mSurfVRAM) 146 155 { … … 160 169 } 161 170 162 bool VBoxSDLFB::init (bool fShowSDLConfig)171 bool VBoxSDLFB::initSDL(bool fShowSDLConfig) 163 172 { 164 173 LogFlow(("VBoxSDLFB::init\n")); … … 240 249 * @remarks must be called from the SDL thread! 241 250 */ 242 void VBoxSDLFB::uninit ()251 void VBoxSDLFB::uninitSDL() 243 252 { 244 253 if (gfSdlInitialized) -
trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.h
r41201 r41215 43 43 44 44 class VBoxSDLFB : 45 public CComObjectRootEx<CComMultiThreadModelNoCS>, 45 46 VBOX_SCRIPTABLE_IMPL(IFramebuffer) 46 47 { 47 48 public: 48 VBoxSDLFB(uint32_t uScreenId, 49 bool fFullscreen = false, bool fResizable = true, bool fShowSDLConfig = false, 50 bool fKeepHostRes = false, uint32_t u32FixedWidth = ~(uint32_t)0, 51 uint32_t u32FixedHeight = ~(uint32_t)0, uint32_t u32FixedBPP = ~(uint32_t)0); 52 virtual ~VBoxSDLFB(); 53 54 static bool init(bool fShowSDLConfig); 55 static void uninit(); 56 57 #ifdef RT_OS_WINDOWS 58 STDMETHOD_(ULONG, AddRef)() 59 { 60 return ::InterlockedIncrement (&refcnt); 61 } 62 STDMETHOD_(ULONG, Release)() 63 { 64 long cnt = ::InterlockedDecrement (&refcnt); 65 if (cnt == 0) 66 delete this; 67 return cnt; 68 } 69 #endif 49 DECLARE_NOT_AGGREGATABLE(VBoxSDLFB) 50 51 DECLARE_PROTECT_FINAL_CONSTRUCT() 52 53 VBoxSDLFB() { /* empty */ } 54 ~VBoxSDLFB() { /* empty */ } 55 56 HRESULT FinalConstruct(); 57 void FinalRelease(); 58 59 HRESULT init(uint32_t uScreenId, 60 bool fFullscreen = false, bool fResizable = true, bool fShowSDLConfig = false, 61 bool fKeepHostRes = false, uint32_t u32FixedWidth = ~(uint32_t)0, 62 uint32_t u32FixedHeight = ~(uint32_t)0, uint32_t u32FixedBPP = ~(uint32_t)0); 63 void uninit(); 64 65 static bool initSDL(bool fShowSDLConfig); 66 static void uninitSDL(); 70 67 71 68 BEGIN_COM_MAP(VBoxSDLFB) 72 VBOX_ DEFAULT_INTERFACE_ENTRIES(IFramebuffer)69 VBOX_MINIMAL_INTERFACE_ENTRIES(IFramebuffer) 73 70 END_COM_MAP() 74 71 … … 188 185 /** secure label offset from the top of the secure label */ 189 186 uint32_t mLabelOffs; 190 191 #endif 192 #ifdef RT_OS_WINDOWS 193 long refcnt; 194 #endif 187 #endif 188 195 189 SDL_Surface *mSurfVRAM; 196 190 … … 204 198 205 199 class VBoxSDLFBOverlay : 206 public IFramebufferOverlay 200 public CComObjectRootEx<CComMultiThreadModelNoCS>, 201 VBOX_SCRIPTABLE_IMPL(IFramebufferOverlay) 207 202 { 208 203 public: 204 DECLARE_NOT_AGGREGATABLE(VBoxSDLFBOverlay) 205 209 206 VBoxSDLFBOverlay(ULONG x, ULONG y, ULONG width, ULONG height, BOOL visible, 210 207 VBoxSDLFB *aParent); 211 208 virtual ~VBoxSDLFBOverlay(); 212 209 213 #ifdef RT_OS_WINDOWS214 STDMETHOD_(ULONG, AddRef)()215 {216 return ::InterlockedIncrement (&refcnt);217 }218 STDMETHOD_(ULONG, Release)()219 {220 long cnt = ::InterlockedDecrement (&refcnt);221 if (cnt == 0)222 delete this;223 return cnt;224 }225 #endif226 227 210 BEGIN_COM_MAP(VBoxSDLFBOverlay) 228 VBOX_ DEFAULT_INTERFACE_ENTRIES(IFramebuffer)211 VBOX_MINIMAL_INTERFACE_ENTRIES(IFramebufferOverlay) 229 212 END_COM_MAP() 230 213 … … 277 260 /** Additional SDL surface used for combining the framebuffer and the overlay */ 278 261 SDL_Surface *mBlendedBits; 279 #ifdef RT_OS_WINDOWS280 long refcnt;281 #endif282 262 }; 283 263 -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r41120 r41215 203 203 204 204 static ULONG gcMonitors = 1; 205 static VBoxSDLFB *gpFramebuffer[64];205 static ComObjPtr<VBoxSDLFB> gpFramebuffer[64]; 206 206 static SDL_Cursor *gpDefaultCursor = NULL; 207 207 #ifdef VBOXSDL_WITH_X11 … … 1780 1780 1781 1781 /* static initialization of the SDL stuff */ 1782 if (!VBoxSDLFB::init (fShowSDLConfig))1782 if (!VBoxSDLFB::initSDL(fShowSDLConfig)) 1783 1783 goto leave; 1784 1784 … … 1790 1790 { 1791 1791 // create our SDL framebuffer instance 1792 gpFramebuffer[i] = new VBoxSDLFB(i, fFullscreen, fResizable, fShowSDLConfig, false, 1793 fixedWidth, fixedHeight, fixedBPP); 1794 1795 if (!gpFramebuffer[i]) 1792 rc = gpFramebuffer[i].createObject(); 1793 if (SUCCEEDED(rc)) 1794 rc = gpFramebuffer[i]->init(i, fFullscreen, fResizable, fShowSDLConfig, false, 1795 fixedWidth, fixedHeight, fixedBPP); 1796 1797 if (FAILED(rc) || !gpFramebuffer[i]) 1796 1798 { 1797 1799 RTPrintf("Error: could not create framebuffer object!\n"); … … 2870 2872 } 2871 2873 2872 VBoxSDLFB::uninit ();2874 VBoxSDLFB::uninitSDL(); 2873 2875 2874 2876 #ifdef VBOX_SECURELABEL
Note:
See TracChangeset
for help on using the changeset viewer.