Mercurial > sdl-ios-xcode
comparison src/video/os2fslib/SDL_os2fslib.c @ 2698:e1da92da346c gsoc2008_nds
Clean up.
author | Darren Alton <dalton@stevens.edu> |
---|---|
date | Wed, 27 Aug 2008 04:23:38 +0000 |
parents | c121d94672cb |
children | cf95a2fd3606 |
comparison
equal
deleted
inserted
replaced
2697:c9121b04cffa | 2698:e1da92da346c |
---|---|
438 // Only switch between fullscreen and back if it's not | 438 // Only switch between fullscreen and back if it's not |
439 // a resizable mode! | 439 // a resizable mode! |
440 if ((!pVideo->hidden->pSDLSurface) || | 440 if ((!pVideo->hidden->pSDLSurface) || |
441 ((pVideo->hidden->pSDLSurface) | 441 ((pVideo->hidden->pSDLSurface) |
442 && | 442 && |
443 ((pVideo->hidden->pSDLSurface-> | 443 ((pVideo->hidden-> |
444 flags & SDL_RESIZABLE) == 0))) | 444 pSDLSurface->flags & SDL_RESIZABLE) == 0))) |
445 FSLib_ToggleFSMode(hwnd, !FSLib_QueryFSMode(hwnd)); | 445 FSLib_ToggleFSMode(hwnd, !FSLib_QueryFSMode(hwnd)); |
446 #ifdef DEBUG_BUILD | 446 #ifdef DEBUG_BUILD |
447 else | 447 else |
448 printf(" Resizable mode, so discarding ALT+HOME!\n"); | 448 printf(" Resizable mode, so discarding ALT+HOME!\n"); |
449 fflush(stdout); | 449 fflush(stdout); |
550 } else | 550 } else |
551 #endif | 551 #endif |
552 { | 552 { |
553 | 553 |
554 iXScaleError = | 554 iXScaleError = |
555 (pVideo->hidden->SrcBufferDesc. | 555 (pVideo->hidden->SrcBufferDesc.uiXResolution - |
556 uiXResolution - 1) / swp.cx; | 556 1) / swp.cx; |
557 iYScaleError = | 557 iYScaleError = |
558 (pVideo->hidden->SrcBufferDesc. | 558 (pVideo->hidden->SrcBufferDesc.uiYResolution - |
559 uiYResolution - 1) / swp.cy; | 559 1) / swp.cy; |
560 if (iXScaleError < 0) | 560 if (iXScaleError < 0) |
561 iXScaleError = 0; | 561 iXScaleError = 0; |
562 if (iYScaleError < 0) | 562 if (iYScaleError < 0) |
563 iYScaleError = 0; | 563 iYScaleError = 0; |
564 iXScaleError2 = | 564 iXScaleError2 = |
575 iYScaleError2 = 0; | 575 iYScaleError2 = 0; |
576 | 576 |
577 iTop = | 577 iTop = |
578 (swp.cy - | 578 (swp.cy - |
579 rcl.yTop) * | 579 rcl.yTop) * |
580 pVideo->hidden->SrcBufferDesc. | 580 pVideo->hidden->SrcBufferDesc.uiYResolution / |
581 uiYResolution / swp.cy - iYScaleError; | 581 swp.cy - iYScaleError; |
582 iLeft = | 582 iLeft = |
583 rcl.xLeft * | 583 rcl.xLeft * |
584 pVideo->hidden->SrcBufferDesc. | 584 pVideo->hidden->SrcBufferDesc.uiXResolution / |
585 uiXResolution / swp.cx - iXScaleError; | 585 swp.cx - iXScaleError; |
586 iWidth = | 586 iWidth = |
587 ((rcl.xRight - | 587 ((rcl.xRight - |
588 rcl.xLeft) * | 588 rcl.xLeft) * |
589 pVideo->hidden->SrcBufferDesc. | 589 pVideo->hidden->SrcBufferDesc.uiXResolution + |
590 uiXResolution + swp.cx - 1) / swp.cx + | 590 swp.cx - 1) / swp.cx + 2 * iXScaleError; |
591 2 * iXScaleError; | |
592 iHeight = | 591 iHeight = |
593 ((rcl.yTop - | 592 ((rcl.yTop - |
594 rcl.yBottom) * | 593 rcl.yBottom) * |
595 pVideo->hidden->SrcBufferDesc. | 594 pVideo->hidden->SrcBufferDesc.uiYResolution + |
596 uiYResolution + swp.cy - 1) / swp.cy + | 595 swp.cy - 1) / swp.cy + 2 * iYScaleError; |
597 2 * iYScaleError; | |
598 | 596 |
599 iWidth += iXScaleError2; | 597 iWidth += iXScaleError2; |
600 iHeight += iYScaleError2; | 598 iHeight += iYScaleError2; |
601 | 599 |
602 if (iTop < 0) | 600 if (iTop < 0) |
604 if (iLeft < 0) | 602 if (iLeft < 0) |
605 iLeft = 0; | 603 iLeft = 0; |
606 if (iTop + iHeight > | 604 if (iTop + iHeight > |
607 pVideo->hidden->SrcBufferDesc.uiYResolution) | 605 pVideo->hidden->SrcBufferDesc.uiYResolution) |
608 iHeight = | 606 iHeight = |
609 pVideo->hidden->SrcBufferDesc. | 607 pVideo->hidden->SrcBufferDesc.uiYResolution - |
610 uiYResolution - iTop; | 608 iTop; |
611 if (iLeft + iWidth > | 609 if (iLeft + iWidth > |
612 pVideo->hidden->SrcBufferDesc.uiXResolution) | 610 pVideo->hidden->SrcBufferDesc.uiXResolution) |
613 iWidth = | 611 iWidth = |
614 pVideo->hidden->SrcBufferDesc. | 612 pVideo->hidden->SrcBufferDesc.uiXResolution - |
615 uiXResolution - iLeft; | 613 iLeft; |
616 | 614 |
617 #ifdef DEBUG_BUILD | 615 #ifdef DEBUG_BUILD |
618 printf | 616 printf |
619 ("WM_PAINT : BitBlt: %d %d -> %d %d (Buf %d x %d)\n", | 617 ("WM_PAINT : BitBlt: %d %d -> %d %d (Buf %d x %d)\n", |
620 iTop, iLeft, iWidth, iHeight, | 618 iTop, iLeft, iWidth, iHeight, |
621 pVideo->hidden->SrcBufferDesc. | 619 pVideo->hidden->SrcBufferDesc.uiXResolution, |
622 uiXResolution, | |
623 pVideo->hidden->SrcBufferDesc.uiYResolution); | 620 pVideo->hidden->SrcBufferDesc.uiYResolution); |
624 fflush(stdout); | 621 fflush(stdout); |
625 #endif | 622 #endif |
626 | 623 |
627 FSLIB_BITBLT(hwnd, | 624 FSLIB_BITBLT(hwnd, |
691 // the window is resizable and the source buffer size is the | 688 // the window is resizable and the source buffer size is the |
692 // same as the destination buffer size! | 689 // same as the destination buffer size! |
693 WinQueryWindowPos(hwnd, &swp); | 690 WinQueryWindowPos(hwnd, &swp); |
694 if ((!pVideo->hidden->pSDLSurface) || | 691 if ((!pVideo->hidden->pSDLSurface) || |
695 ((pVideo->hidden->pSDLSurface) && | 692 ((pVideo->hidden->pSDLSurface) && |
696 (pVideo->hidden->pSDLSurface-> | 693 (pVideo->hidden-> |
697 flags & SDL_RESIZABLE) | 694 pSDLSurface->flags & SDL_RESIZABLE) |
698 && | 695 && |
699 ((swp.cx != | 696 ((swp.cx != |
700 pVideo->hidden->SrcBufferDesc. | 697 pVideo->hidden-> |
701 uiXResolution) | 698 SrcBufferDesc.uiXResolution) |
702 || (swp.cy != | 699 || (swp.cy != |
703 pVideo->hidden-> | 700 pVideo->hidden->SrcBufferDesc. |
704 SrcBufferDesc.uiYResolution)) | 701 uiYResolution)) |
705 && (!FSLib_QueryFSMode(hwnd)))) { | 702 && (!FSLib_QueryFSMode(hwnd)))) { |
706 // Resizable surface and in resizing! | 703 // Resizable surface and in resizing! |
707 // So, don't blit now! | 704 // So, don't blit now! |
708 #ifdef DEBUG_BUILD | 705 #ifdef DEBUG_BUILD |
709 printf | 706 printf |
716 #ifdef DEBUG_BUILD | 713 #ifdef DEBUG_BUILD |
717 printf("WM_FSLIBNOTIFICATION : Blitting!\n"); | 714 printf("WM_FSLIBNOTIFICATION : Blitting!\n"); |
718 fflush(stdout); | 715 fflush(stdout); |
719 #endif | 716 #endif |
720 FSLIB_BITBLT(hwnd, | 717 FSLIB_BITBLT(hwnd, |
721 pVideo->hidden-> | 718 pVideo->hidden->pchSrcBuffer, 0, |
722 pchSrcBuffer, 0, | |
723 0, | 719 0, |
724 pVideo->hidden-> | 720 pVideo->hidden-> |
725 SrcBufferDesc. | 721 SrcBufferDesc.uiXResolution, |
726 uiXResolution, | 722 pVideo->hidden->SrcBufferDesc. |
727 pVideo->hidden-> | 723 uiYResolution); |
728 SrcBufferDesc.uiYResolution); | |
729 } | 724 } |
730 } | 725 } |
731 #ifdef DEBUG_BUILD | 726 #ifdef DEBUG_BUILD |
732 else | 727 else |
733 printf | 728 printf |
771 // Center the mouse to the middle of the window! | 766 // Center the mouse to the middle of the window! |
772 WinQueryWindowPos(pVideo->hidden->hwndClient, | 767 WinQueryWindowPos(pVideo->hidden->hwndClient, |
773 &swpClient); | 768 &swpClient); |
774 ptl.x = 0; | 769 ptl.x = 0; |
775 ptl.y = 0; | 770 ptl.y = 0; |
776 WinMapWindowPoints(pVideo->hidden-> | 771 WinMapWindowPoints(pVideo->hidden->hwndClient, |
777 hwndClient, HWND_DESKTOP, &ptl, 1); | 772 HWND_DESKTOP, &ptl, 1); |
778 pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ | 773 pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ |
779 WinSetPointerPos(HWND_DESKTOP, | 774 WinSetPointerPos(HWND_DESKTOP, |
780 ptl.x + swpClient.cx / 2, | 775 ptl.x + swpClient.cx / 2, |
781 ptl.y + swpClient.cy / 2); | 776 ptl.y + swpClient.cy / 2); |
782 } | 777 } |
823 // Center the mouse to the middle of the window! | 818 // Center the mouse to the middle of the window! |
824 WinQueryWindowPos(pVideo->hidden->hwndClient, | 819 WinQueryWindowPos(pVideo->hidden->hwndClient, |
825 &swpClient); | 820 &swpClient); |
826 ptl.x = 0; | 821 ptl.x = 0; |
827 ptl.y = 0; | 822 ptl.y = 0; |
828 WinMapWindowPoints(pVideo->hidden-> | 823 WinMapWindowPoints(pVideo->hidden->hwndClient, |
829 hwndClient, HWND_DESKTOP, &ptl, 1); | 824 HWND_DESKTOP, &ptl, 1); |
830 pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ | 825 pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ |
831 WinSetPointerPos(HWND_DESKTOP, | 826 WinSetPointerPos(HWND_DESKTOP, |
832 ptl.x + swpClient.cx / 2, | 827 ptl.x + swpClient.cx / 2, |
833 ptl.y + swpClient.cy / 2); | 828 ptl.y + swpClient.cy / 2); |
834 } | 829 } |
865 // Center the mouse to the middle of the window! | 860 // Center the mouse to the middle of the window! |
866 WinQueryWindowPos(pVideo->hidden->hwndClient, | 861 WinQueryWindowPos(pVideo->hidden->hwndClient, |
867 &swpClient); | 862 &swpClient); |
868 ptl.x = 0; | 863 ptl.x = 0; |
869 ptl.y = 0; | 864 ptl.y = 0; |
870 WinMapWindowPoints(pVideo->hidden-> | 865 WinMapWindowPoints(pVideo->hidden->hwndClient, |
871 hwndClient, HWND_DESKTOP, &ptl, 1); | 866 HWND_DESKTOP, &ptl, 1); |
872 pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ | 867 pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ |
873 WinSetPointerPos(HWND_DESKTOP, | 868 WinSetPointerPos(HWND_DESKTOP, |
874 ptl.x + swpClient.cx / 2, | 869 ptl.x + swpClient.cx / 2, |
875 ptl.y + swpClient.cy / 2); | 870 ptl.y + swpClient.cy / 2); |
876 } | 871 } |
908 // Center the mouse to the middle of the window! | 903 // Center the mouse to the middle of the window! |
909 WinQueryWindowPos(pVideo->hidden->hwndClient, | 904 WinQueryWindowPos(pVideo->hidden->hwndClient, |
910 &swpClient); | 905 &swpClient); |
911 ptl.x = 0; | 906 ptl.x = 0; |
912 ptl.y = 0; | 907 ptl.y = 0; |
913 WinMapWindowPoints(pVideo->hidden-> | 908 WinMapWindowPoints(pVideo->hidden->hwndClient, |
914 hwndClient, HWND_DESKTOP, &ptl, 1); | 909 HWND_DESKTOP, &ptl, 1); |
915 pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ | 910 pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ |
916 WinSetPointerPos(HWND_DESKTOP, | 911 WinSetPointerPos(HWND_DESKTOP, |
917 ptl.x + swpClient.cx / 2, | 912 ptl.x + swpClient.cx / 2, |
918 ptl.y + swpClient.cy / 2); | 913 ptl.y + swpClient.cy / 2); |
919 } | 914 } |
1376 memnot(Uint8 * dst, Uint8 * src, int len) | 1371 memnot(Uint8 * dst, Uint8 * src, int len) |
1377 { | 1372 { |
1378 while (len-- > 0) | 1373 while (len-- > 0) |
1379 *dst++ = ~*src++; | 1374 *dst++ = ~*src++; |
1380 } | 1375 } |
1376 | |
1381 static void | 1377 static void |
1382 memxor(Uint8 * dst, Uint8 * src1, Uint8 * src2, int len) | 1378 memxor(Uint8 * dst, Uint8 * src1, Uint8 * src2, int len) |
1383 { | 1379 { |
1384 while (len-- > 0) | 1380 while (len-- > 0) |
1385 *dst++ = (*src1++) ^ (*src2++); | 1381 *dst++ = (*src1++) ^ (*src2++); |
1633 static int | 1629 static int |
1634 os2fslib_AllocHWSurface(_THIS, SDL_Surface * surface) | 1630 os2fslib_AllocHWSurface(_THIS, SDL_Surface * surface) |
1635 { | 1631 { |
1636 return (-1); | 1632 return (-1); |
1637 } | 1633 } |
1634 | |
1638 static void | 1635 static void |
1639 os2fslib_FreeHWSurface(_THIS, SDL_Surface * surface) | 1636 os2fslib_FreeHWSurface(_THIS, SDL_Surface * surface) |
1640 { | 1637 { |
1641 return; | 1638 return; |
1642 } | 1639 } |
2503 | 2500 |
2504 // Create new software surface! | 2501 // Create new software surface! |
2505 pResult = SDL_CreateRGBSurface(SDL_SWSURFACE, | 2502 pResult = SDL_CreateRGBSurface(SDL_SWSURFACE, |
2506 pModeInfoFound->uiXResolution, | 2503 pModeInfoFound->uiXResolution, |
2507 pModeInfoFound->uiYResolution, | 2504 pModeInfoFound->uiYResolution, |
2508 pModeInfoFound->uiBPP, | 2505 pModeInfoFound->uiBPP, ((unsigned int) |
2509 ((unsigned int) pModeInfoFound-> | 2506 pModeInfoFound->PixelFormat.ucRedMask) |
2510 PixelFormat. | 2507 << pModeInfoFound->PixelFormat. |
2511 ucRedMask) << pModeInfoFound-> | 2508 ucRedPosition, ((unsigned int) |
2512 PixelFormat.ucRedPosition, | 2509 pModeInfoFound-> |
2513 ((unsigned int) pModeInfoFound-> | 2510 PixelFormat.ucGreenMask) |
2514 PixelFormat. | 2511 << pModeInfoFound->PixelFormat. |
2515 ucGreenMask) << pModeInfoFound-> | 2512 ucGreenPosition, ((unsigned int) |
2516 PixelFormat.ucGreenPosition, | 2513 pModeInfoFound-> |
2517 ((unsigned int) pModeInfoFound-> | 2514 PixelFormat.ucBlueMask) |
2518 PixelFormat. | 2515 << pModeInfoFound->PixelFormat. |
2519 ucBlueMask) << pModeInfoFound-> | 2516 ucBluePosition, ((unsigned int) |
2520 PixelFormat.ucBluePosition, | 2517 pModeInfoFound-> |
2521 ((unsigned int) pModeInfoFound-> | 2518 PixelFormat.ucAlphaMask) |
2522 PixelFormat. | 2519 << pModeInfoFound->PixelFormat. |
2523 ucAlphaMask) << pModeInfoFound-> | 2520 ucAlphaPosition); |
2524 PixelFormat.ucAlphaPosition); | |
2525 | 2521 |
2526 if (pResult == NULL) { | 2522 if (pResult == NULL) { |
2527 DosReleaseMutexSem(_this->hidden->hmtxUseSrcBuffer); | 2523 DosReleaseMutexSem(_this->hidden->hmtxUseSrcBuffer); |
2528 SDL_OutOfMemory(); | 2524 SDL_OutOfMemory(); |
2529 return NULL; | 2525 return NULL; |
2533 fflush(stdout); | 2529 fflush(stdout); |
2534 #endif | 2530 #endif |
2535 | 2531 |
2536 // Adjust pixel format mask! | 2532 // Adjust pixel format mask! |
2537 pResult->format->Rmask = | 2533 pResult->format->Rmask = |
2538 ((unsigned int) pModeInfoFound->PixelFormat. | 2534 ((unsigned int) pModeInfoFound-> |
2539 ucRedMask) << pModeInfoFound->PixelFormat.ucRedPosition; | 2535 PixelFormat.ucRedMask) << pModeInfoFound->PixelFormat. |
2536 ucRedPosition; | |
2540 pResult->format->Rshift = pModeInfoFound->PixelFormat.ucRedPosition; | 2537 pResult->format->Rshift = pModeInfoFound->PixelFormat.ucRedPosition; |
2541 pResult->format->Rloss = pModeInfoFound->PixelFormat.ucRedAdjust; | 2538 pResult->format->Rloss = pModeInfoFound->PixelFormat.ucRedAdjust; |
2542 pResult->format->Gmask = | 2539 pResult->format->Gmask = |
2543 ((unsigned int) pModeInfoFound->PixelFormat. | 2540 ((unsigned int) pModeInfoFound-> |
2544 ucGreenMask) << pModeInfoFound->PixelFormat.ucGreenPosition; | 2541 PixelFormat.ucGreenMask) << pModeInfoFound->PixelFormat. |
2542 ucGreenPosition; | |
2545 pResult->format->Gshift = pModeInfoFound->PixelFormat.ucGreenPosition; | 2543 pResult->format->Gshift = pModeInfoFound->PixelFormat.ucGreenPosition; |
2546 pResult->format->Gloss = pModeInfoFound->PixelFormat.ucGreenAdjust; | 2544 pResult->format->Gloss = pModeInfoFound->PixelFormat.ucGreenAdjust; |
2547 pResult->format->Bmask = | 2545 pResult->format->Bmask = |
2548 ((unsigned int) pModeInfoFound->PixelFormat. | 2546 ((unsigned int) pModeInfoFound-> |
2549 ucBlueMask) << pModeInfoFound->PixelFormat.ucBluePosition; | 2547 PixelFormat.ucBlueMask) << pModeInfoFound->PixelFormat. |
2548 ucBluePosition; | |
2550 pResult->format->Bshift = pModeInfoFound->PixelFormat.ucBluePosition; | 2549 pResult->format->Bshift = pModeInfoFound->PixelFormat.ucBluePosition; |
2551 pResult->format->Bloss = pModeInfoFound->PixelFormat.ucBlueAdjust; | 2550 pResult->format->Bloss = pModeInfoFound->PixelFormat.ucBlueAdjust; |
2552 pResult->format->Amask = | 2551 pResult->format->Amask = |
2553 ((unsigned int) pModeInfoFound->PixelFormat. | 2552 ((unsigned int) pModeInfoFound-> |
2554 ucAlphaMask) << pModeInfoFound->PixelFormat.ucAlphaPosition; | 2553 PixelFormat.ucAlphaMask) << pModeInfoFound->PixelFormat. |
2554 ucAlphaPosition; | |
2555 pResult->format->Ashift = pModeInfoFound->PixelFormat.ucAlphaPosition; | 2555 pResult->format->Ashift = pModeInfoFound->PixelFormat.ucAlphaPosition; |
2556 pResult->format->Aloss = pModeInfoFound->PixelFormat.ucAlphaAdjust; | 2556 pResult->format->Aloss = pModeInfoFound->PixelFormat.ucAlphaAdjust; |
2557 | 2557 |
2558 #ifdef REPORT_EMPTY_ALPHA_MASK | 2558 #ifdef REPORT_EMPTY_ALPHA_MASK |
2559 pResult->format->Amask = | 2559 pResult->format->Amask = |
2736 iPlace = -1; | 2736 iPlace = -1; |
2737 iNumOfSlots = 1; // Count the last NULL too! | 2737 iNumOfSlots = 1; // Count the last NULL too! |
2738 for (i = 0; _this->hidden->pListModesResult[i]; i++) { | 2738 for (i = 0; _this->hidden->pListModesResult[i]; i++) { |
2739 iNumOfSlots++; | 2739 iNumOfSlots++; |
2740 if (iPlace == -1) { | 2740 if (iPlace == -1) { |
2741 if ((_this->hidden-> | 2741 if ((_this->hidden->pListModesResult[i]->w * |
2742 pListModesResult[i]->w * | 2742 _this->hidden->pListModesResult[i]->h) < |
2743 _this->hidden-> | |
2744 pListModesResult[i]->h) < | |
2745 (pRect->w * pRect->h)) { | 2743 (pRect->w * pRect->h)) { |
2746 iPlace = i; | 2744 iPlace = i; |
2747 } | 2745 } |
2748 } | 2746 } |
2749 } | 2747 } |
2752 | 2750 |
2753 #ifdef DEBUG_BUILD | 2751 #ifdef DEBUG_BUILD |
2754 // printf("!!! From %d slots, it will be at %d\n", iNumOfSlots, iPlace); | 2752 // printf("!!! From %d slots, it will be at %d\n", iNumOfSlots, iPlace); |
2755 #endif | 2753 #endif |
2756 | 2754 |
2757 pNewList = | 2755 pNewList = (SDL_Rect **) |
2758 (SDL_Rect **) SDL_realloc(_this-> | 2756 SDL_realloc(_this->hidden->pListModesResult, |
2759 hidden-> | 2757 (iNumOfSlots + |
2760 pListModesResult, | 2758 1) * sizeof(SDL_Rect *)); |
2761 (iNumOfSlots | |
2762 + | |
2763 1) * | |
2764 sizeof(SDL_Rect *)); | |
2765 if (pNewList) { | 2759 if (pNewList) { |
2766 for (i = iNumOfSlots; i > iPlace; i--) | 2760 for (i = iNumOfSlots; i > iPlace; i--) |
2767 pNewList[i] = pNewList[i - 1]; | 2761 pNewList[i] = pNewList[i - 1]; |
2768 pNewList[iPlace] = pRect; | 2762 pNewList[iPlace] = pRect; |
2769 _this->hidden->pListModesResult = pNewList; | 2763 _this->hidden->pListModesResult = pNewList; |
2814 /* Determine the screen depth */ | 2808 /* Determine the screen depth */ |
2815 vformat->BitsPerPixel = pDesktopMode->uiBPP; | 2809 vformat->BitsPerPixel = pDesktopMode->uiBPP; |
2816 vformat->BytesPerPixel = (vformat->BitsPerPixel + 7) / 8; | 2810 vformat->BytesPerPixel = (vformat->BitsPerPixel + 7) / 8; |
2817 | 2811 |
2818 vformat->Rmask = | 2812 vformat->Rmask = |
2819 ((unsigned int) pDesktopMode->PixelFormat.ucRedMask) << pDesktopMode-> | 2813 ((unsigned int) pDesktopMode->PixelFormat. |
2820 PixelFormat.ucRedPosition; | 2814 ucRedMask) << pDesktopMode->PixelFormat.ucRedPosition; |
2821 vformat->Rshift = pDesktopMode->PixelFormat.ucRedPosition; | 2815 vformat->Rshift = pDesktopMode->PixelFormat.ucRedPosition; |
2822 vformat->Rloss = pDesktopMode->PixelFormat.ucRedAdjust; | 2816 vformat->Rloss = pDesktopMode->PixelFormat.ucRedAdjust; |
2823 vformat->Gmask = | 2817 vformat->Gmask = |
2824 ((unsigned int) pDesktopMode->PixelFormat. | 2818 ((unsigned int) pDesktopMode-> |
2825 ucGreenMask) << pDesktopMode->PixelFormat.ucGreenPosition; | 2819 PixelFormat.ucGreenMask) << pDesktopMode->PixelFormat. |
2820 ucGreenPosition; | |
2826 vformat->Gshift = pDesktopMode->PixelFormat.ucGreenPosition; | 2821 vformat->Gshift = pDesktopMode->PixelFormat.ucGreenPosition; |
2827 vformat->Gloss = pDesktopMode->PixelFormat.ucGreenAdjust; | 2822 vformat->Gloss = pDesktopMode->PixelFormat.ucGreenAdjust; |
2828 vformat->Bmask = | 2823 vformat->Bmask = |
2829 ((unsigned int) pDesktopMode->PixelFormat. | 2824 ((unsigned int) pDesktopMode-> |
2830 ucBlueMask) << pDesktopMode->PixelFormat.ucBluePosition; | 2825 PixelFormat.ucBlueMask) << pDesktopMode->PixelFormat.ucBluePosition; |
2831 vformat->Bshift = pDesktopMode->PixelFormat.ucBluePosition; | 2826 vformat->Bshift = pDesktopMode->PixelFormat.ucBluePosition; |
2832 vformat->Bloss = pDesktopMode->PixelFormat.ucBlueAdjust; | 2827 vformat->Bloss = pDesktopMode->PixelFormat.ucBlueAdjust; |
2833 vformat->Amask = | 2828 vformat->Amask = |
2834 ((unsigned int) pDesktopMode->PixelFormat. | 2829 ((unsigned int) pDesktopMode-> |
2835 ucAlphaMask) << pDesktopMode->PixelFormat.ucAlphaPosition; | 2830 PixelFormat.ucAlphaMask) << pDesktopMode->PixelFormat. |
2831 ucAlphaPosition; | |
2836 vformat->Ashift = pDesktopMode->PixelFormat.ucAlphaPosition; | 2832 vformat->Ashift = pDesktopMode->PixelFormat.ucAlphaPosition; |
2837 vformat->Aloss = pDesktopMode->PixelFormat.ucAlphaAdjust; | 2833 vformat->Aloss = pDesktopMode->PixelFormat.ucAlphaAdjust; |
2838 | 2834 |
2839 #ifdef REPORT_EMPTY_ALPHA_MASK | 2835 #ifdef REPORT_EMPTY_ALPHA_MASK |
2840 vformat->Amask = vformat->Ashift = vformat->Aloss = 0; | 2836 vformat->Amask = vformat->Ashift = vformat->Aloss = 0; |
2935 SDL_memcpy(&(_this->hidden->SrcBufferDesc), | 2931 SDL_memcpy(&(_this->hidden->SrcBufferDesc), |
2936 _this->hidden->pAvailableFSLibVideoModes, | 2932 _this->hidden->pAvailableFSLibVideoModes, |
2937 sizeof(_this->hidden->SrcBufferDesc)); | 2933 sizeof(_this->hidden->SrcBufferDesc)); |
2938 // Allocate new video buffer! | 2934 // Allocate new video buffer! |
2939 _this->hidden->pchSrcBuffer = | 2935 _this->hidden->pchSrcBuffer = |
2940 (char *) SDL_malloc(_this->hidden->pAvailableFSLibVideoModes-> | 2936 (char *) SDL_malloc(_this->hidden-> |
2941 uiScanLineSize * | 2937 pAvailableFSLibVideoModes->uiScanLineSize * |
2942 _this->hidden->pAvailableFSLibVideoModes-> | 2938 _this->hidden-> |
2943 uiYResolution); | 2939 pAvailableFSLibVideoModes->uiYResolution); |
2944 if (!_this->hidden->pchSrcBuffer) { | 2940 if (!_this->hidden->pchSrcBuffer) { |
2945 #ifdef DEBUG_BUILD | 2941 #ifdef DEBUG_BUILD |
2946 printf | 2942 printf |
2947 ("[os2fslib_VideoInit] : Yikes, not enough memory for new video buffer!\n"); | 2943 ("[os2fslib_VideoInit] : Yikes, not enough memory for new video buffer!\n"); |
2948 fflush(stdout); | 2944 fflush(stdout); |