Changeset 25440 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Dec 16, 2009 4:55:45 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56090
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
r25385 r25440 5158 5158 } 5159 5159 5160 uint32_t VBoxVHWATextureImage::calcProgramType(VBoxVHWATextureImage *pDst, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool bNotIntersected) 5161 { 5162 uint32_t type = 0; 5163 5164 if(pDstCKey != NULL) 5165 type |= VBOXVHWA_PROGRAM_DSTCOLORKEY; 5166 if(pSrcCKey) 5167 type |= VBOXVHWA_PROGRAM_SRCCOLORKEY; 5168 if((pDstCKey || pSrcCKey) && bNotIntersected) 5169 type |= VBOXVHWA_PROGRAM_COLORKEYNODISCARD; 5170 5171 return type; 5172 } 5173 5160 5174 class VBoxVHWAGlProgramVHWA * VBoxVHWATextureImage::calcProgram(VBoxVHWATextureImage *pDst, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool bNotIntersected) 5161 5175 { 5162 uint32_t type = 0;5176 uint32_t type = calcProgramType(pDst, pDstCKey, pSrcCKey, bNotIntersected); 5163 5177 5164 5178 if(pDstCKey != NULL) -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h
r25423 r25440 482 482 } 483 483 484 v oid draw(VBoxVHWATextureImage *pDst, const QRect * pDstRect, const QRect * pSrcRect);485 486 uint32_t texCoord(GLenum tex, int x, int y)484 virtual void draw(VBoxVHWATextureImage *pDst, const QRect * pDstRect, const QRect * pSrcRect); 485 486 virtual uint32_t texCoord(GLenum tex, int x, int y) 487 487 { 488 488 uint32_t c = 1; … … 498 498 } 499 499 500 void bind(VBoxVHWATextureImage * pPrimary); 501 502 class VBoxVHWAGlProgramVHWA * calcProgram(VBoxVHWATextureImage *pDst, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool bNotIntersected); 503 504 int createDisplay(VBoxVHWATextureImage *pDst, const QRect * pDstRect, const QRect * pSrcRect, 500 virtual void bind(VBoxVHWATextureImage * pPrimary); 501 502 virtual uint32_t calcProgramType(VBoxVHWATextureImage *pDst, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool bNotIntersected); 503 504 virtual class VBoxVHWAGlProgramVHWA * calcProgram(VBoxVHWATextureImage *pDst, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool bNotIntersected); 505 506 virtual int createDisplay(VBoxVHWATextureImage *pDst, const QRect * pDstRect, const QRect * pSrcRect, 505 507 const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool bNotIntersected, 506 508 GLuint *pDisplay, class VBoxVHWAGlProgramVHWA ** ppProgram); … … 678 680 } 679 681 680 void bind( VBoxVHWATexture *pTex)682 void bind() 681 683 { 682 684 VBOXQGL_CHECKERR( 683 685 vboxglBindFramebuffer(GL_FRAMEBUFFER, mFBO); 684 686 ); 687 } 688 689 void unbind(VBoxVHWATexture *pTex) 690 { 691 VBOXQGL_CHECKERR( 692 vboxglBindFramebuffer(GL_FRAMEBUFFER, 0); 693 ); 694 } 695 696 void attachBound(VBoxVHWATexture *pTex) 697 { 685 698 VBOXQGL_CHECKERR( 686 699 vboxglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, pTex->texTarget(), pTex->texture(), 0); 687 700 ); 688 701 } 702 689 703 private: 690 704 GLuint mFBO; 705 }; 706 707 template <class T> 708 class VBoxVHWATextureImageFBO : public T 709 { 710 public: 711 VBoxVHWATextureImageFBO(const QRect &size, const VBoxVHWAColorFormat &format, class VBoxVHWAGlProgramMngr * aMgr) : 712 T(size, format, aMgr), 713 mFBOTex(size, VBoxVHWAColorFormat(32, 0xff0000, 0xff00, 0xff), aMgr) 714 { 715 } 716 717 virtual void init(uchar *pvMem) 718 { 719 mFBO.init(); 720 mFBOTex.init(NULL); 721 T:init(pvMem); 722 mFBO.bind(); 723 mFBO.attachBound(mFBOTex.mpTex[0]); 724 mFBO.unbind(); 725 } 726 727 virtual int createDisplay(VBoxVHWATextureImage *pDst, const QRect * pDstRect, const QRect * pSrcRect, 728 const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool bNotIntersected, 729 GLuint *pDisplay, class VBoxVHWAGlProgramVHWA ** ppProgram) 730 { 731 T::createDisplay(&mFBOTex, &mFBOTex.rect(), &rect(), 732 NULL, NULL, false, 733 pDisplay, ppProgram); 734 735 return mFBOTex.createDisplay(pDst, pDstRect, pSrcRect, 736 pDstCKey, pSrcCKey, bNotIntersected, 737 pDisplay, ppProgram); 738 } 739 740 virtual void update(const QRect * pRect) 741 { 742 mFBO.bind(); 743 T:update(pRect); 744 745 VBoxGLWidget::pushSettingsAndSetupViewport(rect(), rect()); 746 mFBO.bind(); 747 mFBOTex.draw(); 748 mFBO.unbind(); 749 VBoxGLWidget::popSettingsAfterSetupViewport(); 750 } 751 752 virtual void display(VBoxVHWATextureImage *pDst, const QRect * pDstRect, const QRect * pSrcRect, 753 const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool bNotIntersected) 754 { 755 mFBOTex.display(pDst, pDstRect, pSrcRect, pDstCKey, pSrcCKey, bNotIntersected); 756 } 757 758 virtual void display() 759 { 760 mFBOTex.display(); 761 } 762 private: 763 VBoxVHWAFBO mFBO; 764 VBoxVHWATextureImage mFBOTex; 691 765 }; 692 766 … … 1430 1504 1431 1505 VHWACommandList &onResizeCmdList() { return mOnResizeCmdList; } 1506 1507 static void pushSettingsAndSetupViewport(const QSize &display, const QRect &viewport) 1508 { 1509 glPushAttrib(GL_ALL_ATTRIB_BITS); 1510 glMatrixMode(GL_PROJECTION); 1511 glPushMatrix(); 1512 // glMatrixMode(GL_MODELVIEW); 1513 setupMatricies(display); 1514 adjustViewport(display, viewport); 1515 } 1516 1517 static void popSettingsAfterSetupViewport() 1518 { 1519 glPopAttrib(); 1520 glMatrixMode(GL_PROJECTION); 1521 glPopMatrix(); 1522 glMatrixMode(GL_MODELVIEW); 1523 } 1524 1432 1525 protected: 1433 1526 … … 1710 1803 ULONG aW, ULONG aH) 1711 1804 { 1712 if(mOverlay.onNotifyUpdate (aX, aY, aW, aH))1805 if(mOverlay.onNotifyUpdate (aX, aY, aW, aH)) 1713 1806 return S_OK; 1714 return T::NotifyUpdate (aX, aY, aW, aH);1807 return T::NotifyUpdate (aX, aY, aW, aH); 1715 1808 } 1716 1809 1717 1810 void resizeEvent (VBoxResizeEvent *re) 1718 1811 { 1719 mOverlay.onResizeEvent (re);1720 T::resizeEvent (re);1721 mOverlay.onResizeEventPostprocess (re);1722 } 1723 1724 void viewportResized (QResizeEvent * re)1812 mOverlay.onResizeEvent (re); 1813 T::resizeEvent (re); 1814 mOverlay.onResizeEventPostprocess (re); 1815 } 1816 1817 void viewportResized (QResizeEvent * re) 1725 1818 { 1726 1819 mOverlay.onViewportResized(re); … … 1728 1821 } 1729 1822 1730 void viewportScrolled (int dx, int dy)1731 { 1732 mOverlay.onViewportScrolled (dx, dy);1733 T::viewportScrolled (dx, dy);1823 void viewportScrolled (int dx, int dy) 1824 { 1825 mOverlay.onViewportScrolled (dx, dy); 1826 T::viewportScrolled (dx, dy); 1734 1827 } 1735 1828 private:
Note:
See TracChangeset
for help on using the changeset viewer.