Changeset 50313 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.cpp
- Timestamp:
- Feb 3, 2014 6:46:27 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 92022
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.cpp
r50277 r50313 654 654 } 655 655 656 static void crServerCopySubImage(char *pDst, char* pSrc, CRrecti *pRect, int srcWidth, int srcHeight)657 {658 int i;659 int dstrowsize = 4*(pRect->x2-pRect->x1);660 int srcrowsize = 4*srcWidth;661 int height = pRect->y2-pRect->y1;662 663 pSrc += 4*pRect->x1 + srcrowsize*(srcHeight-1-pRect->y1);664 665 for (i=0; i<height; ++i)666 {667 crMemcpy(pDst, pSrc, dstrowsize);668 669 pSrc -= srcrowsize;670 pDst += dstrowsize;671 }672 }673 674 656 DECLEXPORT(void) crServerVBoxCompositionSetEnableStateGlobal(GLboolean fEnable) 675 657 { 658 } 659 660 DECLEXPORT(int) crServerVBoxScreenshotGet(uint32_t u32Screen, CR_SCREENSHOT *pScreenshot) 661 { 662 HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(u32Screen); 663 if (!hFb) 664 return VERR_INVALID_STATE; 665 666 const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb); 667 668 if (CrFbHas3DData(hFb)) 669 { 670 RTPOINT Pos = {0, 0}; 671 RTRECT Rect; 672 673 pScreenshot->Img.cbData = pScreen->u32LineSize * pScreen->u32Height; 674 pScreenshot->Img.pvData = RTMemAlloc(pScreenshot->Img.cbData); 675 if (!pScreenshot->Img.pvData) 676 { 677 WARN(("RTMemAlloc failed")); 678 return VERR_NO_MEMORY; 679 } 680 pScreenshot->Img.enmFormat = GL_BGRA; 681 pScreenshot->Img.width = pScreen->u32Width; 682 pScreenshot->Img.height = pScreen->u32Height; 683 pScreenshot->Img.bpp = pScreen->u16BitsPerPixel; 684 pScreenshot->Img.pitch = pScreen->u32LineSize; 685 Rect.xLeft = 0; 686 Rect.yTop = 0; 687 Rect.xRight = pScreenshot->Img.width; 688 Rect.yBottom = pScreenshot->Img.height; 689 int rc = CrFbBltGetContents(hFb, &Pos, 1, &Rect, &pScreenshot->Img); 690 if (!RT_SUCCESS(rc)) 691 { 692 WARN(("CrFbBltGetContents failed %d", rc)); 693 RTMemFree(pScreenshot->Img.pvData); 694 return rc; 695 } 696 pScreenshot->fDataIsFbDirect = 0; 697 } 698 else 699 { 700 pScreenshot->Img.pvData = CrFbGetVRAM(hFb); 701 pScreenshot->Img.cbData = pScreen->u32LineSize * pScreen->u32Height; 702 pScreenshot->Img.enmFormat = GL_BGRA; 703 pScreenshot->Img.width = pScreen->u32Width; 704 pScreenshot->Img.height = pScreen->u32Height; 705 pScreenshot->Img.bpp = pScreen->u16BitsPerPixel; 706 pScreenshot->Img.pitch = pScreen->u32LineSize; 707 708 pScreenshot->fDataIsFbDirect = 1; 709 } 710 711 pScreenshot->u32Screen = u32Screen; 712 713 return VINF_SUCCESS; 714 } 715 716 DECLEXPORT(void) crServerVBoxScreenshotRelease(CR_SCREENSHOT *pScreenshot) 717 { 718 if (!pScreenshot->fDataIsFbDirect) 719 { 720 RTMemFree(pScreenshot->Img.pvData); 721 pScreenshot->fDataIsFbDirect = 1; 722 } 676 723 } 677 724
Note:
See TracChangeset
for help on using the changeset viewer.