Replaced add_sub_frame with arith_frame_blit -PhracturedBlue

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@478 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
ghaushe
2002-12-24 00:23:54 +00:00
parent 0c1b734668
commit 8bcc7bcd47
6 changed files with 44 additions and 31 deletions
+1
View File
@@ -1,4 +1,5 @@
0.2:
- Replaced add_sub_frame with arith_frame_blit -PhracturedBlue
- Crosshair in orbit leaving light trace to image in OpenGL mode fixed -Mika
- Planet scan should now take ~2secs on all computers -PhracturedBlue
- Updated earth image to look nicer (no vertical lines) -PhracturedBlue
+26 -18
View File
@@ -209,7 +209,8 @@ void fill_frame_rgb (FRAMEPTR FramePtr, Uint32 color, int x0, int y0, int x, int
SDL_UnlockSurface (img);
UnlockMutex (tfbImg->mutex);
}
void add_sub_frame (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *rdst, int add_sub)
void arith_frame_blit (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *rdst, int num,int denom)
{
int add = 0, sub = 0;
TFB_Image *srcImg, *dstImg;
@@ -221,14 +222,6 @@ void add_sub_frame (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *rdst
LockMutex (dstImg->mutex);
src = srcImg->NormalImg;
dst = dstImg->NormalImg;
if (rsrc)
{
srcRect.x = rsrc->corner.x;
srcRect.y = rsrc->corner.y;
srcRect.w = rsrc->extent.width;
srcRect.h = rsrc->extent.height;
srp = &srcRect;
}
if (rdst)
{
dstRect.x = rdst->corner.x;
@@ -237,17 +230,32 @@ void add_sub_frame (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *rdst
dstRect.h = rdst->extent.height;
drp = &dstRect;
}
if (add_sub > 0)
if (rsrc)
{
add = -1;
sub = 1;
}
else if (add_sub < 0)
{
add = 1;
sub = -1;
srcRect.x = rsrc->corner.x;
srcRect.y = rsrc->corner.y;
srcRect.w = rsrc->extent.width;
srcRect.h = rsrc->extent.height;
srp = &srcRect;
}
TFB_BlitSurface (src, srp, dst, drp, sub, add);
else if (GetFrameHotX (srcFrame) || GetFrameHotY (srcFrame))
{
if (rdst)
{
dstRect.x -= GetFrameHotX (srcFrame);
dstRect.y -= GetFrameHotY (srcFrame);
}
else
{
dstRect.x = -GetFrameHotX (srcFrame);
dstRect.y = -GetFrameHotY (srcFrame);
dstRect.w = GetFrameWidth (srcFrame);
dstRect.h = GetFrameHeight (srcFrame);
drp =&dstRect;
}
}
TFB_BlitSurface (src, srp, dst, drp, num, denom);
UnlockMutex (srcImg->mutex);
UnlockMutex (dstImg->mutex);
}
+1 -1
View File
@@ -558,7 +558,7 @@ SDL_Surface *random16xZoomSurfaceRGBA (SDL_Surface *src)
return (dst);
}
void buildLanderView (FRAMEPTR FramePtr)
void scale16xRandomizeFrame (FRAMEPTR FramePtr)
{
TFB_Image *tfbImg;
+4 -4
View File
@@ -33,7 +33,7 @@ void process_rgb_bmp (FRAME FramePtr, DWORD *rgba, int maxx, int maxy);
void fill_frame_rgb (FRAMEPTR FramePtr, DWORD color, int x0, int y0, int x, int y);
void add_sub_frame (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *rdst, int add_sub);
void arith_frame_blit (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *rdst, int num, int denom);
extern FRAME stretch_frame (FRAME FramePtr, int neww, int newh,int destroy);
@@ -174,7 +174,7 @@ DrawPlanet (int x, int y, int dy, unsigned int rgb)
{
pSolarSysState->Tint_rgb=rgb;
// Buffer the topoMap to the tintFrame;
add_sub_frame (s.frame, NULL, tintFrame[0], NULL, 0);
arith_frame_blit (s.frame, NULL, tintFrame[0], NULL, 0, 0);
r = (rgb & (0x1f << 10)) >> 8;
g = (rgb & (0x1f << 5)) >> 3;
b = (rgb & 0x1f) << 2;
@@ -207,9 +207,9 @@ DrawPlanet (int x, int y, int dy, unsigned int rgb)
if (dy <= frameh) {
#ifdef USE_ADDITIVE_SCAN_BLIT
add_sub_frame (tintFrame[1], psrect, tintFrame[0], pdrect, 1);
arith_frame_blit (tintFrame[1], psrect, tintFrame[0], pdrect, 0, -1);
#else
add_sub_frame (tintFrame[1], psrect, tintFrame[0], pdrect, 0);
arith_frame_blit (tintFrame[1], psrect, tintFrame[0], pdrect, 0, 0);
#endif
}
s.frame = tintFrame[0];
+8 -6
View File
@@ -47,9 +47,9 @@ FRAME stretch_frame (FRAME FramePtr, int neww, int newh,int destroy);
void fill_frame_rgb (FRAME FramePtr, DWORD color, int x0, int y0, int x, int y);
void add_sub_frame (FRAME srcFrame, RECT *rsrc, FRAME dstFrame, RECT *rdst, int add_sub);
void arith_frame_blit (FRAME srcFrame, RECT *rsrc, FRAME dstFrame, RECT *rdst, int num, int denom);
void buildLanderView(FRAME FramePtr);
void scale16xRandomizeFrame(FRAME FramePtr);
DWORD **getpixelarray(FRAME FramePtr,int width, int height);
@@ -540,18 +540,20 @@ static void CreateShieldMask ()
pSolarSysState->ShieldFrame = ShieldFrame;
{
// Applythe shield to the topo data
UBYTE a, blit_type;
UBYTE a;
int blit_type;
FRAME tintFrame = pSolarSysState->TintFrame;
#ifdef USE_ALPHA_SHIELD
a = 200;
blit_type = 0;
#else
//additive_blit
a = 255;
blit_type = 1;
blit_type = -1;
#endif
p = frame_mapRGBA (tintFrame, 255, 0, 0, a);
fill_frame_rgb (tintFrame, p, 0, 0, 0, 0);
add_sub_frame (tintFrame, NULL, pSolarSysState->TopoFrame, NULL, blit_type);
arith_frame_blit (tintFrame, NULL, pSolarSysState->TopoFrame, NULL, 0, blit_type);
}
}
@@ -1300,7 +1302,7 @@ GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth)
// from lpTopoData instead of the FRAMPTR though
x = MAP_WIDTH + MAP_HEIGHT;
y = MAP_HEIGHT;
buildLanderView(pSolarSysState->TopoFrame);
scale16xRandomizeFrame(pSolarSysState->TopoFrame);
pSolarSysState->lpTopoMap = getpixelarray (
pSolarSysState->TopoFrame, x, y
);
+4 -2
View File
@@ -847,6 +847,7 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
PressState = AnyButtonPress (TRUE);
WaitTime = (ONE_SECOND << 1) / MAP_HEIGHT;
SetSemaphore (GraphicsSem);
TimeIn = GetTimeCounter ();
for (i = 0; i < MAP_HEIGHT + NUM_FLASH_COLORS + 1; i++)
{
@@ -858,7 +859,7 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
}
if (ButtonState)
i = -i;
SetSemaphore (GraphicsSem);
// SetSemaphore (GraphicsSem);
BatchGraphics ();
DrawPlanet (0, 0, i, rgb);
if (i < 0)
@@ -866,11 +867,12 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
if (pMS->delta_item)
DrawScannedStuff (i, min_scan);
UnbatchGraphics ();
ClearSemaphore (GraphicsSem);
// ClearSemaphore (GraphicsSem);
// FlushGraphics ();
SleepThreadUntil (TimeIn + WaitTime);
TimeIn = GetTimeCounter ();
}
ClearSemaphore (GraphicsSem);
pSolarSysState->Tint_rgb = 0;
}