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:
|
0.2:
|
||||||
|
- Replaced add_sub_frame with arith_frame_blit -PhracturedBlue
|
||||||
- Crosshair in orbit leaving light trace to image in OpenGL mode fixed -Mika
|
- Crosshair in orbit leaving light trace to image in OpenGL mode fixed -Mika
|
||||||
- Planet scan should now take ~2secs on all computers -PhracturedBlue
|
- Planet scan should now take ~2secs on all computers -PhracturedBlue
|
||||||
- Updated earth image to look nicer (no vertical lines) -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);
|
SDL_UnlockSurface (img);
|
||||||
UnlockMutex (tfbImg->mutex);
|
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;
|
int add = 0, sub = 0;
|
||||||
TFB_Image *srcImg, *dstImg;
|
TFB_Image *srcImg, *dstImg;
|
||||||
@@ -221,14 +222,6 @@ void add_sub_frame (FRAMEPTR srcFrame, RECT *rsrc, FRAMEPTR dstFrame, RECT *rdst
|
|||||||
LockMutex (dstImg->mutex);
|
LockMutex (dstImg->mutex);
|
||||||
src = srcImg->NormalImg;
|
src = srcImg->NormalImg;
|
||||||
dst = dstImg->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)
|
if (rdst)
|
||||||
{
|
{
|
||||||
dstRect.x = rdst->corner.x;
|
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;
|
dstRect.h = rdst->extent.height;
|
||||||
drp = &dstRect;
|
drp = &dstRect;
|
||||||
}
|
}
|
||||||
if (add_sub > 0)
|
if (rsrc)
|
||||||
{
|
{
|
||||||
add = -1;
|
srcRect.x = rsrc->corner.x;
|
||||||
sub = 1;
|
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;
|
if (rdst)
|
||||||
sub = -1;
|
{
|
||||||
|
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, sub, add);
|
TFB_BlitSurface (src, srp, dst, drp, num, denom);
|
||||||
UnlockMutex (srcImg->mutex);
|
UnlockMutex (srcImg->mutex);
|
||||||
UnlockMutex (dstImg->mutex);
|
UnlockMutex (dstImg->mutex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ SDL_Surface *random16xZoomSurfaceRGBA (SDL_Surface *src)
|
|||||||
return (dst);
|
return (dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildLanderView (FRAMEPTR FramePtr)
|
void scale16xRandomizeFrame (FRAMEPTR FramePtr)
|
||||||
{
|
{
|
||||||
TFB_Image *tfbImg;
|
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 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);
|
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;
|
pSolarSysState->Tint_rgb=rgb;
|
||||||
// Buffer the topoMap to the tintFrame;
|
// 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;
|
r = (rgb & (0x1f << 10)) >> 8;
|
||||||
g = (rgb & (0x1f << 5)) >> 3;
|
g = (rgb & (0x1f << 5)) >> 3;
|
||||||
b = (rgb & 0x1f) << 2;
|
b = (rgb & 0x1f) << 2;
|
||||||
@@ -207,9 +207,9 @@ DrawPlanet (int x, int y, int dy, unsigned int rgb)
|
|||||||
if (dy <= frameh) {
|
if (dy <= frameh) {
|
||||||
|
|
||||||
#ifdef USE_ADDITIVE_SCAN_BLIT
|
#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
|
#else
|
||||||
add_sub_frame (tintFrame[1], psrect, tintFrame[0], pdrect, 0);
|
arith_frame_blit (tintFrame[1], psrect, tintFrame[0], pdrect, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
s.frame = tintFrame[0];
|
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 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);
|
DWORD **getpixelarray(FRAME FramePtr,int width, int height);
|
||||||
|
|
||||||
@@ -540,18 +540,20 @@ static void CreateShieldMask ()
|
|||||||
pSolarSysState->ShieldFrame = ShieldFrame;
|
pSolarSysState->ShieldFrame = ShieldFrame;
|
||||||
{
|
{
|
||||||
// Applythe shield to the topo data
|
// Applythe shield to the topo data
|
||||||
UBYTE a, blit_type;
|
UBYTE a;
|
||||||
|
int blit_type;
|
||||||
FRAME tintFrame = pSolarSysState->TintFrame;
|
FRAME tintFrame = pSolarSysState->TintFrame;
|
||||||
#ifdef USE_ALPHA_SHIELD
|
#ifdef USE_ALPHA_SHIELD
|
||||||
a = 200;
|
a = 200;
|
||||||
blit_type = 0;
|
blit_type = 0;
|
||||||
#else
|
#else
|
||||||
|
//additive_blit
|
||||||
a = 255;
|
a = 255;
|
||||||
blit_type = 1;
|
blit_type = -1;
|
||||||
#endif
|
#endif
|
||||||
p = frame_mapRGBA (tintFrame, 255, 0, 0, a);
|
p = frame_mapRGBA (tintFrame, 255, 0, 0, a);
|
||||||
fill_frame_rgb (tintFrame, p, 0, 0, 0, 0);
|
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
|
// from lpTopoData instead of the FRAMPTR though
|
||||||
x = MAP_WIDTH + MAP_HEIGHT;
|
x = MAP_WIDTH + MAP_HEIGHT;
|
||||||
y = MAP_HEIGHT;
|
y = MAP_HEIGHT;
|
||||||
buildLanderView(pSolarSysState->TopoFrame);
|
scale16xRandomizeFrame(pSolarSysState->TopoFrame);
|
||||||
pSolarSysState->lpTopoMap = getpixelarray (
|
pSolarSysState->lpTopoMap = getpixelarray (
|
||||||
pSolarSysState->TopoFrame, x, y
|
pSolarSysState->TopoFrame, x, y
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -847,6 +847,7 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
|
|||||||
|
|
||||||
PressState = AnyButtonPress (TRUE);
|
PressState = AnyButtonPress (TRUE);
|
||||||
WaitTime = (ONE_SECOND << 1) / MAP_HEIGHT;
|
WaitTime = (ONE_SECOND << 1) / MAP_HEIGHT;
|
||||||
|
SetSemaphore (GraphicsSem);
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
for (i = 0; i < MAP_HEIGHT + NUM_FLASH_COLORS + 1; i++)
|
for (i = 0; i < MAP_HEIGHT + NUM_FLASH_COLORS + 1; i++)
|
||||||
{
|
{
|
||||||
@@ -858,7 +859,7 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
|
|||||||
}
|
}
|
||||||
if (ButtonState)
|
if (ButtonState)
|
||||||
i = -i;
|
i = -i;
|
||||||
SetSemaphore (GraphicsSem);
|
// SetSemaphore (GraphicsSem);
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
DrawPlanet (0, 0, i, rgb);
|
DrawPlanet (0, 0, i, rgb);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
@@ -866,11 +867,12 @@ DoScan (INPUT_STATE InputState, PMENU_STATE
|
|||||||
if (pMS->delta_item)
|
if (pMS->delta_item)
|
||||||
DrawScannedStuff (i, min_scan);
|
DrawScannedStuff (i, min_scan);
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
ClearSemaphore (GraphicsSem);
|
// ClearSemaphore (GraphicsSem);
|
||||||
// FlushGraphics ();
|
// FlushGraphics ();
|
||||||
SleepThreadUntil (TimeIn + WaitTime);
|
SleepThreadUntil (TimeIn + WaitTime);
|
||||||
TimeIn = GetTimeCounter ();
|
TimeIn = GetTimeCounter ();
|
||||||
}
|
}
|
||||||
|
ClearSemaphore (GraphicsSem);
|
||||||
pSolarSysState->Tint_rgb = 0;
|
pSolarSysState->Tint_rgb = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user