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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
srcRect.x = rsrc->corner.x;
|
||||
srcRect.y = rsrc->corner.y;
|
||||
srcRect.w = rsrc->extent.width;
|
||||
srcRect.h = rsrc->extent.height;
|
||||
srp = &srcRect;
|
||||
}
|
||||
else if (add_sub < 0)
|
||||
else if (GetFrameHotX (srcFrame) || GetFrameHotY (srcFrame))
|
||||
{
|
||||
add = 1;
|
||||
sub = -1;
|
||||
if (rdst)
|
||||
{
|
||||
dstRect.x -= GetFrameHotX (srcFrame);
|
||||
dstRect.y -= GetFrameHotY (srcFrame);
|
||||
}
|
||||
TFB_BlitSurface (src, srp, dst, drp, sub, add);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ SDL_Surface *random16xZoomSurfaceRGBA (SDL_Surface *src)
|
||||
return (dst);
|
||||
}
|
||||
|
||||
void buildLanderView (FRAMEPTR FramePtr)
|
||||
void scale16xRandomizeFrame (FRAMEPTR FramePtr)
|
||||
{
|
||||
TFB_Image *tfbImg;
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user