Changeset 15900 in vbox for trunk/src/VBox/Frontends/VirtualBox4
- Timestamp:
- Jan 12, 2009 3:57:40 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxFrameBuffer.cpp
r14056 r15900 547 547 void VBoxSDLFrameBuffer::resizeEvent (VBoxResizeEvent *re) 548 548 { 549 /* Check whether the guest resolution has not been changed. */ 550 bool fSameResolutionRequested = ( width() == re->width() 551 && height() == re->height() 552 ); 553 554 /* Check if the guest VRAM can be used as the source bitmap. */ 555 bool fallback = false; 556 557 Uint32 Rmask = 0; 558 Uint32 Gmask = 0; 559 Uint32 Bmask = 0; 560 561 if (re->pixelFormat() == FramebufferPixelFormat_FOURCC_RGB) 562 { 563 switch (re->bitsPerPixel()) 564 { 565 case 32: 566 Rmask = 0x00FF0000; 567 Gmask = 0x0000FF00; 568 Bmask = 0x000000FF; 569 break; 570 case 24: 571 Rmask = 0x00FF0000; 572 Gmask = 0x0000FF00; 573 Bmask = 0x000000FF; 574 break; 575 case 16: 576 Rmask = 0xF800; 577 Gmask = 0x07E0; 578 Bmask = 0x001F; 579 break; 580 default: 581 /* Unsupported format leads to the indirect buffer */ 582 fallback = true; 583 break; 584 } 585 } 586 else 587 { 588 /* Unsupported format leads to the indirect buffer */ 589 fallback = true; 590 } 591 549 592 mWdt = re->width(); 550 593 mHgt = re->height(); 551 594 552 /* close SDL so we can init it again*/595 /* Recreate the source surface. */ 553 596 if (mSurfVRAM) 554 597 { … … 556 599 mSurfVRAM = NULL; 557 600 } 601 602 if (!fallback) 603 { 604 /* It is OK to create the source surface from the guest VRAM. */ 605 mSurfVRAM = SDL_CreateRGBSurfaceFrom(re->VRAM(), re->width(), re->height(), 606 re->bitsPerPixel(), 607 re->bytesPerLine(), 608 Rmask, Gmask, Bmask, 0); 609 LogFlowFunc (("Created VRAM surface %p\n", mSurfVRAM)); 610 if (mSurfVRAM == NULL) 611 { 612 fallback = true; 613 } 614 } 615 616 if (fSameResolutionRequested) 617 { 618 LogFlowFunc(("the same resolution requested, skipping the resize.\n")); 619 return; 620 } 621 622 /* close SDL so we can init it again */ 558 623 if (mScreen) 559 624 { … … 588 653 LogFlowFunc (("Setting SDL video mode to %d x %d\n", mWdt, mHgt)); 589 654 590 bool fallback = false;591 592 Uint32 Rmask = 0;593 Uint32 Gmask = 0;594 Uint32 Bmask = 0;595 596 if (re->pixelFormat() == FramebufferPixelFormat_FOURCC_RGB)597 {598 switch (re->bitsPerPixel())599 {600 case 32:601 Rmask = 0x00FF0000;602 Gmask = 0x0000FF00;603 Bmask = 0x000000FF;604 break;605 case 24:606 Rmask = 0x00FF0000;607 Gmask = 0x0000FF00;608 Bmask = 0x000000FF;609 break;610 case 16:611 Rmask = 0xF800;612 Gmask = 0x07E0;613 Bmask = 0x001F;614 default:615 /* Unsupported format leads to the indirect buffer */616 fallback = true;617 break;618 }619 620 if (!fallback)621 {622 /* Create a source surface from guest VRAM. */623 mSurfVRAM = SDL_CreateRGBSurfaceFrom(re->VRAM(), mWdt, mHgt,624 re->bitsPerPixel(),625 re->bytesPerLine(),626 Rmask, Gmask, Bmask, 0);627 LogFlowFunc (("Created VRAM surface %p\n", mSurfVRAM));628 if (mSurfVRAM == NULL)629 fallback = true;630 }631 }632 else633 {634 /* Unsupported format leads to the indirect buffer */635 fallback = true;636 }637 638 655 /* Pixel format is RGB in any case */ 639 656 mPixelFormat = FramebufferPixelFormat_FOURCC_RGB;
Note:
See TracChangeset
for help on using the changeset viewer.