Changeset 3761 in vbox for trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h
- Timestamp:
- Jul 22, 2007 10:43:14 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h
r3674 r3761 73 73 { 74 74 public: 75 VBoxResizeEvent (FramebufferPixelFormat_T f, uchar *v, unsigned l, int w, int h) : 76 QEvent ((QEvent::Type) VBoxDefs::ResizeEventType), fmt (f), vr (v), lsz (l), wdt (w), hgt (h) {} 77 FramebufferPixelFormat_T pixelFormat() { return fmt; } 78 uchar *vram() { return vr; } 79 unsigned lineSize() { return lsz; } 80 int width() { return wdt; } 81 int height() { return hgt; } 82 private: 83 FramebufferPixelFormat_T fmt; 84 uchar *vr; 85 unsigned lsz; 86 int wdt; 87 int hgt; 75 76 VBoxResizeEvent (ulong aPixelFormat, uchar *aVRAM, 77 ulong aBitsPerPixel, ulong aBytesPerLine, 78 ulong aWidth, ulong aHeight) : 79 QEvent ((QEvent::Type) VBoxDefs::ResizeEventType), 80 mPixelFormat (aPixelFormat), mVRAM (aVRAM), mBitsPerPixel (aBitsPerPixel), 81 mBytesPerLine (aBytesPerLine), mWidth (aWidth), mHeight (aHeight) {} 82 ulong pixelFormat() { return mPixelFormat; } 83 uchar *VRAM() { return mVRAM; } 84 ulong bitsPerPixel() { return mBitsPerPixel; } 85 ulong bytesPerLine() { return mBytesPerLine; } 86 ulong width() { return mWidth; } 87 ulong height() { return mHeight; } 88 89 private: 90 91 ulong mPixelFormat; 92 uchar *mVRAM; 93 ulong mBitsPerPixel; 94 ulong mBytesPerLine; 95 ulong mWidth; 96 ulong mHeight; 88 97 }; 89 98 … … 145 154 bool rc = pm.convertFromImage (QImage (addr, 146 155 display.GetWidth(), display.GetHeight(), 147 display.Get ColorDepth(),156 display.GetBitsPerPixel(), 148 157 0, 0, QImage::LittleEndian)); 149 158 AssertMsg (rc, ("convertFromImage() must always return true")); … … 157 166 158 167 ///////////////////////////////////////////////////////////////////////////// 159 160 /* Framebuffer render mode */161 typedef enum162 {163 RenderModeNormal = 0,164 RenderModeSeamless = 1,165 RenderModeHostWindow = 2166 } FramebufferRenderMode;167 168 168 169 /** … … 198 199 199 200 #if defined (Q_OS_WIN32) 200 STDMETHOD_(ULONG, AddRef)() { 201 202 STDMETHOD_(ULONG, AddRef)() 203 { 201 204 return ::InterlockedIncrement (&refcnt); 202 205 } 206 203 207 STDMETHOD_(ULONG, Release)() 204 208 { … … 208 212 return cnt; 209 213 } 214 210 215 STDMETHOD(QueryInterface) (REFIID riid , void **ppObj) 211 216 { … … 223 228 return E_NOINTERFACE; 224 229 } 230 225 231 #endif 226 232 … … 229 235 STDMETHOD(COMGETTER(Width)) (ULONG *aWidth); 230 236 STDMETHOD(COMGETTER(Height)) (ULONG *aHeight); 231 STDMETHOD(COMGETTER(ColorDepth)) (ULONG *aColorDepth); 232 STDMETHOD(COMGETTER(LineSize)) (ULONG *aLineSize); 233 STDMETHOD(COMGETTER(PixelFormat)) (FramebufferPixelFormat_T *aPixelFormat); 237 STDMETHOD(COMGETTER(BitsPerPixel)) (ULONG *aBitsPerPixel); 238 STDMETHOD(COMGETTER(BytesPerLine)) (ULONG *aBytesPerLine); 239 STDMETHOD(COMGETTER(PixelFormat)) (ULONG *aPixelFormat); 240 STDMETHOD(COMGETTER(UsesGuestVRAM)) (BOOL *aUsesGuestVRAM); 234 241 STDMETHOD(COMGETTER(HeightReduction)) (ULONG *aHeightReduction); 235 242 STDMETHOD(COMGETTER(Overlay)) (IFramebufferOverlay **aOverlay); 236 STDMETHOD(COMGETTER(RenderMode)) (FramebufferRenderMode *renderMode);237 STDMETHOD(COMSETTER(RenderMode)) (FramebufferRenderMode renderMode);238 243 239 244 STDMETHOD(Lock)(); 240 245 STDMETHOD(Unlock)(); 241 246 242 STDMETHOD(RequestResize) (ULONG aScreenId, FramebufferPixelFormat_TaPixelFormat,243 BYTE *aVRAM, ULONG a LineSize,247 STDMETHOD(RequestResize) (ULONG aScreenId, ULONG aPixelFormat, 248 BYTE *aVRAM, ULONG aBitsPerPixel, ULONG aBytesPerLine, 244 249 ULONG aWidth, ULONG aHeight, 245 250 BOOL *aFinished); … … 257 262 STDMETHOD(SetVisibleRegion)(BYTE *aRectangles, ULONG aCount); 258 263 259 // Helper functions 260 int width() { return mWdt; } 261 int height() { return mHgt; } 262 263 virtual FramebufferPixelFormat_T pixelFormat() 264 { 265 return FramebufferPixelFormat_PixelFormatOpaque; 264 ulong width() { return mWdt; } 265 ulong height() { return mHgt; } 266 267 virtual ulong pixelFormat() 268 { 269 return FramebufferPixelFormat_FOURCC_RGB; 270 } 271 272 virtual bool usesGuestVRAM() 273 { 274 return false; 266 275 } 267 276 … … 270 279 271 280 virtual uchar *address() = 0; 272 virtual int colorDepth() = 0;273 virtual int lineSize() = 0;281 virtual ulong bitsPerPixel() = 0; 282 virtual ulong bytesPerLine() = 0; 274 283 275 284 /** … … 302 311 int mHgt; 303 312 304 /* Framebuffer render mode */305 FramebufferRenderMode mRenderMode;306 307 313 #if defined (Q_OS_WIN32) 308 314 private: … … 325 331 BOOL *aFinished); 326 332 333 ulong pixelFormat() { return mPixelFormat; } 334 bool usesGuestVRAM() { return mUsesGuestVRAM; } 335 327 336 uchar *address() { return mImg.bits(); } 328 int colorDepth() { return mImg.depth(); }329 int lineSize() { return mImg.bytesPerLine(); }337 ulong bitsPerPixel() { return mImg.depth(); } 338 ulong bytesPerLine() { return mImg.bytesPerLine(); } 330 339 331 340 void paintEvent (QPaintEvent *pe); … … 336 345 QPixmap mPM; 337 346 QImage mImg; 347 ulong mPixelFormat; 348 bool mUsesGuestVRAM; 338 349 }; 339 350 … … 357 368 uchar *address() 358 369 { 359 if (mSurfVRAM) 360 { 361 return (uchar*) (mScreen ? (uintptr_t) mSurfVRAM->pixels : 0); 362 } 363 else 364 { 365 return (uchar*) (mScreen ? (uintptr_t) mScreen->pixels : 0); 366 } 367 } 368 369 int colorDepth() 370 { 371 SDL_Surface *surf = mSurfVRAM ? mSurfVRAM: mScreen; 370 SDL_Surface *surf = mSurfVRAM ? mSurfVRAM : mScreen; 371 return surf ? (uchar *) (uintptr_t) mScreen->pixels : 0; 372 } 373 374 ulong bitsPerPixel() 375 { 376 SDL_Surface *surf = mSurfVRAM ? mSurfVRAM : mScreen; 372 377 return surf ? surf->format->BitsPerPixel : 0; 373 378 } 374 379 375 int lineSize()376 { 377 SDL_Surface *surf = mSurfVRAM ? mSurfVRAM : mScreen;380 ulong bytesPerLine() 381 { 382 SDL_Surface *surf = mSurfVRAM ? mSurfVRAM : mScreen; 378 383 return surf ? surf->pitch : 0; 379 384 } 380 385 381 FramebufferPixelFormat_TpixelFormat()386 ulong pixelFormat() 382 387 { 383 388 return mPixelFormat; 389 } 390 391 bool usesGuestVRAM() 392 { 393 return mSurfVRAM != NULL; 384 394 } 385 395 … … 392 402 SDL_Surface *mSurfVRAM; 393 403 394 uchar *mPtrVRAM; 395 ULONG mLineSize; 396 FramebufferPixelFormat_T mPixelFormat; 404 ulong mPixelFormat; 397 405 }; 398 406 … … 414 422 BOOL *aFinished); 415 423 416 uchar *address() { return (uchar *)mSurfaceDesc.lpSurface; } 417 int colorDepth() { return mSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; } 418 int lineSize() { return mSurfaceDesc.lPitch; } 419 420 FramebufferPixelFormat_T pixelFormat() { return mPixelFormat; }; 424 uchar *address() { return (uchar *) mSurfaceDesc.lpSurface; } 425 ulong bitsPerPixel() { return mSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; } 426 ulong bytesPerLine() { return (ulong) mSurfaceDesc.lPitch; } 427 428 ulong pixelFormat() { return mPixelFormat; }; 429 430 bool usesGuestVRAM() { return mUsesGuestVRAM; } 421 431 422 432 void paintEvent (QPaintEvent *pe); … … 425 435 426 436 private: 437 427 438 void releaseObjects(); 428 439 429 void setupSurface (FramebufferPixelFormat_T pixelFormat, uchar *pvVRAM, ULONG lineSize, ULONG w, ULONG h); 430 void recreateSurface (FramebufferPixelFormat_T pixelFormat, uchar *pvVRAM, ULONG lineSize, ULONG w, ULONG h); 431 void deleteSurface (); 440 bool createSurface (ULONG aPixelFormat, uchar *pvVRAM, 441 ULONG aBitsPerPixel, ULONG aBytesPerLine, 442 ULONG aWidth, ULONG aHeight); 443 void deleteSurface(); 432 444 void drawRect (ULONG x, ULONG y, ULONG w, ULONG h); 433 445 void getWindowPosition (void); … … 439 451 LPDIRECTDRAWSURFACE7 mPrimarySurface; 440 452 441 FramebufferPixelFormat_TmPixelFormat;442 443 BOOL mGuestVRAMSurface;453 ulong mPixelFormat; 454 455 bool mUsesGuestVRAM; 444 456 445 457 int mWndX; 446 458 int mWndY; 447 459 448 BOOLmSynchronousUpdates;460 bool mSynchronousUpdates; 449 461 }; 450 462
Note:
See TracChangeset
for help on using the changeset viewer.