Changeset 50412 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Timestamp:
- Feb 11, 2014 10:21:01 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 92180
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r50405 r50412 262 262 } 263 263 264 static void crFbBltImgS tretched(const CR_BLITTER_IMG *pSrc, const RTPOINT *pSrcDataPoint, bool fSrcInvert, const RTRECT *pCopyRect, const RTPOINT *pDstDataPoint, float strX, float strY, CR_BLITTER_IMG *pDst)264 static void crFbBltImgScaled(const CR_BLITTER_IMG *pSrc, const RTPOINT *pSrcDataPoint, bool fSrcInvert, const RTRECT *pCopyRect, const RTPOINT *pDstDataPoint, float strX, float strY, CR_BLITTER_IMG *pDst) 265 265 { 266 266 int32_t srcX = pCopyRect->xLeft - pSrcDataPoint->x; … … 271 271 Assert(srcY < pSrc->height); 272 272 273 int32_t dstX = CR_FLOAT_RCAST(int32_t, strX * (pCopyRect->xLeft - pDstDataPoint->x)); 274 int32_t dstY = CR_FLOAT_RCAST(int32_t, strY * (pCopyRect->yTop - pDstDataPoint->y)); 273 RTPOINT ScaledDtsDataPoint; 274 RTRECT ScaledCopyRect; 275 276 VBoxRectScaled(pCopyRect, strX, strY, &ScaledCopyRect); 277 ScaledDtsDataPoint.x = CR_FLOAT_RCAST(int32_t, strX * pDstDataPoint->x); 278 ScaledDtsDataPoint.y = CR_FLOAT_RCAST(int32_t, strY * pDstDataPoint->y); 279 280 int32_t dstX = ScaledCopyRect.xLeft - ScaledDtsDataPoint.x; 281 int32_t dstY = ScaledCopyRect.yTop - ScaledDtsDataPoint.y; 275 282 Assert(dstX >= 0); 276 283 Assert(dstY >= 0); 277 284 285 int32_t ScaledDstWidth = ScaledCopyRect.xRight - ScaledCopyRect.xLeft; 286 int32_t delta = (int32_t)pDst->width - dstX - ScaledDstWidth; 287 if (delta < 0) 288 ScaledDstWidth += delta; 289 290 if (ScaledDstWidth <= 0) 291 { 292 WARN(("dst width (%d) <= 0", ScaledDstWidth)); 293 return; 294 } 295 296 int32_t ScaledDstHeight = ScaledCopyRect.yBottom - ScaledCopyRect.yTop; 297 delta = (int32_t)pDst->height - dstY - ScaledDstHeight; 298 if (delta < 0) 299 ScaledDstHeight += delta; 300 301 if (ScaledDstHeight <= 0) 302 { 303 WARN(("dst height (%d) <= 0", ScaledDstHeight)); 304 return; 305 } 306 278 307 uint8_t *pu8Src = ((uint8_t*)pSrc->pvData) + pSrc->pitch * (!fSrcInvert ? srcY : pSrc->height - srcY - 1) + srcX * 4; 279 308 uint8_t *pu8Dst = ((uint8_t*)pDst->pvData) + pDst->pitch * dstY + dstX * 4; 280 309 281 310 CrBmpScale32(pu8Dst, pDst->pitch, 282 CR_FLOAT_RCAST(int32_t, strX * (pCopyRect->xRight - pCopyRect->xLeft)),283 CR_FLOAT_RCAST(int32_t, strY * (pCopyRect->yBottom - pCopyRect->yTop)),311 ScaledDstWidth, 312 ScaledDstHeight, 284 313 pu8Src, 285 314 fSrcInvert ? -pSrc->pitch : pSrc->pitch, … … 312 341 PCR_BLITTER pEnteredBlitter = NULL; 313 342 uint32_t width = 0, height = 0; 314 RTPOINT S tretchedEntryPoint = {0};343 RTPOINT ScaledEntryPoint = {0}; 315 344 316 345 VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter; … … 319 348 float strY = ((float)pImg->height) / (pSrcRect->yBottom - pSrcRect->yTop); 320 349 321 RTPOINT S tretchedSrcPoint;322 S tretchedSrcPoint.x = CR_FLOAT_RCAST(int32_t, strX * SrcPoint.x);323 S tretchedSrcPoint.y = CR_FLOAT_RCAST(int32_t, strY * SrcPoint.y);350 RTPOINT ScaledSrcPoint; 351 ScaledSrcPoint.x = CR_FLOAT_RCAST(int32_t, strX * SrcPoint.x); 352 ScaledSrcPoint.y = CR_FLOAT_RCAST(int32_t, strY * SrcPoint.y); 324 353 325 354 RTPOINT ZeroPoint = {0, 0}; … … 366 395 continue; 367 396 368 VBoxRectS tretch(&Intersection, strX, strY);397 VBoxRectScale(&Intersection, strX, strY); 369 398 if (VBoxRectIsZero(&Intersection)) 370 399 continue; … … 422 451 width = CR_FLOAT_RCAST(uint32_t, strX * pVrTex->width); 423 452 height = CR_FLOAT_RCAST(uint32_t, strY * pVrTex->height); 424 S tretchedEntryPoint.x = CR_FLOAT_RCAST(int32_t, strX * CrVrScrCompositorEntryRectGet(pEntry)->xLeft);425 S tretchedEntryPoint.y = CR_FLOAT_RCAST(int32_t, strY * CrVrScrCompositorEntryRectGet(pEntry)->yTop);453 ScaledEntryPoint.x = CR_FLOAT_RCAST(int32_t, strX * CrVrScrCompositorEntryRectGet(pEntry)->xLeft); 454 ScaledEntryPoint.y = CR_FLOAT_RCAST(int32_t, strY * CrVrScrCompositorEntryRectGet(pEntry)->yTop); 426 455 } 427 456 428 rc = CrTdBltDataAcquireS tretched(pTex, GL_BGRA, false, width, height, &pSrcImg);457 rc = CrTdBltDataAcquireScaled(pTex, GL_BGRA, false, width, height, &pSrcImg); 429 458 if (!RT_SUCCESS(rc)) 430 459 { … … 435 464 bool fInvert = !(CrVrScrCompositorEntryFlagsGet(pEntry) & CRBLT_F_INVERT_SRC_YCOORDS); 436 465 437 crFbBltImg(pSrcImg, &S tretchedEntryPoint, fInvert, &Intersection, &StretchedSrcPoint, pImg);438 439 CrTdBltDataReleaseS tretched(pTex, pSrcImg);466 crFbBltImg(pSrcImg, &ScaledEntryPoint, fInvert, &Intersection, &ScaledSrcPoint, pImg); 467 468 CrTdBltDataReleaseScaled(pTex, pSrcImg); 440 469 } 441 470 } … … 481 510 CR_BLITTER_IMG FbImg; 482 511 483 bool fS tretch= fbWidth != stretchedWidth || fbHeight != stretchedHeight;512 bool fScale = fbWidth != stretchedWidth || fbHeight != stretchedHeight; 484 513 485 514 crFbImgFromFb(hFb, &FbImg); … … 496 525 continue; 497 526 498 if (!fS tretch)527 if (!fScale) 499 528 crFbBltImg(&FbImg, &ZeroPoint, false, &Intersection, &SrcPoint, pImg); 500 529 else 501 crFbBltImgS tretched(&FbImg, &ZeroPoint, false, &Intersection, &SrcPoint, strX, strY, pImg);530 crFbBltImgScaled(&FbImg, &ZeroPoint, false, &Intersection, &SrcPoint, strX, strY, pImg); 502 531 } 503 532 } … … 517 546 } 518 547 519 static int crFbBltGetContentsS tretchCPU(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)548 static int crFbBltGetContentsScaleCPU(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg) 520 549 { 521 550 uint32_t srcWidth = pSrcRect->xRight - pSrcRect->xLeft; … … 568 597 } 569 598 570 return crFbBltGetContentsS tretchCPU(hFb, pSrcRect, cRects, pRects, pImg);599 return crFbBltGetContentsScaleCPU(hFb, pSrcRect, cRects, pRects, pImg); 571 600 } 572 601 … … 871 900 CR_TEXDATA *pReplacingTex = CrVrScrCompositorEntryTexGet(&pFbReplacingEntry->Entry); 872 901 873 CrTdBltS tretchCacheMoveTo(pTex, pReplacingTex);902 CrTdBltScaleCacheMoveTo(pTex, pReplacingTex); 874 903 875 904 if (pFb->pDisplay)
Note:
See TracChangeset
for help on using the changeset viewer.