Changeset 523 in vbox for trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
- Timestamp:
- Feb 1, 2007 9:31:13 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
r470 r523 94 94 mFixedSDLHeight = u32FixedHeight; 95 95 mFixedSDLBPP = u32FixedBPP; 96 mDefaultSDLBPP = 32; 96 97 mCenterXOffset = 0; 97 98 mCenterYOffset = 0; … … 140 141 #endif 141 142 142 if (mfShowSDLConfig) 143 { 143 const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo(); 144 Assert(videoInfo); 145 if (videoInfo) 146 { 147 switch (videoInfo->vfmt->BitsPerPixel) 148 { 149 case 16: mDefaultSDLBPP = 16; break; 150 case 24: mDefaultSDLBPP = 24; break; 151 default: 152 case 32: mDefaultSDLBPP = 32; break; 153 } 154 144 155 /* output what SDL is capable of */ 145 const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo(); 146 Assert(videoInfo); 147 if (videoInfo) 148 { 156 if (mfShowSDLConfig) 149 157 RTPrintf("SDL capabilities:\n" 150 158 " Hardware surface support: %s\n" … … 172 180 videoInfo->vfmt->BitsPerPixel, 173 181 getenv("SDL_VIDEODRIVER")); 174 }175 182 } 176 183 … … 574 581 AssertMsg(mSdlNativeThread == RTThreadNativeSelf(), ("Wrong thread! SDL is not threadsafe!\n")); 575 582 583 int cBitsPerPixel = 32; 584 uint32_t Rmask, Gmask, Bmask, Amask = 0; 585 576 586 /* pixel characteristics, default to fallback 32bpp format */ 577 int bitsPerPixel = 32; 578 Uint32 Rmask = 0x00FF0000; 579 Uint32 Gmask = 0x0000FF00; 580 Uint32 Bmask = 0x000000FF; 581 Uint32 Amask = 0; 582 583 /* a different format we support directly? */ 584 switch (mPixelFormat) 585 { 586 case FramebufferPixelFormat_PixelFormatRGB24: 587 { 588 bitsPerPixel = 24; 589 Rmask = 0x00FF0000; 590 Gmask = 0x0000FF00; 591 Bmask = 0x000000FF; 592 break; 593 } 594 595 case FramebufferPixelFormat_PixelFormatRGB16: 596 { 597 bitsPerPixel = 16; 598 Rmask = 0xF800; 599 Gmask = 0x07E0; 600 Bmask = 0x001F; 601 break; 602 } 587 if (mPixelFormat == FramebufferPixelFormat_PixelFormatRGB16) 588 cBitsPerPixel = 16; 589 else if (mPixelFormat == FramebufferPixelFormat_PixelFormatRGB24) 590 cBitsPerPixel = 24; 591 592 switch (cBitsPerPixel) 593 { 594 case 16: Rmask = 0xF8000000; Gmask = 0x000007E0; Bmask = 0x0000001F; break; 595 default: Rmask = 0x00FF0000; Gmask = 0x0000FF00; Bmask = 0x000000FF; break; 603 596 } 604 597 … … 614 607 { 615 608 /* Create a source surface from guest VRAM. */ 616 mSurfVRAM = SDL_CreateRGBSurfaceFrom(mPtrVRAM, mGuestXRes, mGuestYRes, bitsPerPixel, mLineSize,617 Rmask, Gmask, Bmask, Amask);609 mSurfVRAM = SDL_CreateRGBSurfaceFrom(mPtrVRAM, mGuestXRes, mGuestYRes, cBitsPerPixel, 610 mLineSize, Rmask, Gmask, Bmask, Amask); 618 611 } 619 612 else 620 613 { 621 614 /* Create a software surface for which SDL allocates the RAM */ 622 mSurfVRAM = SDL_CreateRGBSurface(SDL_SWSURFACE, mGuestXRes, mGuestYRes, bitsPerPixel,615 mSurfVRAM = SDL_CreateRGBSurface(SDL_SWSURFACE, mGuestXRes, mGuestYRes, cBitsPerPixel, 623 616 Rmask, Gmask, Bmask, Amask); 624 617 }
Note:
See TracChangeset
for help on using the changeset viewer.