Mercurial > sdl-ios-xcode
changeset 4286:9ea4413f0a9e SDL-1.2
Fixed bug #831
Andrey 2009-10-09 08:08:04 PDT
gapi_hires_fix
I made a mistake with the conclusions.
And last time I as was mistaken with conclusions.
Now I thought about in more detail the algorithm works.
I have made it that the project fheroes2 well worked.
The result of my work in attachment.
I have a possibility to check up it on different models pocketpc.
I checked various modes screen of 320x320, 320x240, 640x480, 800x400.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 10 Oct 2009 02:03:53 +0000 |
parents | f63ca354c35e |
children | 0620847bf1a8 |
files | src/video/gapi/SDL_gapivideo.c src/video/gapi/SDL_gapivideo.h src/video/windib/SDL_dibevents.c |
diffstat | 3 files changed, 35 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/gapi/SDL_gapivideo.c Thu Oct 08 09:02:03 2009 +0000 +++ b/src/video/gapi/SDL_gapivideo.c Sat Oct 10 02:03:53 2009 +0000 @@ -622,7 +622,6 @@ Uint32 Rmask, Gmask, Bmask; DWORD style; SDL_Rect allScreen; - SDL_ScreenOrientation systemOrientation; if( bpp < 4 ) { @@ -674,7 +673,7 @@ } gapi->userOrientation = SDL_ORIENTATION_UP; - systemOrientation = SDL_ORIENTATION_UP; + gapi->systemOrientation = SDL_ORIENTATION_UP; video->flags = SDL_FULLSCREEN; /* Clear flags, GAPI supports fullscreen only */ /* GAPI or VGA? */ @@ -697,18 +696,15 @@ gapi->userOrientation = SDL_ORIENTATION_RIGHT; if(GetSystemMetrics(SM_CYSCREEN) < GetSystemMetrics(SM_CXSCREEN)) - systemOrientation = SDL_ORIENTATION_RIGHT; + gapi->systemOrientation = SDL_ORIENTATION_RIGHT; - /* shall we apply hires fix? for example when we do not use hires resource */ gapi->hiresFix = 0; - if( systemOrientation == gapi->userOrientation ) + + /* check hires */ + if(GetSystemMetrics(SM_CXSCREEN) < width && GetSystemMetrics(SM_CYSCREEN) < height) { - if( (width > GetSystemMetrics(SM_CXSCREEN)) || (height > GetSystemMetrics(SM_CYSCREEN))) - gapi->hiresFix = 1; - } else - if( (width > GetSystemMetrics(SM_CYSCREEN)) || (height > GetSystemMetrics(SM_CXSCREEN))) -// if( !((width == gapi->gxProperties.cyHeight) && (height == gapi->gxProperties.cxWidth))) // user portrait, device landscape - gapi->hiresFix = 1; + gapi->hiresFix = 1; + } switch( gapi->userOrientation ) { @@ -783,7 +779,6 @@ printf("system display width (orig): %d\n", GetSystemMetrics(SM_CXSCREEN)); printf("system display height (orig): %d\n", GetSystemMetrics(SM_CYSCREEN)); #endif - gapi->hiresFix = (width > GetSystemMetrics(SM_CXSCREEN)) || (height > GetSystemMetrics(SM_CYSCREEN)); gapi->alreadyGXOpened = 1; if( !gapi->gxFunc.GXOpenDisplay(SDL_Window, GX_FULLSCREEN) ) { @@ -793,7 +788,7 @@ } if(gapi->useVga) - gapi->coordinateTransform = (4 - systemOrientation + gapi->userOrientation) % 4; + gapi->coordinateTransform = (4 - gapi->systemOrientation + gapi->userOrientation) % 4; else gapi->coordinateTransform = gapi->userOrientation; @@ -808,7 +803,7 @@ printf("y pitch: %d\n", gapi->gxProperties.cbyPitch); printf("gapi flags: 0x%x\n", gapi->gxProperties.ffFormat); printf("user orientation: %d\n", gapi->userOrientation); - printf("system orientation: %d\n", systemOrientation); + printf("system orientation: %d\n", gapi->systemOrientation); printf("gapi orientation: %d\n", gapi->gapiOrientation);
--- a/src/video/gapi/SDL_gapivideo.h Thu Oct 08 09:02:03 2009 +0000 +++ b/src/video/gapi/SDL_gapivideo.h Sat Oct 10 02:03:53 2009 +0000 @@ -131,6 +131,7 @@ // The orientation of the video mode user wants to get // Probably restricted to UP and RIGHT SDL_ScreenOrientation userOrientation; + SDL_ScreenOrientation systemOrientation; // -------------- int useGXOpenDisplay; /* use GXOpenDispplay */ int alreadyGXOpened;
--- a/src/video/windib/SDL_dibevents.c Thu Oct 08 09:02:03 2009 +0000 +++ b/src/video/windib/SDL_dibevents.c Sat Oct 10 02:03:53 2009 +0000 @@ -88,41 +88,41 @@ return key; } -static void GapiTransform(GapiInfo *gapiInfo, LONG *x, LONG *y) { - Sint16 rotatedX; - Sint16 rotatedY; - +static void GapiTransform(GapiInfo *gapiInfo, LONG *x, LONG *y) +{ if(gapiInfo->hiresFix) { *x *= 2; *y *= 2; } - if(gapiInfo->userOrientation == SDL_ORIENTATION_UP && - gapiInfo->gapiOrientation == SDL_ORIENTATION_RIGHT) + // 0 3 0 + if((!gapiInfo->userOrientation && gapiInfo->systemOrientation && !gapiInfo->gapiOrientation) || + // 3 0 3 + (gapiInfo->userOrientation && !gapiInfo->systemOrientation && gapiInfo->gapiOrientation) || + // 3 0 0 + (gapiInfo->userOrientation && !gapiInfo->systemOrientation && !gapiInfo->gapiOrientation)) { - rotatedX = *x; - rotatedY = *y; - *x = rotatedX; - *y = rotatedY; - } - else - if(gapiInfo->userOrientation == SDL_ORIENTATION_RIGHT && - gapiInfo->gapiOrientation == SDL_ORIENTATION_RIGHT) - { - rotatedX = (2 * ((SDL_VideoSurface->offset%SDL_VideoSurface->pitch)/ - SDL_VideoSurface->format->BytesPerPixel)) - + SDL_VideoSurface->w - *y; - rotatedY = *x; - *x = rotatedX; - *y = rotatedY; + Sint16 temp = *x; + *x = SDL_VideoSurface->w - *y; + *y = temp; } else + // 0 0 0 + if((!gapiInfo->userOrientation && !gapiInfo->systemOrientation && !gapiInfo->gapiOrientation) || + // 0 0 3 + (!gapiInfo->userOrientation && !gapiInfo->systemOrientation && gapiInfo->gapiOrientation)) { - rotatedX = SDL_VideoSurface->w - *y; - rotatedY = *x; - *y = rotatedY; - *x = rotatedX; + // without changes + // *x = *x; + // *y = *y; + } + // default + else + { + // without changes + // *x = *x; + // *y = *y; } } #endif