Fixed colorkey and alpha in HW mode when restoring from background - patch by SLVN

This commit is contained in:
pelya
2012-09-28 17:10:20 +03:00
parent fef867ebcb
commit cf816631a2
3 changed files with 27 additions and 8 deletions

View File

@@ -23,7 +23,7 @@ ForceRelativeMouseMode=n
AppNeedsArrowKeys=n AppNeedsArrowKeys=n
AppNeedsTextInput=n AppNeedsTextInput=n
AppUsesJoystick=n AppUsesJoystick=n
AppHandlesJoystickSensitivity=n AppUsesAccelerometer=n
AppUsesMultitouch=n AppUsesMultitouch=n
NonBlockingSwapBuffers=n NonBlockingSwapBuffers=n
RedefinedKeys="LCTRL T NO_REMAP NO_REMAP H" RedefinedKeys="LCTRL T NO_REMAP NO_REMAP H"
@@ -34,14 +34,18 @@ StartupMenuButtonTimeout=3000
HiddenMenuOptions='' HiddenMenuOptions=''
FirstStartMenuOptions='' FirstStartMenuOptions=''
MultiABI=n MultiABI=n
AppVersionCode=286220 AppVersionCode=288220
AppVersionName="2862.20" AppVersionName="2882.20"
ResetSdlConfigForThisVersion=n ResetSdlConfigForThisVersion=n
DeleteFilesOnUpgrade="libsdl-DownloadFinished-5.flag libsdl-DownloadFinished-6.flag libsdl-DownloadFinished-7.flag libsdl-DownloadFinished-8.flag libsdl-DownloadFinished-9.flag libsdl-DownloadFinished-10.flag libsdl-DownloadFinished-11.flag libsdl-DownloadFinished-12.flag libsdl-DownloadFinished-13.flag libsdl-DownloadFinished-14.flag" DeleteFilesOnUpgrade="libsdl-DownloadFinished-5.flag libsdl-DownloadFinished-6.flag libsdl-DownloadFinished-7.flag libsdl-DownloadFinished-8.flag libsdl-DownloadFinished-9.flag libsdl-DownloadFinished-10.flag libsdl-DownloadFinished-11.flag libsdl-DownloadFinished-12.flag libsdl-DownloadFinished-13.flag libsdl-DownloadFinished-14.flag"
CompiledLibraries="sdl_net sdl_mixer sdl_image sdl_ttf png intl" CompiledLibraries="sdl_net sdl_mixer sdl_image sdl_ttf png intl"
CustomBuildScript=n CustomBuildScript=n
AppCflags='-finline-functions -O2 -DWITH_ZLIB -DWITH_MIXER -DWITH_XML -DWITH_IMAGE -DWITH_TTF -DWITH_AI=simple -DWITH_DEBUG -DWITH_EDITOR' AppCflags='-finline-functions -O2 -DWITH_ZLIB -DWITH_MIXER -DWITH_XML -DWITH_IMAGE -DWITH_TTF -DWITH_AI=simple -DWITH_DEBUG -DWITH_EDITOR -frtti'
AppLdflags='' AppLdflags=''
AppSubdirsBuild='fheroes2/src/engine fheroes2/src/xmlccwrap fheroes2/src/fheroes2/agg fheroes2/src/fheroes2/ai fheroes2/src/fheroes2/ai/simple fheroes2/src/fheroes2/army fheroes2/src/fheroes2/battle fheroes2/src/fheroes2/castle fheroes2/src/fheroes2/dialog fheroes2/src/fheroes2/editor fheroes2/src/fheroes2/game fheroes2/src/fheroes2/gui fheroes2/src/fheroes2/heroes fheroes2/src/fheroes2/image fheroes2/src/fheroes2/kingdom fheroes2/src/fheroes2/maps fheroes2/src/fheroes2/monster fheroes2/src/fheroes2/objects fheroes2/src/fheroes2/pocketpc fheroes2/src/fheroes2/resource fheroes2/src/fheroes2/spell fheroes2/src/fheroes2/system fheroes2/src/fheroes2/test' AppSubdirsBuild='fheroes2/src/engine fheroes2/src/xmlccwrap fheroes2/src/fheroes2/agg fheroes2/src/fheroes2/ai fheroes2/src/fheroes2/ai/simple fheroes2/src/fheroes2/army fheroes2/src/fheroes2/battle fheroes2/src/fheroes2/castle fheroes2/src/fheroes2/dialog fheroes2/src/fheroes2/editor fheroes2/src/fheroes2/game fheroes2/src/fheroes2/gui fheroes2/src/fheroes2/heroes fheroes2/src/fheroes2/image fheroes2/src/fheroes2/kingdom fheroes2/src/fheroes2/maps fheroes2/src/fheroes2/monster fheroes2/src/fheroes2/objects fheroes2/src/fheroes2/pocketpc fheroes2/src/fheroes2/resource fheroes2/src/fheroes2/spell fheroes2/src/fheroes2/system fheroes2/src/fheroes2/test'
AppCmdline='fheroes2' AppCmdline='fheroes2'
ReadmeText='^You may press "Home" now - the data will be downloaded in background' ReadmeText='^You may press "Home" now - the data will be downloaded in background'
MinimumScreenSize=s
AdmobPublisherId=n
AdmobTestDeviceId=
AdmobBannerSize=

