Changeset 20906 in vbox for trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h
- Timestamp:
- Jun 24, 2009 10:32:18 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h
r20701 r20906 386 386 }; 387 387 388 class VBoxVHWAColorKey 389 { 390 public: 391 VBoxVHWAColorKey() : 392 mUpper(0), 393 mLower(0) 394 {} 395 396 VBoxVHWAColorKey(uint32_t aUpper, uint32_t aLower) : 397 mUpper(aUpper), 398 mLower(aLower) 399 {} 400 401 uint32_t upper() {return mUpper; } 402 uint32_t lower() {return mLower; } 403 private: 404 uint32_t mUpper; 405 uint32_t mLower; 406 }; 407 408 class VBoxVHWAColorFormat 409 { 410 public: 411 412 VBoxVHWAColorFormat(GLint aInternalFormat, GLenum aFormat, GLenum aType, uint32_t aDataFormat) : 413 mInternalFormat(aInternalFormat), 414 mFormat(aFormat), 415 mType(aType), 416 mDataFormat(aDataFormat) 417 {} 418 419 GLint internalFormat() const {return mInternalFormat; } 420 GLenum format() const {return mFormat; } 421 GLenum type() const {return mType; } 422 uint32_t dataFormat() const {return mDataFormat;} 423 424 void pixel2Normalized(uint32_t pix, float &r, float &g, float &b); 425 uint32_t r(uint32_t pix); 426 uint32_t g(uint32_t pix); 427 uint32_t b(uint32_t pix); 428 429 private: 430 GLint mInternalFormat; 431 GLenum mFormat; 432 GLenum mType; 433 uint32_t mDataFormat; 434 435 uint32_t mRMask; 436 uint32_t mGMask; 437 uint32_t mBMask; 438 uint32_t mRRange; 439 uint32_t mGRange; 440 uint32_t mBRange; 441 442 }; 443 388 444 class VBoxVHWASurfaceBase 389 445 { 390 446 public: 391 447 VBoxVHWASurfaceBase(GLsizei aWidth, GLsizei aHeight, 392 GLint aInternalFormat, GLenum aFormat, GLenum aType); 448 VBoxVHWAColorFormat & aColorFormat, 449 VBoxVHWAColorKey * pSrcBltCKey, VBoxVHWAColorKey * pDstBltCKey, 450 VBoxVHWAColorKey * pSrcOverlayCKey, VBoxVHWAColorKey * pDstOverlayCKey); 393 451 394 452 virtual ~VBoxVHWASurfaceBase(); … … 400 458 static void globalInit(); 401 459 402 int blt(const QRect * aDstRect, VBoxVHWASurfaceBase * aSrtSurface, const QRect * aSrcRect); 403 404 int lock(const QRect * pRect, uint32_t flags); 405 406 int unlock(); 407 408 virtual void makeCurrent() = 0; 460 int blt(const QRect * aDstRect, VBoxVHWASurfaceBase * aSrtSurface, const QRect * aSrcRect, uint32_t flags, struct _VBOXVHWA_BLTDESC * pBltInfo); 461 462 virtual int lock(const QRect * pRect, uint32_t flags); 463 464 virtual int unlock(); 409 465 410 466 void paint(const QRect * aRect); 411 467 412 void performDisplay() { Assert(mDisplayInitialized); glCallList(mDisplay); }468 void performDisplay(); 413 469 414 470 static ulong calcBytesPerPixel(GLenum format, GLenum type); … … 424 480 ulong height() { return mRect.height(); } 425 481 426 GLenum format() {return mFormat; } 427 GLint internalFormat() { return mInternalFormat; } 428 GLenum type() { return mType; } 482 GLenum format() {return mColorFormat.format(); } 483 GLint internalFormat() { return mColorFormat.internalFormat(); } 484 GLenum type() { return mColorFormat.type(); } 485 uint32_t dataFormat() {return mColorFormat.dataFormat(); } 486 429 487 ulong bytesPerPixel() { return mBytesPerPixel; } 430 488 ulong bytesPerLine() { return mBytesPerLine; } 431 489 490 const VBoxVHWAColorKey * dstBltCKey() { return mDstBltCKeyValid ? &mDstBltCKey : NULL; } 491 const VBoxVHWAColorKey * srcBltCKey() { return mSrcBltCKeyValid ? &mSrcBltCKey : NULL; } 492 const VBoxVHWAColorKey * dstOverlayCKey() { return mDstOverlayCKeyValid ? &mDstOverlayCKey : NULL; } 493 const VBoxVHWAColorKey * srcOverlayCKey() { return mSrcOverlayCKeyValid ? &mSrcOverlayCKey : NULL; } 494 const VBoxVHWAColorFormat & colorFormat() {return mColorFormat; } 495 432 496 /* clients should treat the returned texture as read-only */ 433 497 GLuint textureSynched(const QRect * aRect) { synchTexture(aRect); return mTexture; } … … 437 501 const QRect& rect() {return mRect;} 438 502 439 virtual bool isPrimary() = 0; 503 // /* surface currently being displayed in a flip chain */ 504 // virtual bool isPrimary() = 0; 505 // /* surface representing the main framebuffer. */ 506 // virtual bool isMainFramebuffer() = 0; 507 virtual void makeCurrent() = 0; 508 #ifdef VBOX_WITH_VIDEOHWACCEL 509 virtual class VBoxVHWAGlProgramMngr * getGlProgramMngr() = 0; 510 #endif 440 511 private: 441 512 void initDisplay(); … … 453 524 GLuint mTexture; 454 525 526 VBoxVHWAColorFormat mColorFormat; 527 VBoxVHWAColorKey mSrcBltCKey; 528 VBoxVHWAColorKey mDstBltCKey; 529 VBoxVHWAColorKey mSrcOverlayCKey; 530 VBoxVHWAColorKey mDstOverlayCKey; 531 bool mSrcBltCKeyValid; 532 bool mDstBltCKeyValid; 533 bool mSrcOverlayCKeyValid; 534 bool mDstOverlayCKeyValid; 455 535 GLenum mFormat; 456 536 GLint mInternalFormat; … … 472 552 }; 473 553 474 class VBoxVHWASurfacePrimary : public VBoxVHWASurfaceBase 475 { 476 public: 477 VBoxVHWASurfacePrimary(GLsizei aWidth, GLsizei aHeight, 478 GLint aInternalFormat, GLenum aFormat, GLenum aType, 479 class VBoxGLWidget *pWidget) : 554 class VBoxVHWASurfaceQGL : public VBoxVHWASurfaceBase 555 { 556 public: 557 VBoxVHWASurfaceQGL(GLsizei aWidth, GLsizei aHeight, 558 VBoxVHWAColorFormat & aColorFormat, 559 VBoxVHWAColorKey * pSrcBltCKey, VBoxVHWAColorKey * pDstBltCKey, 560 VBoxVHWAColorKey * pSrcOverlayCKey, VBoxVHWAColorKey * pDstOverlayCKey, 561 class VBoxGLWidget *pWidget, 562 bool bBackBuffer) : 480 563 VBoxVHWASurfaceBase(aWidth, aHeight, 481 aInternalFormat, aFormat, aType), 482 mWidget(pWidget) 564 aColorFormat, 565 pSrcBltCKey, pDstBltCKey, pSrcOverlayCKey, pDstOverlayCKey), 566 mWidget(pWidget), 567 mCreateBuf(bBackBuffer) 483 568 {} 484 569 485 bool isPrimary() {return true;}486 570 void makeCurrent(); 571 572 void init(uchar *pvMem); 573 574 int unlock() 575 { 576 int rc = VBoxVHWASurfaceBase::unlock(); 577 if(!mBuffer) 578 performDisplay(); 579 return rc; 580 } 581 #ifdef VBOX_WITH_VIDEOHWACCEL 582 class VBoxVHWAGlProgramMngr * getGlProgramMngr(); 583 #endif 487 584 private: 488 585 class VBoxGLWidget *mWidget; 586 class QGLPixelBuffer *mBuffer; 587 bool mCreateBuf; 489 588 }; 490 589 … … 492 591 { 493 592 public: 494 VBoxGLWidget (QWidget *aParent) 495 : QGLWidget (aParent), 496 pDisplay(NULL), 497 mBitsPerPixel(0), 498 mPixelFormat(0), 499 mUsesGuestVRAM(false) 500 { 501 // /* No need for background drawing */ 502 // setAttribute (Qt::WA_OpaquePaintEvent); 503 } 593 VBoxGLWidget (QWidget *aParent); 594 ~VBoxGLWidget(); 504 595 505 596 ulong vboxPixelFormat() { return mPixelFormat; } … … 518 609 #ifdef VBOX_WITH_VIDEOHWACCEL 519 610 void vboxVHWACmd (struct _VBOXVHWACMD * pCmd) {vboxPerformGLOp(&VBoxGLWidget::vboxDoVHWACmd, pCmd);} 520 #endif 521 522 VBoxVHWASurfacePrimary * vboxGetSurface() { return pDisplay; } 611 class VBoxVHWAGlProgramMngr * vboxVHWAGetGlProgramMngr(); 612 #endif 613 614 VBoxVHWASurfaceQGL * vboxGetSurface() { return pDisplay; } 523 615 protected: 524 616 // void resizeGL (int height, int width); … … 557 649 #endif 558 650 559 VBoxVHWASurface Primary* pDisplay;651 VBoxVHWASurfaceQGL * pDisplay; 560 652 /* we need to do all opengl stuff in the paintGL context, 561 653 * submit the operation to be performed */ … … 568 660 ulong mPixelFormat; 569 661 bool mUsesGuestVRAM; 662 663 #ifdef VBOX_WITH_VIDEOHWACCEL 664 class VBoxVHWAGlProgramMngr *mpMngr; 665 #endif 570 666 }; 571 667
Note:
See TracChangeset
for help on using the changeset viewer.