Zoomed planet view no longer abuses ScaledImg.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@857 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
ghaushe
2003-03-06 01:11:30 +00:00
parent 5d7ebc8e36
commit 161e9fb671
5 changed files with 25 additions and 21 deletions
+18 -13
View File
@@ -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 */ /* 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 #ifdef RND_BLUR_PROFILE
clock_t t1 = clock(); clock_t t1 = clock();
#endif #endif
@@ -534,9 +533,6 @@ SDL_Surface *random16xZoomSurfaceRGBA (SDL_Surface *src)
/* /*
* Alloc space to completely contain the zoomed surface * 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 (src);
SDL_LockSurface (dst); SDL_LockSurface (dst);
#if RANDOM_METHOD == 0 #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); fprintf(stderr, "Randomize took %f seconds\n",(float)(clock() - t1) / CLOCKS_PER_SEC);
#endif #endif
blurSurface32 (dst); 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; type = (UBYTE)TYPE_GET (GetFrameParentDrawable (FramePtr)
LockMutex (tfbImg->mutex); ->FlagsAndIndex) >> FTYPE_SHIFT;
tfbImg->ScaledImg = random16xZoomSurfaceRGBA (tfbImg->NormalImg); NewFrame = CaptureDrawable (
tfbImg->scale = 4 << 8; CreateDrawable (type,
UnlockMutex (tfbImg->mutex); (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 #endif
+2 -6
View File
@@ -1224,14 +1224,12 @@ ScrollPlanetSide (SIZE dx, SIZE dy, SIZE CountDown)
ClearDrawable (); ClearDrawable ();
s.origin.x = -new_pt.x + (SURFACE_WIDTH >> 1); s.origin.x = -new_pt.x + (SURFACE_WIDTH >> 1);
s.origin.y = -new_pt.y + (SURFACE_HEIGHT >> 1); s.origin.y = -new_pt.y + (SURFACE_HEIGHT >> 1);
s.frame = pSolarSysState->TopoFrame; s.frame = pSolarSysState->TopoZoomFrame;
SetGraphicScale (1 << (MAG_SHIFT + 8));
DrawStamp (&s); DrawStamp (&s);
s.origin.x += MAP_WIDTH << MAG_SHIFT; s.origin.x += MAP_WIDTH << MAG_SHIFT;
DrawStamp (&s); DrawStamp (&s);
s.origin.x -= MAP_WIDTH << (MAG_SHIFT + 1); s.origin.x -= MAP_WIDTH << (MAG_SHIFT + 1);
DrawStamp (&s); DrawStamp (&s);
SetGraphicScale (0);
} }
BuildObjectList (); BuildObjectList ();
@@ -1528,14 +1526,12 @@ InitPlanetSide (void)
ClearDrawable (); ClearDrawable ();
s.origin.x = -pt.x + (SURFACE_WIDTH >> 1); s.origin.x = -pt.x + (SURFACE_WIDTH >> 1);
s.origin.y = -pt.y + (SURFACE_HEIGHT >> 1); s.origin.y = -pt.y + (SURFACE_HEIGHT >> 1);
s.frame = pSolarSysState->TopoFrame; s.frame = pSolarSysState->TopoZoomFrame;
SetGraphicScale (1 << (MAG_SHIFT + 8));
DrawStamp (&s); DrawStamp (&s);
s.origin.x += MAP_WIDTH << MAG_SHIFT; s.origin.x += MAP_WIDTH << MAG_SHIFT;
DrawStamp (&s); DrawStamp (&s);
s.origin.x -= MAP_WIDTH << (MAG_SHIFT + 1); s.origin.x -= MAP_WIDTH << (MAG_SHIFT + 1);
DrawStamp (&s); DrawStamp (&s);
SetGraphicScale (0);
} }
ScreenTransition (3, &r); ScreenTransition (3, &r);
+2
View File
@@ -214,6 +214,8 @@ FreePlanet (void)
pSolarSysState->hTopoData = 0; pSolarSysState->hTopoData = 0;
DestroyDrawable (ReleaseDrawable (pSolarSysState->TopoFrame)); DestroyDrawable (ReleaseDrawable (pSolarSysState->TopoFrame));
pSolarSysState->TopoFrame = 0; pSolarSysState->TopoFrame = 0;
DestroyDrawable (ReleaseDrawable (pSolarSysState->TopoZoomFrame));
pSolarSysState->TopoZoomFrame = 0;
DestroyColorMap (ReleaseColorMap (pSolarSysState->OrbitalCMap)); DestroyColorMap (ReleaseColorMap (pSolarSysState->OrbitalCMap));
pSolarSysState->OrbitalCMap = 0; pSolarSysState->OrbitalCMap = 0;
DestroyDrawable (ReleaseDrawable (pSolarSysState->PlanetFrameArray)); DestroyDrawable (ReleaseDrawable (pSolarSysState->PlanetFrameArray));
+1
View File
@@ -153,6 +153,7 @@ typedef struct solarsys_state
BYTE thrust_counter, max_ship_speed; BYTE thrust_counter, max_ship_speed;
FRAME TopoFrame; FRAME TopoFrame;
FRAME TopoZoomFrame;
MEM_HANDLE hTopoData; MEM_HANDLE hTopoData;
PBYTE lpTopoData; PBYTE lpTopoData;
STRING XlatRef; STRING XlatRef;
+2 -2
View File
@@ -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 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); 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 // from lpTopoData instead of the FRAMPTR though
x = MAP_WIDTH + MAP_HEIGHT; x = MAP_WIDTH + MAP_HEIGHT;
y = MAP_HEIGHT; y = MAP_HEIGHT;
scale16xRandomizeFrame(pSolarSysState->TopoFrame); pSolarSysState->TopoZoomFrame = scale16xRandomizeFrame(pSolarSysState->TopoFrame);
pSolarSysState->lpTopoMap = getpixelarray ( pSolarSysState->lpTopoMap = getpixelarray (
pSolarSysState->TopoFrame, x, y pSolarSysState->TopoFrame, x, y
); );