View File

@@ -16,14 +16,14 @@ SdlVideoResizeKeepAspect=n
CompatibilityHacks=n CompatibilityHacks=n
CompatibilityHacksStaticInit=n CompatibilityHacksStaticInit=n
CompatibilityHacksTextInputEmulatesHwKeyboard=n CompatibilityHacksTextInputEmulatesHwKeyboard=n
AppUsesMouse=y AppUsesMouse=n
AppNeedsTwoButtonMouse=n AppNeedsTwoButtonMouse=n
ShowMouseCursor=n ShowMouseCursor=n
ForceRelativeMouseMode=n ForceRelativeMouseMode=n
AppNeedsArrowKeys=y AppNeedsArrowKeys=y
AppNeedsTextInput=y AppNeedsTextInput=y
AppUsesJoystick=n AppUsesJoystick=y
AppHandlesJoystickSensitivity=n AppUsesAccelerometer=y
AppUsesMultitouch=y AppUsesMultitouch=y
NonBlockingSwapBuffers=n NonBlockingSwapBuffers=n
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE" RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE"

View File

@@ -1092,6 +1092,7 @@ void SDL_ANDROID_VideoContextRecreated()
{ {
// Allocate HW texture // Allocate HW texture
Uint32 format = PixelFormatEnumColorkey; // 1-bit alpha for color key, every surface will have colorkey so it's easier for us Uint32 format = PixelFormatEnumColorkey; // 1-bit alpha for color key, every surface will have colorkey so it's easier for us
int flags = HwSurfaceList[i]->flags;
if( HwSurfaceList[i]->format->Amask ) if( HwSurfaceList[i]->format->Amask )
format = PixelFormatEnumAlpha; format = PixelFormatEnumAlpha;
if( HwSurfaceList[i] == SDL_CurrentVideoSurface ) if( HwSurfaceList[i] == SDL_CurrentVideoSurface )
@@ -1104,7 +1105,21 @@ void SDL_ANDROID_VideoContextRecreated()
} }
if( SDL_ANDROID_VideoLinearFilter ) if( SDL_ANDROID_VideoLinearFilter )
SDL_SetTextureScaleMode((SDL_Texture *)HwSurfaceList[i]->hwdata, SDL_SCALEMODE_SLOW); SDL_SetTextureScaleMode((SDL_Texture *)HwSurfaceList[i]->hwdata, SDL_SCALEMODE_SLOW);
ANDROID_UnlockHWSurface(NULL, HwSurfaceList[i]); // Re-fill texture with graphics if (flags & SDL_SRCALPHA)
{
int alpha = HwSurfaceList[i]->format->alpha;
ANDROID_SetHWAlpha(NULL, HwSurfaceList[i], alpha);
ANDROID_UnlockHWSurface(NULL, HwSurfaceList[i]); // Re-fill texture with graphics
}
else if (flags & SDL_SRCCOLORKEY)
{
int colorkey = HwSurfaceList[i]->format->colorkey;
ANDROID_SetHWColorKey(NULL, HwSurfaceList[i], colorkey);
}
else
{
ANDROID_UnlockHWSurface(NULL, HwSurfaceList[i]); // Re-fill texture with graphics
}
} }
} }
}; };