diff --git a/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c b/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c index ecacb3822..b90804ec1 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c +++ b/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c @@ -524,9 +524,8 @@ void rZF_continuous (SDL_Surface *src, SDL_Surface *dst) } /* perform a 16x zoom, and then apply a blur filter to the result */ -SDL_Surface *random16xZoomSurfaceRGBA (SDL_Surface *src) +void random16xZoomSurfaceRGBA (SDL_Surface *src, SDL_Surface *dst) { - SDL_Surface *dst; #ifdef RND_BLUR_PROFILE clock_t t1 = clock(); #endif @@ -534,9 +533,6 @@ SDL_Surface *random16xZoomSurfaceRGBA (SDL_Surface *src) /* * Alloc space to completely contain the zoomed surface */ - dst = SDL_CreateRGBSurface(SDL_SWSURFACE, src->w << 2, src->h << 2, 32, - src->format->Rmask, src->format->Gmask, - src->format->Bmask, src->format->Amask); SDL_LockSurface (src); SDL_LockSurface (dst); #if RANDOM_METHOD == 0 @@ -557,17 +553,26 @@ SDL_Surface *random16xZoomSurfaceRGBA (SDL_Surface *src) fprintf(stderr, "Randomize took %f seconds\n",(float)(clock() - t1) / CLOCKS_PER_SEC); #endif blurSurface32 (dst); - return (dst); } -void scale16xRandomizeFrame (FRAMEPTR FramePtr) +FRAMEPTR scale16xRandomizeFrame (FRAMEPTR FramePtr) { - TFB_Image *tfbImg; + TFB_Image *origImg, *newImg; + FRAMEPTR NewFrame; + UBYTE type; - tfbImg = FramePtr->image; - LockMutex (tfbImg->mutex); - tfbImg->ScaledImg = random16xZoomSurfaceRGBA (tfbImg->NormalImg); - tfbImg->scale = 4 << 8; - UnlockMutex (tfbImg->mutex); + type = (UBYTE)TYPE_GET (GetFrameParentDrawable (FramePtr) + ->FlagsAndIndex) >> FTYPE_SHIFT; + NewFrame = CaptureDrawable ( + CreateDrawable (type, + (SIZE)((GetFrameWidth (FramePtr)) << 2), + (SIZE)((GetFrameHeight (FramePtr)) << 2), 1)); + + newImg = NewFrame->image; + origImg = FramePtr->image; + LockMutex (origImg->mutex); + random16xZoomSurfaceRGBA (origImg->NormalImg, newImg->NormalImg); + UnlockMutex (origImg->mutex); + return (NewFrame); } #endif diff --git a/sc2/src/sc2code/planets/lander.c b/sc2/src/sc2code/planets/lander.c index f75bb1751..f12ea0229 100644 --- a/sc2/src/sc2code/planets/lander.c +++ b/sc2/src/sc2code/planets/lander.c @@ -1224,14 +1224,12 @@ ScrollPlanetSide (SIZE dx, SIZE dy, SIZE CountDown) ClearDrawable (); s.origin.x = -new_pt.x + (SURFACE_WIDTH >> 1); s.origin.y = -new_pt.y + (SURFACE_HEIGHT >> 1); - s.frame = pSolarSysState->TopoFrame; - SetGraphicScale (1 << (MAG_SHIFT + 8)); + s.frame = pSolarSysState->TopoZoomFrame; DrawStamp (&s); s.origin.x += MAP_WIDTH << MAG_SHIFT; DrawStamp (&s); s.origin.x -= MAP_WIDTH << (MAG_SHIFT + 1); DrawStamp (&s); - SetGraphicScale (0); } BuildObjectList (); @@ -1528,14 +1526,12 @@ InitPlanetSide (void) ClearDrawable (); s.origin.x = -pt.x + (SURFACE_WIDTH >> 1); s.origin.y = -pt.y + (SURFACE_HEIGHT >> 1); - s.frame = pSolarSysState->TopoFrame; - SetGraphicScale (1 << (MAG_SHIFT + 8)); + s.frame = pSolarSysState->TopoZoomFrame; DrawStamp (&s); s.origin.x += MAP_WIDTH << MAG_SHIFT; DrawStamp (&s); s.origin.x -= MAP_WIDTH << (MAG_SHIFT + 1); DrawStamp (&s); - SetGraphicScale (0); } ScreenTransition (3, &r); diff --git a/sc2/src/sc2code/planets/planets.c b/sc2/src/sc2code/planets/planets.c index 816904ad2..4e9ae7b50 100644 --- a/sc2/src/sc2code/planets/planets.c +++ b/sc2/src/sc2code/planets/planets.c @@ -214,6 +214,8 @@ FreePlanet (void) pSolarSysState->hTopoData = 0; DestroyDrawable (ReleaseDrawable (pSolarSysState->TopoFrame)); pSolarSysState->TopoFrame = 0; + DestroyDrawable (ReleaseDrawable (pSolarSysState->TopoZoomFrame)); + pSolarSysState->TopoZoomFrame = 0; DestroyColorMap (ReleaseColorMap (pSolarSysState->OrbitalCMap)); pSolarSysState->OrbitalCMap = 0; DestroyDrawable (ReleaseDrawable (pSolarSysState->PlanetFrameArray)); diff --git a/sc2/src/sc2code/planets/planets.h b/sc2/src/sc2code/planets/planets.h index 29f7ae1e2..dbefd800a 100644 --- a/sc2/src/sc2code/planets/planets.h +++ b/sc2/src/sc2code/planets/planets.h @@ -153,6 +153,7 @@ typedef struct solarsys_state BYTE thrust_counter, max_ship_speed; FRAME TopoFrame; + FRAME TopoZoomFrame; MEM_HANDLE hTopoData; PBYTE lpTopoData; STRING XlatRef; diff --git a/sc2/src/sc2code/planets/plangen.c b/sc2/src/sc2code/planets/plangen.c index 0bf52bad7..c5b645ab6 100644 --- a/sc2/src/sc2code/planets/plangen.c +++ b/sc2/src/sc2code/planets/plangen.c @@ -49,7 +49,7 @@ void fill_frame_rgb (FRAME FramePtr, DWORD color, int x0, int y0, int x, int y); void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame, RECT *rdst, int num, int denom); -void scale16xRandomizeFrame(FRAME FramePtr); +FRAME scale16xRandomizeFrame(FRAME FramePtr); DWORD **getpixelarray(FRAME FramePtr,int width, int height); @@ -1303,7 +1303,7 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth) // from lpTopoData instead of the FRAMPTR though x = MAP_WIDTH + MAP_HEIGHT; y = MAP_HEIGHT; - scale16xRandomizeFrame(pSolarSysState->TopoFrame); + pSolarSysState->TopoZoomFrame = scale16xRandomizeFrame(pSolarSysState->TopoFrame); pSolarSysState->lpTopoMap = getpixelarray ( pSolarSysState->TopoFrame, x, y );