Streamlined the 'legacy' graphics code implementation.
The vtable-style code that was implementing the drawing of primitives turned out to be entirely unnecessary; every virtual call was inside a switch or if on the type of the primitive. Code has been restructured to be more consistent and simpler. Never-used primitives (composites and polygons) have been removed entirely. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@838 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
Changes towards version 0.3:
|
||||
- Removed aspects of the legacy graphics code that are never used or that
|
||||
are redundant. More 'C-like' use of the PRIMITIVE datatype.
|
||||
- Fix various graphics glitches during dialog. Especially Spathi Eye,and ZFP
|
||||
Closes #23, #156 - PhracturedBlue
|
||||
- Fix Syreen, KohrAh and Slylandro ship effects to not be screen
|
||||
|
||||
@@ -24,11 +24,9 @@ InitSISContexts (void)
|
||||
RECT r;
|
||||
|
||||
SetContext (StatusContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
SetContext (SpaceContext);
|
||||
SetContextFGFrame (Screen);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
r.corner.x = SIS_ORG_X;
|
||||
r.corner.y = SIS_ORG_Y;
|
||||
@@ -44,7 +42,6 @@ DrawSISFrame (void)
|
||||
|
||||
SetSemaphore (GraphicsSem);
|
||||
SetContext (ScreenContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
BatchGraphics ();
|
||||
{
|
||||
|
||||
@@ -1683,7 +1683,6 @@ HailAlien (void)
|
||||
ES.phrase_buf[0] = '\0';
|
||||
|
||||
SetContext (SpaceContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
OldFont = SetContextFont (PlayerFont);
|
||||
|
||||
{
|
||||
|
||||
@@ -45,10 +45,8 @@ ConfirmExit (void)
|
||||
STAMP s;
|
||||
FRAME F;
|
||||
CONTEXT oldContext;
|
||||
DRAW_STATE oldDrawState;
|
||||
|
||||
oldContext = SetContext (ScreenContext);
|
||||
oldDrawState = SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
s.frame = SetAbsFrameIndex (ActivityFrame, 1);
|
||||
GetFrameRect (s.frame, &r);
|
||||
@@ -97,7 +95,6 @@ ConfirmExit (void)
|
||||
FlushInput ();
|
||||
}
|
||||
|
||||
SetContextDrawState (oldDrawState);
|
||||
SetContext (oldContext);
|
||||
}
|
||||
ClearSemaphore (GraphicsSem);
|
||||
|
||||
@@ -176,7 +176,6 @@ MUSIC_REF MR;
|
||||
hOldIndex = SetResourceIndex (hResIndex);
|
||||
|
||||
SetContext (SpaceContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
SetContextFont (TinyFont);
|
||||
|
||||
MR = LoadMusicInstance (REDALERT_MUSIC);
|
||||
|
||||
@@ -1103,8 +1103,6 @@ PickGame (PMENU_STATE
|
||||
{
|
||||
BOOLEAN retval;
|
||||
CONTEXT OldContext;
|
||||
FRAME OldFrame;
|
||||
DRAW_STATE OldDrawState;
|
||||
SUMMARY_DESC desc_array[MAX_SAVED_GAMES];
|
||||
RECT DlgRect;
|
||||
STAMP DlgStamp;
|
||||
@@ -1118,8 +1116,6 @@ PickGame (PMENU_STATE
|
||||
|
||||
SetSemaphore (GraphicsSem);
|
||||
OldContext = SetContext (SpaceContext);
|
||||
OldFrame = SetContextBGFrame (NULL_PTR);
|
||||
OldDrawState = SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
DlgStamp.origin.x = 0;
|
||||
DlgStamp.origin.y = 0;
|
||||
@@ -1188,8 +1184,6 @@ PickGame (PMENU_STATE
|
||||
|
||||
DestroyDrawable (ReleaseDrawable (DlgStamp.frame));
|
||||
|
||||
SetContextDrawState (OldDrawState);
|
||||
SetContextBGFrame (OldFrame);
|
||||
SetContext (OldContext);
|
||||
ClearSemaphore (GraphicsSem);
|
||||
|
||||
|
||||
@@ -350,7 +350,6 @@ LoadHyperspace (void)
|
||||
SET_GAME_STATE (USED_BROADCASTER, 0);
|
||||
SET_GAME_STATE (BROADCASTER_RESPONSE, 0);
|
||||
}
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
// ClearDrawable ();
|
||||
|
||||
ClearSISRect (CLEAR_SIS_RADAR);
|
||||
@@ -1542,13 +1541,11 @@ DoMenuOptions (void)
|
||||
{
|
||||
COLOR OldColor;
|
||||
CONTEXT OldContext;
|
||||
DRAW_STATE OldDrawState;
|
||||
MENU_STATE MenuState;
|
||||
|
||||
UnbatchGraphics ();
|
||||
|
||||
OldContext = SetContext (SpaceContext);
|
||||
OldDrawState = SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
OldColor = SetContextBackGroundColor (BLACK_COLOR);
|
||||
|
||||
ClearSemaphore (GraphicsSem);
|
||||
@@ -1570,7 +1567,6 @@ UnbatchGraphics ();
|
||||
SetFlashRect (NULL_PTR, (FRAME)0);
|
||||
|
||||
SetContext (SpaceContext);
|
||||
SetContextBGFrame (0);
|
||||
|
||||
if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD)))
|
||||
{
|
||||
@@ -1582,7 +1578,6 @@ UnbatchGraphics ();
|
||||
}
|
||||
|
||||
SetContextBackGroundColor (OldColor);
|
||||
SetContextDrawState (OldDrawState);
|
||||
SetContext (OldContext);
|
||||
if (!(GLOBAL (CurrentActivity) & IN_BATTLE))
|
||||
cleanup_hyperspace ();
|
||||
|
||||
@@ -121,7 +121,6 @@ InitShips (void)
|
||||
InitSpace ();
|
||||
|
||||
SetContext (StatusContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
SetContext (SpaceContext);
|
||||
|
||||
InitDisplayList ();
|
||||
@@ -157,7 +156,6 @@ InitShips (void)
|
||||
|
||||
OldContext = SetContext (ScreenContext);
|
||||
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
SetContextBackGroundColor (BLACK_COLOR);
|
||||
ClearDrawable ();
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#define CONTEXT PVOID
|
||||
#define FRAME PVOID
|
||||
#define FONT PVOID
|
||||
#define CYCLE_REF DWORD
|
||||
|
||||
typedef CONTEXT *PCONTEXT;
|
||||
typedef FRAME *PFRAME;
|
||||
@@ -54,28 +53,6 @@ typedef BYTE CREATE_FLAGS;
|
||||
#define WANT_PIXMAP (CREATE_FLAGS)(1 << 1)
|
||||
#define MAPPED_TO_DISPLAY (CREATE_FLAGS)(1 << 2)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MAP_ISOTROPIC, /* == X/Y scale is the same */
|
||||
MAP_ANISOTROPIC, /* == X/Y scale different (e.g. aspect ratio) */
|
||||
MAP_NOXFORM /* == X/Y scale is ignored */
|
||||
} MAP_TYPE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DEST_MASK = MAKE_WORD (0, 0),
|
||||
DEST_PIXMAP = MAKE_WORD (0, 1)
|
||||
} DRAW_DESTINATION;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DRAW_SUBTRACTIVE = 0, /* implied only to active page */
|
||||
DRAW_ADDITIVE, /* implied only to active page */
|
||||
DRAW_REPLACE
|
||||
} DRAW_MODE;
|
||||
|
||||
typedef UWORD DRAW_STATE;
|
||||
|
||||
typedef struct extent
|
||||
{
|
||||
COORD width, height;
|
||||
@@ -132,33 +109,12 @@ typedef struct text
|
||||
} TEXT;
|
||||
typedef TEXT *PTEXT;
|
||||
|
||||
typedef MEM_HANDLE POLYREF;
|
||||
|
||||
typedef PVOID POLYGON;
|
||||
typedef POLYGON *PPOLYGON;
|
||||
|
||||
#include "strlib.h"
|
||||
|
||||
typedef STRING_TABLE COLORMAP_REF;
|
||||
typedef STRING COLORMAP;
|
||||
typedef STRINGPTR COLORMAPPTR;
|
||||
|
||||
typedef struct stamp_cmap
|
||||
{
|
||||
POINT origin;
|
||||
FRAME frame;
|
||||
COLORMAPPTR CMap;
|
||||
} STAMP_CMAP;
|
||||
typedef STAMP_CMAP *PSTAMP_CMAP;
|
||||
|
||||
typedef struct composite
|
||||
{
|
||||
POINT origin;
|
||||
PFRAME FrameList;
|
||||
COUNT NumFrames;
|
||||
} COMPOSITE;
|
||||
typedef COMPOSITE *PCOMPOSITE;
|
||||
|
||||
enum gfx_object
|
||||
{
|
||||
POINT_PRIM = 0,
|
||||
@@ -166,13 +122,8 @@ enum gfx_object
|
||||
STAMPFILL_PRIM,
|
||||
LINE_PRIM,
|
||||
TEXT_PRIM,
|
||||
STAMPCMAP_PRIM,
|
||||
RECT_PRIM,
|
||||
RECTFILL_PRIM,
|
||||
POLY_PRIM,
|
||||
POLYFILL_PRIM,
|
||||
COMPOSITE_PRIM,
|
||||
COMPOSITEFILL_PRIM,
|
||||
|
||||
NUM_PRIMS
|
||||
};
|
||||
@@ -184,10 +135,7 @@ typedef union
|
||||
STAMP Stamp;
|
||||
LINE Line;
|
||||
TEXT Text;
|
||||
STAMP_CMAP StampCMap;
|
||||
RECT Rect;
|
||||
POLYGON Polygon;
|
||||
COMPOSITE Composite;
|
||||
} PRIM_DESC;
|
||||
typedef PRIM_DESC *PPRIM_DESC;
|
||||
|
||||
@@ -268,8 +216,6 @@ extern INTERSECT_CODE BoxIntersect (PRECT pr1, PRECT pr2, PRECT
|
||||
printer);
|
||||
extern void BoxUnion (PRECT pr1, PRECT pr2, PRECT punion);
|
||||
|
||||
typedef void (*BG_FUNC) (PRECT pClipRect);
|
||||
|
||||
#endif /* _GFXLIB_H */
|
||||
|
||||
|
||||
@@ -283,22 +229,9 @@ extern void UninitGraphics (void);
|
||||
extern CONTEXT SetContext (CONTEXT Context);
|
||||
extern CONTEXT CaptureContext (CONTEXT_REF ContextRef);
|
||||
extern CONTEXT_REF ReleaseContext (CONTEXT Context);
|
||||
extern MAP_TYPE SetContextMapType (MAP_TYPE MapType);
|
||||
extern BOOLEAN SetContextWinOrigin (PPOINT pOrg);
|
||||
extern BOOLEAN SetContextViewExtents (PEXTENT pExtent);
|
||||
extern BOOLEAN SetContextWinExtents (PEXTENT pExtent);
|
||||
extern BOOLEAN GetContextWinOrigin (PPOINT pOrg);
|
||||
extern BOOLEAN GetContextViewExtents (PEXTENT pExtent);
|
||||
extern BOOLEAN GetContextWinExtents (PEXTENT pExtent);
|
||||
extern BOOLEAN LOGtoDEV (PPOINT pSrcPt, PPOINT pDstPt, COUNT NumPoints);
|
||||
extern BOOLEAN DEVtoLOG (PPOINT pSrcPt, PPOINT pDstPt, COUNT NumPoints);
|
||||
extern DRAW_STATE GetContextDrawState (void);
|
||||
extern DRAW_STATE SetContextDrawState (DRAW_STATE DrawState);
|
||||
extern COLOR SetContextForeGroundColor (COLOR Color);
|
||||
extern COLOR SetContextBackGroundColor (COLOR Color);
|
||||
extern FRAME SetContextFGFrame (FRAME Frame);
|
||||
extern FRAME SetContextBGFrame (FRAME Frame);
|
||||
extern BG_FUNC SetContextBGFunc (BG_FUNC BGFunc);
|
||||
extern BOOLEAN SetContextClipping (BOOLEAN ClipStatus);
|
||||
extern BOOLEAN SetContextClipRect (PRECT pRect);
|
||||
extern BOOLEAN GetContextClipRect (PRECT pRect);
|
||||
@@ -306,14 +239,11 @@ extern TIME_VALUE DrawablesIntersect (PINTERSECT_CONTROL pControl0,
|
||||
PINTERSECT_CONTROL pControl1, TIME_VALUE max_time_val);
|
||||
extern void DrawStamp (PSTAMP pStamp);
|
||||
extern void DrawFilledStamp (PSTAMP pStamp);
|
||||
extern void DrawStampCMap (PSTAMP_CMAP pStampCmap);
|
||||
extern void DrawPoint (PPOINT pPoint);
|
||||
extern void DrawRectangle (PRECT pRect);
|
||||
extern void DrawFilledRectangle (PRECT pRect);
|
||||
extern void DrawLine (PLINE pLine);
|
||||
extern void font_DrawText (PTEXT pText);
|
||||
extern void DrawPolygon (POLYGON Polygon);
|
||||
extern void DrawFilledPolygon (POLYGON Polygon);
|
||||
extern void DrawBatch (PPRIMITIVE pBasePrim, PRIM_LINKS PrimLinks,
|
||||
BATCH_FLAGS BatchFlags);
|
||||
extern void BatchGraphics (void);
|
||||
@@ -335,7 +265,6 @@ extern HOT_SPOT SetFrameHot (FRAME Frame, HOT_SPOT HotSpot);
|
||||
extern HOT_SPOT GetFrameHot (FRAME Frame);
|
||||
extern BOOLEAN InstallGraphicResTypes (COUNT cel_type, COUNT font_type);
|
||||
extern DWORD LoadCelFile (PVOID pStr);
|
||||
extern DWORD LoadFontFile (PVOID pStr);
|
||||
extern DWORD LoadGraphicInstance (DWORD res);
|
||||
extern DWORD LoadGraphic (DWORD res);
|
||||
extern DRAWABLE LoadDisplayPixmap (PRECT area, FRAME frame);
|
||||
@@ -354,34 +283,12 @@ extern FRAME SetEquFrameIndex (FRAME DstFrame, FRAME SrcFrame);
|
||||
extern FRAME IncFrameIndex (FRAME Frame);
|
||||
extern FRAME DecFrameIndex (FRAME Frame);
|
||||
|
||||
extern void XFlipFrame (FRAME Frame);
|
||||
extern FRAME CaptureDrawable (DRAWABLE Drawable);
|
||||
|
||||
extern DRAWABLE ReleaseDrawable (FRAME Frame);
|
||||
|
||||
extern MEM_HANDLE GetFrameHandle (FRAME Frame);
|
||||
|
||||
extern POLYREF CreatePolygon (COUNT PtCount);
|
||||
extern POLYGON CapturePolygon (POLYREF PolyRef);
|
||||
extern BOOLEAN SetPolygonPoint (POLYGON Polygon, COUNT PtIndex, COORD x,
|
||||
COORD y);
|
||||
extern BOOLEAN GetPolygonPoint (POLYGON Polygon, COUNT PtIndex, PCOORD
|
||||
px, PCOORD py);
|
||||
extern POLYREF ReleasePolygon (POLYGON Polygon);
|
||||
extern BOOLEAN DestroyPolygon (POLYREF PolyRef);
|
||||
|
||||
extern DRAWABLE CreateOverlayWindow (CREATE_FLAGS CreateFlags, FRAME
|
||||
Display, SIZE height);
|
||||
extern void ShowOverlayWin (FRAME WinFrame, COUNT TimeInterval);
|
||||
extern void HideOverlayWin (FRAME WinFrame, COUNT TimeInterval);
|
||||
extern BOOLEAN DestroyOverlayWindow (FRAME Display, DRAWABLE Drawable);
|
||||
extern void ScrollDisplay (FRAME Display, COORD x, COORD y);
|
||||
|
||||
extern BOOLEAN ReadColorMap (COLORMAPPTR ColorMapPtr);
|
||||
extern BOOLEAN SetColorMap (COLORMAPPTR ColorMapPtr);
|
||||
extern BOOLEAN BatchColorMap (COLORMAPPTR ColorMapPtr);
|
||||
extern CYCLE_REF CycleColorMap (COLORMAPPTR ColorMapPtr, COUNT Cycles,
|
||||
SIZE TimeInterval);
|
||||
extern void StopCycleColorMap (CYCLE_REF CycleRef);
|
||||
extern DWORD XFormColorMap (COLORMAPPTR ColorMapPtr, SIZE TimeInterval);
|
||||
extern void FlushColorXForms (void);
|
||||
#define InitColorMapResources InitStringTableResources
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
uqm_SUBDIRS="sdl"
|
||||
uqm_CFILES="boxint.c clipline.c cmap.c context.c drawable.c filegfx.c
|
||||
font.c frame.c gfx_common.c intersec.c line.c loaddisp.c makepoly.c
|
||||
map.c pixmap.c poly.c rect.c resgfx.c stamp.c tfb_draw.c"
|
||||
font.c frame.c gfx_common.c intersec.c loaddisp.c
|
||||
pixmap.c resgfx.c tfb_draw.c tfb_prim.c"
|
||||
|
||||
@@ -68,12 +68,6 @@ void TFB_ColorMapToRGB (TFB_Palette *pal, int colormap_index)
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
BatchColorMap (COLORMAPPTR ColorMapPtr)
|
||||
{
|
||||
return (SetColorMap (ColorMapPtr));
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
SetColorMap (COLORMAPPTR map)
|
||||
{
|
||||
|
||||
@@ -56,7 +56,6 @@ SetContext (CONTEXT Context)
|
||||
SetPrimColor (&_locPrim, _get_context_fg_color ());
|
||||
|
||||
_CurFramePtr = (FRAMEPTR)_get_context_fg_frame ();
|
||||
BGFrame = _get_context_bg_frame ();
|
||||
_CurFontPtr = (FONTPTR)_get_context_font ();
|
||||
}
|
||||
}
|
||||
@@ -76,8 +75,6 @@ CreateContext (void)
|
||||
|
||||
/* initialize context */
|
||||
OldContext = SetContext (CaptureContext (ContextRef));
|
||||
SetContextMapType (MAP_NOXFORM);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
SetContextForeGroundColor (
|
||||
BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F)
|
||||
);
|
||||
@@ -134,32 +131,6 @@ ReleaseContext (CONTEXT Context)
|
||||
return (0);
|
||||
}
|
||||
|
||||
DRAW_STATE
|
||||
GetContextDrawState (void)
|
||||
{
|
||||
if (!ContextActive ())
|
||||
return (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
return (_get_context_draw_state ());
|
||||
}
|
||||
|
||||
DRAW_STATE
|
||||
SetContextDrawState (DRAW_STATE DrawState)
|
||||
{
|
||||
DRAW_STATE oldState;
|
||||
|
||||
if (!ContextActive ())
|
||||
return (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
if ((oldState = _get_context_draw_state ()) != DrawState)
|
||||
{
|
||||
SwitchContextDrawState (DrawState);
|
||||
SetContextGraphicsFunctions ();
|
||||
}
|
||||
|
||||
return (oldState);
|
||||
}
|
||||
|
||||
COLOR
|
||||
SetContextForeGroundColor (COLOR Color)
|
||||
{
|
||||
@@ -193,22 +164,6 @@ SetContextBackGroundColor (COLOR Color)
|
||||
return (oldColor);
|
||||
}
|
||||
|
||||
BG_FUNC
|
||||
SetContextBGFunc (BG_FUNC BGFunc)
|
||||
{
|
||||
BG_FUNC oldBGFunc;
|
||||
|
||||
if (!ContextActive ())
|
||||
return (0);
|
||||
|
||||
if ((oldBGFunc = _get_context_bg_func ()) != BGFunc)
|
||||
{
|
||||
SwitchContextBGFunc (BGFunc);
|
||||
}
|
||||
|
||||
return (oldBGFunc);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
SetContextClipping (BOOLEAN ClipStatus)
|
||||
{
|
||||
|
||||
@@ -19,38 +19,16 @@
|
||||
#ifndef _CONTEXT_H
|
||||
#define _CONTEXT_H
|
||||
|
||||
#ifdef MAPPING
|
||||
typedef struct
|
||||
{
|
||||
MAP_TYPE MapType;
|
||||
EXTENT ViewExt; /* Device units per inch */
|
||||
EXTENT WinExt; /* Logical units per inch */
|
||||
POINT WinOrg;
|
||||
/* Translation to device units relative to
|
||||
* (0, 0) is as follows:
|
||||
* x_du = (x_lu - WinOrg.x) * ViewExt.x / WinExt.x;
|
||||
* y_du = (y_lu - WinOrg.y) * ViewExt.y / WinExt.y;
|
||||
*/
|
||||
} MAP_INFO;
|
||||
typedef MAP_INFO *PMAP_INFO;
|
||||
#endif /* MAPPING */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CONTEXT_REF ContextRef;
|
||||
UWORD Flags;
|
||||
|
||||
DRAW_STATE DrawState;
|
||||
COLOR ForeGroundColor, BackGroundColor;
|
||||
FRAME ForeGroundFrame, BackGroundFrame;
|
||||
void (**func_array) (PRECT pClipRect, PPRIMITIVE PrimPtr);
|
||||
FRAME ForeGroundFrame;
|
||||
FONT Font;
|
||||
BG_FUNC BackGroundFunc;
|
||||
|
||||
RECT ClipRect;
|
||||
#ifdef MAPPING
|
||||
MAP_INFO Map;
|
||||
#endif /* MAPPING */
|
||||
} CONTEXT_DESC;
|
||||
typedef CONTEXT_DESC *PCONTEXT_DESC;
|
||||
|
||||
@@ -70,41 +48,9 @@ extern PRIMITIVE _locPrim;
|
||||
|
||||
#define _get_context_fg_color() (_pCurContext->ForeGroundColor)
|
||||
#define _get_context_bg_color() (_pCurContext->BackGroundColor)
|
||||
#define _get_context_draw_state() (_pCurContext->DrawState)
|
||||
#define _get_context_draw_dest() ((DRAW_DESTINATION)(_pCurContext->DrawState & 0xFF00))
|
||||
#define _get_context_draw_mode() ((DRAW_MODE)LOBYTE (_pCurContext->DrawState))
|
||||
#define _get_context_flags() (_pCurContext->Flags)
|
||||
#define _get_context_fg_frame() (_pCurContext->ForeGroundFrame)
|
||||
#define _get_context_bg_frame() (_pCurContext->BackGroundFrame)
|
||||
#define _get_context_font() (_pCurContext->Font)
|
||||
#define _get_context_bg_func() (_pCurContext->BackGroundFunc)
|
||||
|
||||
#ifdef MAPPING
|
||||
#define _get_context_map_type() (_pCurContext->Map.MapType)
|
||||
#define _init_context_map(pmt) \
|
||||
COORD worg_x, worg_y; \
|
||||
SIZE vext_w, vext_h, wext_w, wext_h; \
|
||||
\
|
||||
if ((*(pmt) = _get_context_map_type ()) != MAP_NOXFORM) \
|
||||
worg_x = _pCurContext->Map.WinOrg.x, \
|
||||
worg_y = _pCurContext->Map.WinOrg.y, \
|
||||
vext_w = _pCurContext->Map.ViewExt.width, \
|
||||
vext_h = _pCurContext->Map.ViewExt.height, \
|
||||
wext_w = _pCurContext->Map.WinExt.width, \
|
||||
wext_h = _pCurContext->Map.WinExt.height
|
||||
#define _uninit_context_map()
|
||||
#define LXtoDX(x) ((((x) - worg_x) * vext_w) / wext_w)
|
||||
#define LYtoDY(y) ((((y) - worg_y) * vext_h) / wext_h)
|
||||
#define DXtoLX(x) ((((x) * wext_w) / vext_w) + worg_x)
|
||||
#define DYtoLY(y) ((((y) * wext_h) / vext_h) + worg_y)
|
||||
#define SwitchContextMapType(t) \
|
||||
{ \
|
||||
_pCurContext->Map.MapType = (t); \
|
||||
}
|
||||
#define SwitchContextWinOrigin(org) (_pCurContext->Map.WinOrg = *(org))
|
||||
#define SwitchContextViewExtents(ext) (_pCurContext->Map.ViewExt = *(ext))
|
||||
#define SwitchContextWinExtents(ext) (_pCurContext->Map.WinExt = *(ext))
|
||||
#endif /* MAPPING */
|
||||
|
||||
#define SwitchContextDrawState(s) \
|
||||
{ \
|
||||
@@ -130,10 +76,6 @@ extern PRIMITIVE _locPrim;
|
||||
{ \
|
||||
_pCurContext->ForeGroundFrame = (f); \
|
||||
}
|
||||
#define SwitchContextBGFrame(f) \
|
||||
{ \
|
||||
_pCurContext->BackGroundFrame = (f); \
|
||||
}
|
||||
#define SwitchContextFont(f) \
|
||||
{ \
|
||||
_pCurContext->Font = (f); \
|
||||
@@ -144,13 +86,15 @@ extern PRIMITIVE _locPrim;
|
||||
}
|
||||
|
||||
/*
|
||||
These seem to have been moved to gfxlib.h, but not in their
|
||||
entirety. That's rather unpleasant. -- Michael
|
||||
|
||||
#define BATCH_BUILD_PAGE (BATCH_FLAGS)(1 << 0)
|
||||
#define BATCH_SINGLE (BATCH_FLAGS)(1 << 1)
|
||||
#define BATCH_UPDATE_DRAWABLE (BATCH_FLAGS)(1 << 2)
|
||||
*/
|
||||
#define BATCH_CLIP_GRAPHICS (BATCH_FLAGS)(1 << 3)
|
||||
#define BATCH_XFORM (BATCH_FLAGS)(1 << 4)
|
||||
#define BATCH_DIRTY_TILES (BATCH_FLAGS)(1 << 7)
|
||||
|
||||
typedef BYTE GRAPHICS_STATUS;
|
||||
|
||||
@@ -176,14 +120,14 @@ extern GRAPHICS_STATUS _GraphicsStatusFlags;
|
||||
#define DrawableActive() (_GraphicsStatusFlags & DRAWABLE_ACTIVE)
|
||||
|
||||
#define SYSTEM_ACTIVE (GRAPHICS_STATUS)( \
|
||||
DISPLAY_ACTIVE | CONTEXT_ACTIVE | \
|
||||
DRAWABLE_ACTIVE \
|
||||
)
|
||||
DISPLAY_ACTIVE | CONTEXT_ACTIVE | \
|
||||
DRAWABLE_ACTIVE \
|
||||
)
|
||||
#define GraphicsSystemActive() \
|
||||
((_GraphicsStatusFlags & SYSTEM_ACTIVE) == SYSTEM_ACTIVE)
|
||||
#define GraphicsStatus() \
|
||||
(_GraphicsStatusFlags & (GRAPHICS_STATUS)(GRAPHICS_ACTIVE \
|
||||
| GRAPHICS_VISIBLE))
|
||||
| GRAPHICS_VISIBLE))
|
||||
|
||||
#endif /* _CONTEXT_H */
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@ typedef struct
|
||||
|
||||
void (*read_display) (PRECT pRect, FRAMEPTR DstFramePtr);
|
||||
|
||||
void (**graphics_func_array) (PRECT pClipRect, PRIMITIVEPTR
|
||||
PrimPtr);
|
||||
} DISPLAY_INTERFACE;
|
||||
typedef DISPLAY_INTERFACE *PDISPLAY_INTERFACE;
|
||||
|
||||
@@ -49,26 +47,12 @@ extern void (* mask_func_array[]) (PRECT pClipRect,
|
||||
PRIMITIVEPTR PrimPtr);
|
||||
|
||||
#define AllocDrawableImage (*_pCurDisplay->alloc_image)
|
||||
#define DrawGraphicsFunc(pRect,pPtr) \
|
||||
(*_pCurContext->func_array[GetPrimType(pPtr)]) (pRect, (PRIMITIVEPTR)(pPtr))
|
||||
#define ReadDisplay (*_pCurDisplay->read_display)
|
||||
extern void _bitplane_blt (PRECT pClipRect, FRAMEPTR
|
||||
DstFramePtr, COORD src_x, COORD src_y, FRAMEPTR
|
||||
SrcFramePtr, DRAW_MODE DrawMode);
|
||||
|
||||
#define GetDisplayFlags() (_pCurDisplay->DisplayFlags)
|
||||
#define GetDisplayDepth() (_pCurDisplay->DisplayDepth)
|
||||
#define GetDisplayWidth() (_pCurDisplay->DisplayWidth)
|
||||
#define GetDisplayHeight() (_pCurDisplay->DisplayHeight)
|
||||
|
||||
#define SetContextGraphicsFunctions() \
|
||||
do \
|
||||
{ \
|
||||
if (_get_context_draw_dest () == DEST_MASK) \
|
||||
_pCurContext->func_array = mask_func_array; \
|
||||
else \
|
||||
_pCurContext->func_array = _pCurDisplay->graphics_func_array; \
|
||||
} while (0)
|
||||
|
||||
#endif /* _DISPLAY_H */
|
||||
|
||||
|
||||
@@ -37,26 +37,12 @@ SetContextFGFrame (FRAME Frame)
|
||||
if (ContextActive ())
|
||||
{
|
||||
SwitchContextFGFrame (Frame);
|
||||
SetContextGraphicsFunctions ();
|
||||
}
|
||||
}
|
||||
|
||||
return (LastFrame);
|
||||
}
|
||||
|
||||
FRAME
|
||||
SetContextBGFrame (FRAME Frame)
|
||||
{
|
||||
FRAME LastFrame;
|
||||
|
||||
LastFrame = BGFrame;
|
||||
BGFrame = Frame;
|
||||
if (ContextActive ())
|
||||
SwitchContextBGFrame (Frame);
|
||||
|
||||
return (LastFrame);
|
||||
}
|
||||
|
||||
DRAWABLE
|
||||
CreateDisplay (CREATE_FLAGS CreateFlags, PSIZE pwidth, PSIZE pheight)
|
||||
{
|
||||
@@ -180,8 +166,6 @@ DestroyDrawable (DRAWABLE Drawable)
|
||||
|
||||
if (LOWORD (Drawable) == GetFrameHandle (_CurFramePtr))
|
||||
SetContextFGFrame ((FRAME)0);
|
||||
if (LOWORD (Drawable) == GetFrameHandle (BGFrame))
|
||||
SetContextBGFrame ((FRAME)0);
|
||||
|
||||
DrawablePtr = LockDrawable (Drawable);
|
||||
if (DrawablePtr)
|
||||
|
||||
@@ -119,27 +119,6 @@ typedef DRAWABLE_DESC *PDRAWABLE_DESC;
|
||||
#define TYPE_SET(f,t) ((f)|=t)
|
||||
#define INDEX_SET(f,i) ((f)|=i)
|
||||
|
||||
typedef struct polygon_desc
|
||||
{
|
||||
RECT BoundRect;
|
||||
|
||||
POLYREF hPoly;
|
||||
|
||||
COUNT PtCount;
|
||||
PPOINT PtList;
|
||||
} POLYGON_DESC;
|
||||
typedef POLYGON_DESC *PPOLYGON_DESC;
|
||||
|
||||
#define POLYGON_PRIORITY DEFAULT_MEM_PRIORITY
|
||||
|
||||
#define AllocPolygon(n) \
|
||||
mem_allocate ((MEM_SIZE)(sizeof (POLYGON_DESC) + \
|
||||
(sizeof (POINT) * (n))), MEM_ZEROINIT, \
|
||||
POLYGON_PRIORITY, MEM_SIMPLE)
|
||||
#define LockPolygon(Polygon) (PPOLYGON_DESC)mem_lock (Polygon)
|
||||
#define UnlockPolygon(Polygon) mem_unlock (Polygon)
|
||||
#define FreePolygon(Polygon) mem_release (Polygon)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RECT Box;
|
||||
@@ -162,12 +141,10 @@ typedef PSTAMP STAMPPTR;
|
||||
typedef PTEXT TEXTPTR;
|
||||
|
||||
extern STAMP _save_stamp;
|
||||
#define BGFrame _save_stamp.frame
|
||||
extern FRAMEPTR _CurFramePtr;
|
||||
|
||||
extern void _rect_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr);
|
||||
extern void _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr);
|
||||
extern void _fillpoly_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr);
|
||||
|
||||
#endif /* _DRAWABLE_H */
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef struct tfb_dc_img
|
||||
int x, y;
|
||||
SCREEN destBuffer;
|
||||
BOOLEAN UsePalette;
|
||||
BOOLEAN UseScaling;
|
||||
int scale;
|
||||
} TFB_DrawCommand_Image;
|
||||
|
||||
typedef struct tfb_dc_filledimg
|
||||
@@ -68,7 +68,7 @@ typedef struct tfb_dc_filledimg
|
||||
int x, y;
|
||||
int r, g, b;
|
||||
SCREEN destBuffer;
|
||||
BOOLEAN UseScaling;
|
||||
int scale;
|
||||
} TFB_DrawCommand_FilledImage;
|
||||
|
||||
typedef struct tfb_dc_copy
|
||||
|
||||
@@ -43,28 +43,3 @@ LoadCelFile (PVOID pStr)
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
DWORD
|
||||
LoadFontFile (PVOID pStr)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
// FIXME: this theoretically needs a mechanism to prevent races
|
||||
if (_cur_resfile_name)
|
||||
// something else is loading resources atm
|
||||
return 0;
|
||||
|
||||
if ((fp = res_OpenResFile (pStr, "rb")) != NULL)
|
||||
{
|
||||
MEM_HANDLE hData;
|
||||
|
||||
_cur_resfile_name = pStr;
|
||||
hData = _GetFontData (fp, LengthResFile (fp));
|
||||
_cur_resfile_name = 0;
|
||||
res_CloseResFile (fp);
|
||||
return ((DWORD)hData);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -221,12 +221,17 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||
UNICODE next_ch, *pStr;
|
||||
TEXTPTR TextPtr;
|
||||
PRIMITIVE locPrim;
|
||||
TFB_Palette color;
|
||||
DWORD c32k;
|
||||
|
||||
if (FontEffect.Use)
|
||||
SetPrimType (&locPrim, STAMP_PRIM);
|
||||
else
|
||||
SetPrimType (&locPrim, STAMPFILL_PRIM);
|
||||
SetPrimColor (&locPrim, _get_context_fg_color ());
|
||||
c32k = _get_context_fg_color () >> 8;
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
|
||||
TextPtr = &PrimPtr->Object.Text;
|
||||
locPrim.Object.Stamp.origin.x = _save_stamp.origin.x;
|
||||
@@ -265,12 +270,12 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||
locPrim.Object.Stamp.frame = Build_Font_Effect(
|
||||
locPrim.Object.Stamp.frame,
|
||||
FontEffect.from, FontEffect.to, FontEffect.type);
|
||||
DrawGraphicsFunc (&r, &locPrim);
|
||||
TFB_Prim_Stamp (&locPrim.Object.Stamp);
|
||||
DestroyDrawable (ReleaseDrawable (locPrim.Object.Stamp.frame));
|
||||
locPrim.Object.Stamp.frame = origFrame;
|
||||
}
|
||||
else
|
||||
DrawGraphicsFunc (&r, &locPrim);
|
||||
TFB_Prim_StampFill (&locPrim.Object.Stamp, &color);
|
||||
}
|
||||
|
||||
locPrim.Object.Stamp.origin.x += GetFrameWidth (locPrim.Object.Stamp.frame);
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
|
||||
#include "gfxintrn.h"
|
||||
#include "declib.h"
|
||||
#include "gfx_common.h"
|
||||
#include "tfb_draw.h"
|
||||
#include "tfb_prim.h"
|
||||
|
||||
typedef union
|
||||
{
|
||||
@@ -25,16 +28,7 @@ typedef union
|
||||
STAMP Stamp;
|
||||
BRESENHAM_LINE Line;
|
||||
TEXT Text;
|
||||
STAMP_CMAP StampCMap;
|
||||
RECT Rect;
|
||||
POLYGON_DESC Polygon;
|
||||
struct
|
||||
{
|
||||
POINT origin;
|
||||
FRAME frame;
|
||||
COUNT NumFrames;
|
||||
PFRAME FrameList;
|
||||
} Composite;
|
||||
} INTERNAL_PRIM_DESC;
|
||||
typedef INTERNAL_PRIM_DESC *PINTERNAL_PRIM_DESC;
|
||||
|
||||
@@ -83,40 +77,14 @@ GetFrameValidRect (PRECT pValidRect, HOT_SPOT *pOldHot)
|
||||
void
|
||||
ClearBackGround (PRECT pClipRect)
|
||||
{
|
||||
if (_get_context_bg_func ())
|
||||
{
|
||||
(*_get_context_bg_func ()) (pClipRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
RECT locRect;
|
||||
PRIMITIVE locPrim;
|
||||
TFB_Palette color;
|
||||
DWORD c32k;
|
||||
|
||||
locPrim.Object.Rect = *pClipRect;
|
||||
if (BGFrame == 0)
|
||||
{
|
||||
SetPrimColor (&locPrim, _get_context_bg_color ());
|
||||
SetPrimType (&locPrim, RECTFILL_PRIM);
|
||||
}
|
||||
else
|
||||
{
|
||||
locRect.corner.x = -GetFrameHotX (BGFrame);
|
||||
locRect.corner.y = -GetFrameHotY (BGFrame);
|
||||
locRect.extent.width = GetFrameWidth (BGFrame);
|
||||
locRect.extent.height = GetFrameHeight (BGFrame);
|
||||
_save_stamp.origin = locRect.corner;
|
||||
|
||||
if (!BoxIntersect (&locRect, &locPrim.Object.Rect, &locRect))
|
||||
return;
|
||||
|
||||
pClipRect = &locRect;
|
||||
SetPrimType (&locPrim, STAMP_PRIM);
|
||||
SetPrimColor (&locPrim, _get_context_bg_color ());
|
||||
locPrim.Object.Stamp = _save_stamp;
|
||||
}
|
||||
|
||||
DrawGraphicsFunc (pClipRect, &locPrim);
|
||||
}
|
||||
c32k = _get_context_bg_color () >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
TFB_Prim_FillRect (pClipRect, &color);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -128,17 +96,9 @@ DrawBatch (PPRIMITIVE lpBasePrim, PRIM_LINKS PrimLinks, register
|
||||
|
||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
||||
{
|
||||
int frame_dir;
|
||||
COUNT CurIndex;
|
||||
PRIM_LINKS OldLinks;
|
||||
register PPRIMITIVE lpPrim;
|
||||
#ifdef MAPPING
|
||||
MAP_TYPE MapType;
|
||||
|
||||
_init_context_map (&MapType);
|
||||
if (MapType != MAP_NOXFORM)
|
||||
BatchFlags |= BATCH_XFORM;
|
||||
#endif /* MAPPING */
|
||||
|
||||
BatchFlags &= BATCH_SINGLE
|
||||
| BATCH_BUILD_PAGE
|
||||
@@ -148,20 +108,12 @@ DrawBatch (PPRIMITIVE lpBasePrim, PRIM_LINKS PrimLinks, register
|
||||
|
||||
BatchGraphics ();
|
||||
|
||||
frame_dir = ((GetDisplayFlags () & WANT_MASK)
|
||||
&& _get_context_draw_mode () == DRAW_SUBTRACTIVE) ? -1 : 1;
|
||||
if (BatchFlags & BATCH_BUILD_PAGE)
|
||||
{
|
||||
if (frame_dir == 1)
|
||||
ClearBackGround (&ValidRect);
|
||||
ClearBackGround (&ValidRect);
|
||||
}
|
||||
else if (_get_context_draw_mode () == DRAW_ADDITIVE
|
||||
&& _get_context_bg_func ())
|
||||
BatchFlags |= BATCH_DIRTY_TILES;
|
||||
|
||||
CurIndex = frame_dir < 0
|
||||
? GetSuccLink (PrimLinks)
|
||||
: GetPredLink (PrimLinks);
|
||||
CurIndex = GetPredLink (PrimLinks);
|
||||
|
||||
if (BatchFlags & BATCH_SINGLE)
|
||||
{
|
||||
@@ -176,16 +128,14 @@ DrawBatch (PPRIMITIVE lpBasePrim, PRIM_LINKS PrimLinks, register
|
||||
}
|
||||
}
|
||||
|
||||
for (; CurIndex != END_OF_LIST;
|
||||
CurIndex = frame_dir < 0
|
||||
? GetPredLink (GetPrimLinks (lpPrim))
|
||||
: GetSuccLink (GetPrimLinks (lpPrim)))
|
||||
for (; CurIndex != END_OF_LIST; CurIndex = GetSuccLink (GetPrimLinks (lpPrim)))
|
||||
{
|
||||
register GRAPHICS_PRIM PrimType;
|
||||
PPRIMITIVE lpWorkPrim;
|
||||
RECT ClipRect;
|
||||
INTERNAL_PRIMITIVE Prim;
|
||||
FRAMEPTR SrcFramePtr;
|
||||
TFB_Palette color;
|
||||
DWORD c32k;
|
||||
|
||||
lpPrim = &lpBasePrim[CurIndex];
|
||||
PrimType = GetPrimType (lpPrim);
|
||||
@@ -193,134 +143,45 @@ DrawBatch (PPRIMITIVE lpBasePrim, PRIM_LINKS PrimLinks, register
|
||||
continue;
|
||||
|
||||
lpWorkPrim = lpPrim;
|
||||
#ifdef MAPPING
|
||||
if (BatchFlags & BATCH_XFORM)
|
||||
{
|
||||
COORD x, y;
|
||||
|
||||
Prim = *(PINTERNAL_PRIMITIVE)lpWorkPrim;
|
||||
lpWorkPrim = (PPRIMITIVE)&Prim;
|
||||
|
||||
x = LXtoDX (Prim.Object.Point.x);
|
||||
y = LYtoDY (Prim.Object.Point.y);
|
||||
if (PrimType == RECT_PRIM
|
||||
|| PrimType == RECTFILL_PRIM)
|
||||
{
|
||||
Prim.Object.Line.second.x =
|
||||
LXtoDX (Prim.Object.Rect.corner.x +
|
||||
Prim.Object.Rect.extent.width - 1);
|
||||
Prim.Object.Line.second.y =
|
||||
LYtoDY (Prim.Object.Rect.corner.y +
|
||||
Prim.Object.Rect.extent.height - 1);
|
||||
Prim.Object.Rect.extent.width = Prim.Object.Line.second.x - x + 1;
|
||||
Prim.Object.Rect.extent.height = Prim.Object.Line.second.y - y + 1;
|
||||
}
|
||||
|
||||
Prim.Object.Point.x = x;
|
||||
Prim.Object.Point.y = y;
|
||||
}
|
||||
#endif /* MAPPING */
|
||||
|
||||
switch (PrimType)
|
||||
{
|
||||
case POINT_PRIM:
|
||||
ClipRect.corner = lpWorkPrim->Object.Point;
|
||||
if ((BatchFlags & BATCH_CLIP_GRAPHICS)
|
||||
&& (ClipRect.corner.x < ValidRect.corner.x
|
||||
|| ClipRect.corner.y < ValidRect.corner.y
|
||||
|| ClipRect.corner.x >= ValidRect.corner.x
|
||||
+ ValidRect.extent.width
|
||||
|| ClipRect.corner.y >= ValidRect.corner.y
|
||||
+ ValidRect.extent.height))
|
||||
continue;
|
||||
ClipRect.extent.width = ClipRect.extent.height = 1;
|
||||
goto DoGraphics;
|
||||
case STAMPCMAP_PRIM:
|
||||
BatchColorMap (lpWorkPrim->Object.StampCMap.CMap);
|
||||
goto ProcessStamp;
|
||||
case COMPOSITE_PRIM:
|
||||
case COMPOSITEFILL_PRIM:
|
||||
Prim = *(PINTERNAL_PRIMITIVE)lpWorkPrim;
|
||||
if ((Prim.Object.Composite.FrameList =
|
||||
(PFRAME)Prim.Object.Composite.frame) == 0
|
||||
|| Prim.Object.Composite.NumFrames == 0)
|
||||
continue;
|
||||
if (frame_dir < 0)
|
||||
Prim.Object.Composite.FrameList +=
|
||||
Prim.Object.Composite.NumFrames - 1;
|
||||
lpWorkPrim = (PPRIMITIVE)&Prim;
|
||||
SetPrimType (lpWorkPrim,
|
||||
STAMP_PRIM + (PrimType - COMPOSITE_PRIM));
|
||||
ProcessComposite:
|
||||
Prim.Object.Composite.frame =
|
||||
*Prim.Object.Composite.FrameList;
|
||||
Prim.Object.Composite.FrameList += frame_dir;
|
||||
if (--Prim.Object.Composite.NumFrames == 0)
|
||||
PrimType = GetPrimType (&Prim);
|
||||
c32k = GetPrimColor (lpWorkPrim) >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
|
||||
TFB_Prim_Point (&lpWorkPrim->Object.Point, &color);
|
||||
break;
|
||||
case STAMP_PRIM:
|
||||
case STAMPFILL_PRIM:
|
||||
ProcessStamp:
|
||||
SrcFramePtr = (FRAMEPTR)(
|
||||
lpWorkPrim->Object.Stamp.frame
|
||||
);
|
||||
SrcFramePtr = (FRAMEPTR)(lpWorkPrim->Object.Stamp.frame);
|
||||
if (SrcFramePtr == 0)
|
||||
{
|
||||
if (PrimType >= COMPOSITE_PRIM)
|
||||
goto ProcessComposite;
|
||||
else
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
TFB_Prim_Stamp (&lpWorkPrim->Object.Stamp);
|
||||
break;
|
||||
case STAMPFILL_PRIM:
|
||||
SrcFramePtr = (FRAMEPTR)(lpWorkPrim->Object.Stamp.frame);
|
||||
if (SrcFramePtr == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ClipRect.corner = lpWorkPrim->Object.Stamp.origin;
|
||||
ClipRect.corner.x -= GetFrameHotX (SrcFramePtr);
|
||||
ClipRect.corner.y -= GetFrameHotY (SrcFramePtr);
|
||||
ClipRect.extent.width = GetFrameWidth (SrcFramePtr);
|
||||
ClipRect.extent.height = GetFrameHeight (SrcFramePtr);
|
||||
|
||||
_save_stamp.origin = ClipRect.corner;
|
||||
c32k = GetPrimColor (lpWorkPrim) >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
TFB_Prim_StampFill (&lpWorkPrim->Object.Stamp, &color);
|
||||
break;
|
||||
case LINE_PRIM:
|
||||
#ifdef MAPPING
|
||||
if (BatchFlags & BATCH_XFORM)
|
||||
{
|
||||
Prim.Object.Line.second.x = LXtoDX (Prim.Object.Line.second.x);
|
||||
Prim.Object.Line.second.y = LYtoDY (Prim.Object.Line.second.y);
|
||||
}
|
||||
else
|
||||
#endif /* MAPPING */
|
||||
{
|
||||
Prim = *(PINTERNAL_PRIMITIVE)lpWorkPrim;
|
||||
lpWorkPrim = (PPRIMITIVE)&Prim;
|
||||
}
|
||||
c32k = GetPrimColor (lpWorkPrim) >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
|
||||
if (Prim.Object.Line.second.x >= Prim.Object.Line.first.x)
|
||||
{
|
||||
ClipRect.corner.x = Prim.Object.Line.first.x;
|
||||
ClipRect.extent.width =
|
||||
Prim.Object.Line.second.x
|
||||
- Prim.Object.Line.first.x + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ClipRect.corner.x = Prim.Object.Line.second.x;
|
||||
ClipRect.extent.width =
|
||||
Prim.Object.Line.first.x
|
||||
- Prim.Object.Line.second.x + 1;
|
||||
}
|
||||
if (Prim.Object.Line.second.y >= Prim.Object.Line.first.y)
|
||||
{
|
||||
ClipRect.corner.y = Prim.Object.Line.first.y;
|
||||
ClipRect.extent.height =
|
||||
Prim.Object.Line.second.y
|
||||
- Prim.Object.Line.first.y + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ClipRect.corner.y = Prim.Object.Line.second.y;
|
||||
ClipRect.extent.height =
|
||||
Prim.Object.Line.first.y
|
||||
- Prim.Object.Line.second.y + 1;
|
||||
}
|
||||
TFB_Prim_Line (&lpWorkPrim->Object.Line, &color);
|
||||
break;
|
||||
case TEXT_PRIM:
|
||||
if (!TextRect (&lpWorkPrim->Object.Text,
|
||||
@@ -328,42 +189,23 @@ ProcessStamp:
|
||||
continue;
|
||||
|
||||
_save_stamp.origin = ClipRect.corner;
|
||||
|
||||
_text_blt (&ClipRect, lpWorkPrim);
|
||||
break;
|
||||
case RECT_PRIM:
|
||||
c32k = GetPrimColor (lpWorkPrim) >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
TFB_Prim_Rect (&lpWorkPrim->Object.Rect, &color);
|
||||
case RECTFILL_PRIM:
|
||||
ClipRect = lpWorkPrim->Object.Rect;
|
||||
break;
|
||||
case POLY_PRIM:
|
||||
case POLYFILL_PRIM:
|
||||
ClipRect = ((PPOLYGON_DESC)lpWorkPrim->Object.Polygon)->BoundRect;
|
||||
c32k = GetPrimColor (lpWorkPrim) >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
TFB_Prim_FillRect (&lpWorkPrim->Object.Rect, &color);
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if ((BatchFlags & BATCH_CLIP_GRAPHICS)
|
||||
&& BoxIntersect (&ClipRect,
|
||||
&ValidRect, &ClipRect) == 0)
|
||||
{
|
||||
if (PrimType >= COMPOSITE_PRIM)
|
||||
goto ProcessComposite;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
DoGraphics:
|
||||
if (BatchFlags & BATCH_DIRTY_TILES)
|
||||
(*_get_context_bg_func ()) (&ClipRect);
|
||||
|
||||
DrawGraphicsFunc (&ClipRect, lpWorkPrim);
|
||||
if (PrimType >= COMPOSITE_PRIM)
|
||||
goto ProcessComposite;
|
||||
}
|
||||
|
||||
if (BatchFlags & BATCH_BUILD_PAGE)
|
||||
{
|
||||
if (frame_dir < 0)
|
||||
ClearBackGround (&ValidRect);
|
||||
}
|
||||
|
||||
UnbatchGraphics ();
|
||||
@@ -375,9 +217,6 @@ DoGraphics:
|
||||
GetPredLink (OldLinks),
|
||||
GetSuccLink (OldLinks));
|
||||
|
||||
#ifdef MAPPING
|
||||
_uninit_context_map ();
|
||||
#endif /* MAPPING */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,3 +236,119 @@ ClearDrawable (void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DrawPoint (PPOINT lpPoint)
|
||||
{
|
||||
RECT ValidRect;
|
||||
HOT_SPOT OldHot;
|
||||
|
||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
||||
{
|
||||
TFB_Palette color;
|
||||
DWORD c32k;
|
||||
|
||||
c32k = GetPrimColor (&_locPrim) >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
|
||||
TFB_Prim_Point (lpPoint, &color);
|
||||
SetFrameHotSpot (_CurFramePtr, OldHot);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DrawRectangle (PRECT lpRect)
|
||||
{
|
||||
RECT ValidRect;
|
||||
HOT_SPOT OldHot;
|
||||
|
||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
||||
{
|
||||
TFB_Palette color;
|
||||
DWORD c32k;
|
||||
|
||||
c32k = GetPrimColor (&_locPrim) >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
|
||||
TFB_Prim_Rect (lpRect, &color);
|
||||
SetFrameHotSpot (_CurFramePtr, OldHot);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DrawFilledRectangle (PRECT lpRect)
|
||||
{
|
||||
RECT ValidRect;
|
||||
HOT_SPOT OldHot;
|
||||
|
||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
||||
{
|
||||
TFB_Palette color;
|
||||
DWORD c32k;
|
||||
|
||||
c32k = GetPrimColor (&_locPrim) >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
|
||||
TFB_Prim_FillRect (lpRect, &color);
|
||||
SetFrameHotSpot (_CurFramePtr, OldHot);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DrawLine (PLINE lpLine)
|
||||
{
|
||||
RECT ValidRect;
|
||||
HOT_SPOT OldHot;
|
||||
|
||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
||||
{
|
||||
TFB_Palette color;
|
||||
DWORD c32k;
|
||||
|
||||
c32k = GetPrimColor (&_locPrim) >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
|
||||
TFB_Prim_Line (lpLine, &color);
|
||||
SetFrameHotSpot (_CurFramePtr, OldHot);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DrawStamp (PSTAMP stmp)
|
||||
{
|
||||
RECT ValidRect;
|
||||
HOT_SPOT OldHot;
|
||||
|
||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
||||
{
|
||||
TFB_Prim_Stamp (stmp);
|
||||
SetFrameHotSpot (_CurFramePtr, OldHot);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DrawFilledStamp (PSTAMP stmp)
|
||||
{
|
||||
RECT ValidRect;
|
||||
HOT_SPOT OldHot;
|
||||
|
||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
||||
{
|
||||
TFB_Palette color;
|
||||
DWORD c32k;
|
||||
|
||||
c32k = GetPrimColor (&_locPrim) >> 8; //shift out color index
|
||||
color.r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
color.g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
color.b = (c32k << (8 - 5)) & 0xF8;
|
||||
TFB_Prim_StampFill (stmp, &color);
|
||||
SetFrameHotSpot (_CurFramePtr, OldHot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ void LoadIntoExtraScreen (PRECT r);
|
||||
void DrawFromExtraScreen (PRECT r);
|
||||
void SetGraphicGrabOther (int grab_other);
|
||||
void SetGraphicScale (int scale);
|
||||
int GetGraphicScale ();
|
||||
void SetGraphicUseOtherExtra (int other);
|
||||
void ScreenTransition (int transition, PRECT pRect);
|
||||
|
||||
|
||||
@@ -1,557 +0,0 @@
|
||||
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gfxintrn.h"
|
||||
|
||||
/* I don't know yet what the deal is with the __WATCOMC__ delimited
|
||||
* code, but this will at least make it compile, which is stage 1. - SvdB
|
||||
*/
|
||||
#define __WATCOMC__
|
||||
|
||||
#define AllocGraphicData(size) \
|
||||
mem_allocate ((MEM_SIZE)(size), MEM_ZEROINIT | MEM_GRAPHICS, \
|
||||
DEFAULT_MEM_PRIORITY, MEM_SIMPLE)
|
||||
#define LockData (PBYTE)mem_lock
|
||||
#define UnlockData mem_unlock
|
||||
#define FreeData mem_release
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UP,
|
||||
DOWN
|
||||
} DIRECTION;
|
||||
|
||||
#define POLY_XMIN 1
|
||||
#define POLY_YMIN 0
|
||||
|
||||
static void
|
||||
xor_dot (FRAMEPTR FramePtr, COORD x, COORD y)
|
||||
{
|
||||
PBYTE lpMaskAddr;
|
||||
|
||||
lpMaskAddr =
|
||||
#ifndef __WATCOMC__
|
||||
GetImageData (&FramePtr->MaskImage)
|
||||
+ (y * GetImageLineBytes (&FramePtr->MaskImage))
|
||||
+ BYTE_POS (x);
|
||||
#else /* __WATCOMC__ */
|
||||
0;
|
||||
#endif /* __WATCOMC__ */
|
||||
*lpMaskAddr ^= (BYTE)0x80 >> BYTE_OFFS (x);
|
||||
}
|
||||
|
||||
static void
|
||||
xor_line (FRAMEPTR FramePtr, PBRESENHAM_LINE pLine)
|
||||
{
|
||||
COORD dst_x, dst_y;
|
||||
COORD dst_mask_x;
|
||||
SIZE dst_mask_incr;
|
||||
SIZE count;
|
||||
BYTE dst_bit, bit_shift;
|
||||
SIZE delta_x, delta_y, error_term;
|
||||
PBYTE lpMaskAddr;
|
||||
|
||||
dst_x = pLine->first.x;
|
||||
dst_y = pLine->first.y;
|
||||
delta_x = pLine->abs_delta_x;
|
||||
delta_y = pLine->abs_delta_y;
|
||||
error_term = pLine->error_term;
|
||||
|
||||
dst_mask_x = dst_x;
|
||||
bit_shift = 1;
|
||||
|
||||
#ifndef __WATCOMC__
|
||||
lpMaskAddr = GetImageData (&FramePtr->MaskImage);
|
||||
dst_mask_incr = GetImageLineBytes (&FramePtr->MaskImage);
|
||||
lpMaskAddr += (dst_y * dst_mask_incr) + BYTE_POS (dst_mask_x);
|
||||
#endif /* __WATCOMC__ */
|
||||
|
||||
if (delta_y < 0)
|
||||
{
|
||||
delta_y = -delta_y;
|
||||
dst_mask_incr = -dst_mask_incr;
|
||||
}
|
||||
|
||||
dst_bit = (BYTE)((BYTE)0x80 >> (BYTE)BYTE_OFFS (dst_mask_x));
|
||||
if (delta_x > delta_y)
|
||||
{
|
||||
count = pLine->second.x - pLine->first.x;
|
||||
if (!pLine->end_points_exchanged)
|
||||
{
|
||||
do
|
||||
{
|
||||
if ((error_term += delta_y) >= 0)
|
||||
{
|
||||
*lpMaskAddr ^= dst_bit;
|
||||
if (count == 0)
|
||||
break;
|
||||
|
||||
lpMaskAddr += dst_mask_incr;
|
||||
error_term -= delta_x;
|
||||
}
|
||||
if ((dst_bit >>= bit_shift) == 0)
|
||||
{
|
||||
dst_bit = (BYTE)0x80;
|
||||
++lpMaskAddr;
|
||||
}
|
||||
} while (count--);
|
||||
|
||||
if (error_term < 0)
|
||||
{
|
||||
if ((dst_bit <<= bit_shift) == 0)
|
||||
{
|
||||
dst_bit = (BYTE)0x01;
|
||||
--lpMaskAddr;
|
||||
}
|
||||
*lpMaskAddr ^= dst_bit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*lpMaskAddr ^= dst_bit;
|
||||
do
|
||||
{
|
||||
if ((dst_bit >>= bit_shift) == 0)
|
||||
{
|
||||
dst_bit = (BYTE)0x80;
|
||||
++lpMaskAddr;
|
||||
}
|
||||
if ((error_term += delta_y) >= 0)
|
||||
{
|
||||
if (count == 0)
|
||||
break;
|
||||
|
||||
lpMaskAddr += dst_mask_incr;
|
||||
*lpMaskAddr ^= dst_bit;
|
||||
error_term -= delta_x;
|
||||
}
|
||||
} while (count--);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((count = pLine->second.y - pLine->first.y) < 0)
|
||||
count = -count;
|
||||
|
||||
do
|
||||
{
|
||||
*lpMaskAddr ^= dst_bit;
|
||||
lpMaskAddr += dst_mask_incr;
|
||||
if ((error_term += delta_x) >= 0)
|
||||
{
|
||||
if ((dst_bit >>= bit_shift) == 0)
|
||||
{
|
||||
dst_bit = (BYTE)0x80;
|
||||
++lpMaskAddr;
|
||||
}
|
||||
error_term -= delta_y;
|
||||
}
|
||||
} while (count--);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
or_line (FRAMEPTR FramePtr, PBRESENHAM_LINE pLine)
|
||||
{
|
||||
COORD dst_x, dst_y;
|
||||
COORD dst_mask_x;
|
||||
SIZE dst_mask_incr;
|
||||
SIZE delta_x, delta_y, error_term, count;
|
||||
BYTE dst_bit, dst_byte, bit_mask, bit_shift;
|
||||
PBYTE lpMaskAddr;
|
||||
|
||||
dst_x = pLine->first.x;
|
||||
dst_y = pLine->first.y;
|
||||
delta_x = pLine->abs_delta_x;
|
||||
delta_y = pLine->abs_delta_y;
|
||||
error_term = pLine->error_term;
|
||||
|
||||
dst_mask_x = dst_x;
|
||||
bit_mask = (BYTE)0x80;
|
||||
bit_shift = 1;
|
||||
|
||||
#ifndef __WATCOMC__
|
||||
lpMaskAddr = GetImageData (&FramePtr->MaskImage);
|
||||
dst_mask_incr = GetImageLineBytes (&FramePtr->MaskImage);
|
||||
lpMaskAddr += (dst_y * dst_mask_incr) + BYTE_POS (dst_mask_x);
|
||||
#endif /* __WATCOMC__ */
|
||||
|
||||
if (delta_y < 0)
|
||||
{
|
||||
delta_y = -delta_y;
|
||||
dst_mask_incr = -dst_mask_incr;
|
||||
}
|
||||
|
||||
dst_bit = (BYTE)(bit_mask >> BYTE_OFFS (dst_mask_x));
|
||||
if (delta_x > delta_y)
|
||||
{
|
||||
count = pLine->second.x - pLine->first.x;
|
||||
dst_byte = 0;
|
||||
do
|
||||
{
|
||||
dst_byte |= dst_bit;
|
||||
if ((dst_bit >>= bit_shift) == 0)
|
||||
{
|
||||
dst_bit = bit_mask;
|
||||
*lpMaskAddr++ |= dst_byte;
|
||||
dst_byte = 0;
|
||||
}
|
||||
if ((error_term += delta_y) >= 0)
|
||||
{
|
||||
if (dst_byte)
|
||||
{
|
||||
*lpMaskAddr |= dst_byte;
|
||||
dst_byte = 0;
|
||||
}
|
||||
lpMaskAddr += dst_mask_incr;
|
||||
error_term -= delta_x;
|
||||
}
|
||||
} while (count--);
|
||||
if (dst_byte)
|
||||
*lpMaskAddr |= dst_byte;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((count = pLine->second.y - pLine->first.y) < 0)
|
||||
count = -count;
|
||||
do
|
||||
{
|
||||
*lpMaskAddr |= dst_bit;
|
||||
lpMaskAddr += dst_mask_incr;
|
||||
if ((error_term += delta_x) >= 0)
|
||||
{
|
||||
if ((dst_bit >>= bit_shift) == 0)
|
||||
{
|
||||
dst_bit = bit_mask;
|
||||
++lpMaskAddr;
|
||||
}
|
||||
error_term -= delta_y;
|
||||
}
|
||||
} while (count--);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_off (FRAMEPTR FramePtr)
|
||||
{
|
||||
register SIZE width, height;
|
||||
register SIZE dst_mask_incr;
|
||||
register PBYTE lpScan;
|
||||
|
||||
width = GetFrameWidth (FramePtr);
|
||||
height = GetFrameHeight (FramePtr);
|
||||
#ifndef __WATCOMC__
|
||||
lpScan = GetImageData (&FramePtr->MaskImage);
|
||||
dst_mask_incr = GetImageLineBytes (&FramePtr->MaskImage);
|
||||
#endif /* __WATCOMC__ */
|
||||
width = BYTE_WIDTH (width);
|
||||
|
||||
do
|
||||
{
|
||||
register SIZE byte_width;
|
||||
register BYTE mask_byte, bit;
|
||||
register PBYTE lpMask;
|
||||
|
||||
byte_width = width;
|
||||
lpMask = lpScan;
|
||||
start_scan:
|
||||
while (!(mask_byte = *lpMask))
|
||||
{
|
||||
if (--byte_width == 0)
|
||||
goto done_scan;
|
||||
++lpMask;
|
||||
}
|
||||
|
||||
for (bit = (BYTE)0x80; !(bit & mask_byte); bit >>= 1)
|
||||
;
|
||||
|
||||
fill_scan:
|
||||
while (bit >>= 1)
|
||||
{
|
||||
fill_byte:
|
||||
if (!(bit & mask_byte))
|
||||
mask_byte |= bit;
|
||||
else
|
||||
{
|
||||
while (bit >>= 1)
|
||||
{
|
||||
if (bit & mask_byte)
|
||||
goto fill_scan;
|
||||
}
|
||||
|
||||
*lpMask++ = mask_byte;
|
||||
if (--byte_width == 0)
|
||||
goto done_scan;
|
||||
else
|
||||
goto start_scan;
|
||||
}
|
||||
}
|
||||
*lpMask++ = mask_byte;
|
||||
if (--byte_width > 0)
|
||||
{
|
||||
while (!(mask_byte = *lpMask))
|
||||
{
|
||||
*lpMask++ = 0xFF;
|
||||
if (--byte_width == 0)
|
||||
goto done_scan;
|
||||
}
|
||||
bit = (BYTE)0x80;
|
||||
goto fill_byte;
|
||||
}
|
||||
|
||||
done_scan:
|
||||
lpScan += dst_mask_incr;
|
||||
} while (--height);
|
||||
}
|
||||
|
||||
static void
|
||||
create_poly (PRECT pClipRect, PPOLYGON_DESC lpPolygon, FRAMEPTR
|
||||
FramePtr)
|
||||
{
|
||||
COUNT i;
|
||||
COORD xoffs, yoffs;
|
||||
BRESENHAM_LINE Line;
|
||||
PPOINT pt1;
|
||||
|
||||
xoffs = pClipRect->corner.x - POLY_XMIN;
|
||||
yoffs = pClipRect->corner.y - POLY_YMIN;
|
||||
|
||||
if (lpPolygon->PtCount > 2)
|
||||
{
|
||||
COORD xmax, ymax;
|
||||
COORD ox, oy;
|
||||
COORD ystart;
|
||||
PPOINT pt2;
|
||||
DIRECTION last_ydir;
|
||||
BRESENHAM_LINE ShadowLine;
|
||||
|
||||
xmax = POLY_XMIN + pClipRect->extent.width - 1;
|
||||
ymax = POLY_YMIN + pClipRect->extent.height - 1;
|
||||
ShadowLine.first.x = ShadowLine.second.x = POLY_XMIN - 1;
|
||||
ShadowLine.error_term = -1;
|
||||
ShadowLine.abs_delta_x = 0;
|
||||
ShadowLine.end_points_exchanged = FALSE;
|
||||
|
||||
pt1 = lpPolygon->PtList;
|
||||
ystart = pt1->y;
|
||||
while ((oy = (++pt1)->y) == ystart)
|
||||
;
|
||||
ox = pt1->x;
|
||||
|
||||
last_ydir = oy > ystart ? UP : DOWN;
|
||||
|
||||
i = lpPolygon->PtCount;
|
||||
pt2 = &lpPolygon->PtList[i - 1];
|
||||
do
|
||||
{
|
||||
COORD x1, y1;
|
||||
|
||||
if (pt1 != pt2)
|
||||
++pt1;
|
||||
else
|
||||
pt1 = lpPolygon->PtList;
|
||||
|
||||
x1 = ox;
|
||||
y1 = oy;
|
||||
ox = pt1->x;
|
||||
oy = pt1->y;
|
||||
|
||||
if (oy != y1)
|
||||
{
|
||||
COORD y2;
|
||||
INTERSECT_CODE intersect_code;
|
||||
|
||||
Line.first.x = x1;
|
||||
Line.first.y = y1;
|
||||
Line.second.x = ox;
|
||||
Line.second.y = oy;
|
||||
LOGtoDEV ((PPOINT)&Line, (PPOINT)&Line, 2);
|
||||
y1 = Line.first.y - yoffs;
|
||||
y2 = Line.second.y - yoffs;
|
||||
|
||||
{
|
||||
DIRECTION ydir;
|
||||
|
||||
ydir = y2 > y1 ? UP : DOWN;
|
||||
if (ydir != last_ydir)
|
||||
last_ydir = ydir;
|
||||
else if (y1 >= POLY_YMIN && y1 <= ymax)
|
||||
{
|
||||
x1 = Line.first.x - xoffs;
|
||||
if (x1 < POLY_XMIN)
|
||||
xor_dot (FramePtr, POLY_XMIN - 1, y1);
|
||||
else if (x1 <= xmax)
|
||||
xor_dot (FramePtr, x1, y1);
|
||||
}
|
||||
}
|
||||
|
||||
intersect_code = _clip_line (pClipRect, &Line);
|
||||
Line.first.x -= xoffs;
|
||||
Line.first.y -= yoffs;
|
||||
Line.second.x -= xoffs;
|
||||
Line.second.y -= yoffs;
|
||||
if (intersect_code)
|
||||
{
|
||||
xor_line (FramePtr, &Line);
|
||||
|
||||
if (intersect_code & INTERSECT_LEFT)
|
||||
{
|
||||
if (Line.end_points_exchanged)
|
||||
y1 = y2;
|
||||
|
||||
y2 = Line.first.y;
|
||||
if (y2 > POLY_YMIN && y1 < y2)
|
||||
{
|
||||
--y2;
|
||||
if (y1 < POLY_YMIN)
|
||||
y1 = POLY_YMIN;
|
||||
ShadowLine.first.y = y1;
|
||||
ShadowLine.second.y = y2;
|
||||
ShadowLine.abs_delta_y = y2 - y1;
|
||||
xor_line (FramePtr, &ShadowLine);
|
||||
}
|
||||
else if (y2 < ymax && y1 > y2)
|
||||
{
|
||||
++y2;
|
||||
if (y1 > ymax)
|
||||
y1 = ymax;
|
||||
ShadowLine.first.y = y2;
|
||||
ShadowLine.second.y = y1;
|
||||
ShadowLine.abs_delta_y = y1 - y2;
|
||||
xor_line (FramePtr, &ShadowLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Line.first.x < POLY_XMIN
|
||||
&& (Line.first.y >= POLY_YMIN
|
||||
|| Line.second.y >= POLY_YMIN)
|
||||
&& (Line.first.y <= ymax
|
||||
|| Line.second.y <= ymax))
|
||||
{
|
||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
if (Line.first.y > Line.second.y)
|
||||
{
|
||||
y1 = MAX (Line.second.y, POLY_YMIN);
|
||||
y2 = MIN (Line.first.y, ymax);
|
||||
}
|
||||
else
|
||||
{
|
||||
y1 = MAX (Line.first.y, POLY_YMIN);
|
||||
y2 = MIN (Line.second.y, ymax);
|
||||
}
|
||||
|
||||
if (Line.first.x == Line.second.x) /* vertical line */
|
||||
{
|
||||
ShadowLine.first.y = y1;
|
||||
ShadowLine.second.y = y2;
|
||||
ShadowLine.abs_delta_y = y2 - y1;
|
||||
xor_line (FramePtr, &ShadowLine);
|
||||
}
|
||||
else /* sloped line */
|
||||
{
|
||||
SIZE line_delta_x, line_delta_y;
|
||||
long yinter; /* y intercept with xmin */
|
||||
|
||||
line_delta_x = Line.second.x - Line.first.x;
|
||||
line_delta_y = Line.second.y - Line.first.y;
|
||||
yinter = ((long)Line.first.y * line_delta_x)
|
||||
+ ((long)(POLY_XMIN - Line.first.x)
|
||||
* line_delta_y);
|
||||
if ((Line.first.y < Line.second.y
|
||||
&& yinter >= (long)(POLY_YMIN * line_delta_x))
|
||||
|| (Line.first.y > Line.second.y
|
||||
&& yinter <= (long)ymax * line_delta_x))
|
||||
{
|
||||
ShadowLine.first.y = y1;
|
||||
ShadowLine.second.y = y2;
|
||||
ShadowLine.abs_delta_y = y2 - y1;
|
||||
xor_line (FramePtr, &ShadowLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (--i);
|
||||
|
||||
on_off (FramePtr);
|
||||
}
|
||||
|
||||
/* now outline the polygon */
|
||||
pt1 = lpPolygon->PtList;
|
||||
for (i = lpPolygon->PtCount - 1; i > 0; --i)
|
||||
{
|
||||
LOGtoDEV (pt1++, (PPOINT)&Line, 2);
|
||||
if (_clip_line (pClipRect, &Line))
|
||||
{
|
||||
Line.first.x -= xoffs;
|
||||
Line.first.y -= yoffs;
|
||||
Line.second.x -= xoffs;
|
||||
Line.second.y -= yoffs;
|
||||
or_line (FramePtr, &Line);
|
||||
}
|
||||
}
|
||||
|
||||
Line.first = *pt1;
|
||||
Line.second = lpPolygon->PtList[0];
|
||||
LOGtoDEV ((PPOINT)&Line, (PPOINT)&Line, 2);
|
||||
if (_clip_line (pClipRect, &Line))
|
||||
{
|
||||
Line.first.x -= xoffs;
|
||||
Line.first.y -= yoffs;
|
||||
Line.second.x -= xoffs;
|
||||
Line.second.y -= yoffs;
|
||||
or_line (FramePtr, &Line);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_fillpoly_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||
{
|
||||
#ifndef __WATCOMC__
|
||||
MEM_HANDLE h;
|
||||
FRAME_DESC PolyFrame;
|
||||
PRIMITIVE locPrim;
|
||||
|
||||
SetFrameX (&PolyFrame, 0);
|
||||
SetFrameY (&PolyFrame, 0);
|
||||
SetFrameWidth (&PolyFrame, pClipRect->extent.width + POLY_XMIN);
|
||||
SetFrameHeight (&PolyFrame, pClipRect->extent.height + POLY_YMIN);
|
||||
SetImageShift (&PolyFrame.MaskImage, 0);
|
||||
AllocMaskImage (&PolyFrame, RAM_DRAWABLE, 0);
|
||||
SubImageFlags (&PolyFrame.PixmapImage, ~0);
|
||||
SetImageData (&PolyFrame.PixmapImage, NULL_PTR);
|
||||
AllocPixmapImage (&PolyFrame, RAM_DRAWABLE, 0);
|
||||
h = AllocGraphicData (GetImageByteCount (&PolyFrame.MaskImage));
|
||||
SetImageData (&PolyFrame.MaskImage, LockData (h));
|
||||
|
||||
create_poly (pClipRect,
|
||||
(PPOLYGON_DESC)PrimPtr->Object.Polygon, &PolyFrame);
|
||||
|
||||
_save_stamp.origin.x = pClipRect->corner.x - POLY_XMIN;
|
||||
_save_stamp.origin.y = pClipRect->corner.y - POLY_YMIN;
|
||||
locPrim.Object.Stamp.frame = &PolyFrame;
|
||||
SetPrimType (&locPrim, STAMPFILL_PRIM);
|
||||
SetPrimColor (&locPrim, GetPrimColor (PrimPtr));
|
||||
|
||||
DrawGraphicsFunc (pClipRect, &locPrim);
|
||||
|
||||
UnlockData (h);
|
||||
FreeMaskImage (h);
|
||||
#endif /* __WATCOMC__ */
|
||||
}
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gfxintrn.h"
|
||||
|
||||
MAP_TYPE
|
||||
SetContextMapType (MAP_TYPE MapType)
|
||||
{
|
||||
#ifndef MAPPING
|
||||
return (MAP_NOXFORM);
|
||||
#else /* MAPPING */
|
||||
MAP_TYPE oldMapType;
|
||||
|
||||
if (!ContextActive ())
|
||||
oldMapType = MAP_NOXFORM;
|
||||
else if ((oldMapType = _get_context_map_type ()) != MapType)
|
||||
{
|
||||
SwitchContextMapType (MapType);
|
||||
}
|
||||
|
||||
return (oldMapType);
|
||||
#endif /* MAPPING */
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
SetContextWinOrigin (PPOINT lpOrg)
|
||||
{
|
||||
#ifndef MAPPING
|
||||
return (FALSE);
|
||||
#else /* MAPPING */
|
||||
if (!ContextActive ())
|
||||
return (FALSE);
|
||||
|
||||
SwitchContextWinOrigin (lpOrg);
|
||||
|
||||
return (TRUE);
|
||||
#endif /* MAPPING */
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
SetContextViewExtents (PEXTENT lpExtent)
|
||||
{
|
||||
#ifndef MAPPING
|
||||
return (FALSE);
|
||||
#else /* MAPPING */
|
||||
if (!ContextActive ())
|
||||
return (FALSE);
|
||||
|
||||
SwitchContextViewExtents (lpExtent);
|
||||
|
||||
return (TRUE);
|
||||
#endif /* MAPPING */
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
SetContextWinExtents (PEXTENT lpExtent)
|
||||
{
|
||||
#ifndef MAPPING
|
||||
return (FALSE);
|
||||
#else /* MAPPING */
|
||||
if (!ContextActive ())
|
||||
return (FALSE);
|
||||
|
||||
SwitchContextWinExtents (lpExtent);
|
||||
|
||||
return (TRUE);
|
||||
#endif /* MAPPING */
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
GetContextWinOrigin (PPOINT lpOrg)
|
||||
{
|
||||
#ifndef MAPPING
|
||||
return (FALSE);
|
||||
#else /* MAPPING */
|
||||
if (!ContextActive ())
|
||||
return (FALSE);
|
||||
|
||||
*lpOrg = _pCurContext->Map.WinOrg;
|
||||
|
||||
return (TRUE);
|
||||
#endif /* MAPPING */
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
GetContextViewExtents (PEXTENT lpExtent)
|
||||
{
|
||||
#ifndef MAPPING
|
||||
return (FALSE);
|
||||
#else /* MAPPING */
|
||||
if (!ContextActive ())
|
||||
return (FALSE);
|
||||
|
||||
*lpExtent = _pCurContext->Map.ViewExt;
|
||||
|
||||
return (TRUE);
|
||||
#endif /* MAPPING */
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
GetContextWinExtents (PEXTENT lpExtent)
|
||||
{
|
||||
#ifndef MAPPING
|
||||
return (FALSE);
|
||||
#else /* MAPPING */
|
||||
if (!ContextActive ())
|
||||
return (FALSE);
|
||||
|
||||
*lpExtent = _pCurContext->Map.WinExt;
|
||||
|
||||
return (TRUE);
|
||||
#endif /* MAPPING */
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
LOGtoDEV (PPOINT lpSrcPt, PPOINT lpDstPt, COUNT NumPoints)
|
||||
{
|
||||
#ifndef MAPPING
|
||||
return (FALSE);
|
||||
#else /* MAPPING */
|
||||
if (!ContextActive () || NumPoints == 0)
|
||||
return (FALSE);
|
||||
|
||||
{
|
||||
MAP_TYPE MapType;
|
||||
|
||||
_init_context_map (&MapType);
|
||||
if (MapType == MAP_NOXFORM)
|
||||
{
|
||||
do
|
||||
*lpDstPt++ = *lpSrcPt++;
|
||||
while (--NumPoints);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
lpDstPt->x = LXtoDX (lpSrcPt->x);
|
||||
lpDstPt->y = LYtoDY (lpSrcPt->y);
|
||||
++lpSrcPt;
|
||||
++lpDstPt;
|
||||
} while (--NumPoints);
|
||||
}
|
||||
_uninit_context_map ();
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
#endif /* MAPPING */
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
DEVtoLOG (PPOINT lpSrcPt, PPOINT lpDstPt, COUNT NumPoints)
|
||||
{
|
||||
#ifndef MAPPING
|
||||
return (FALSE);
|
||||
#else /* MAPPING */
|
||||
if (!ContextActive () || NumPoints == 0)
|
||||
return (FALSE);
|
||||
|
||||
{
|
||||
MAP_TYPE MapType;
|
||||
|
||||
_init_context_map (&MapType);
|
||||
if (MapType == MAP_NOXFORM)
|
||||
{
|
||||
do
|
||||
*lpDstPt++ = *lpSrcPt++;
|
||||
while (--NumPoints);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
lpDstPt->x = DXtoLX (lpSrcPt->x);
|
||||
lpDstPt->y = DYtoLY (lpSrcPt->y);
|
||||
++lpSrcPt;
|
||||
++lpDstPt;
|
||||
} while (--NumPoints);
|
||||
}
|
||||
_uninit_context_map ();
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
#endif /* MAPPING */
|
||||
}
|
||||
|
||||
@@ -172,20 +172,3 @@ DecFrameIndex (FRAMEPTR FramePtr)
|
||||
return ((FRAME)&DrawablePtr->Frame[INDEX_GET (DrawablePtr->FlagsAndIndex)]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XFlipFrame (FRAMEPTR FramePtr)
|
||||
{
|
||||
if (FramePtr)
|
||||
{
|
||||
if (GetFrameFlags (FramePtr) & X_FLIP)
|
||||
{
|
||||
SubFrameFlags (FramePtr, X_FLIP);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddFrameFlags (FramePtr, X_FLIP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gfxintrn.h"
|
||||
|
||||
void
|
||||
DrawPolygon (POLYGON Polygon)
|
||||
{
|
||||
SetPrimType (&_locPrim, POLY_PRIM);
|
||||
_locPrim.Object.Polygon = Polygon;
|
||||
|
||||
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
||||
}
|
||||
|
||||
void
|
||||
DrawFilledPolygon (POLYGON Polygon)
|
||||
{
|
||||
SetPrimType (&_locPrim, POLYFILL_PRIM);
|
||||
_locPrim.Object.Polygon = Polygon;
|
||||
|
||||
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
||||
}
|
||||
|
||||
POLYREF
|
||||
CreatePolygon (COUNT PtCount)
|
||||
{
|
||||
POLYREF hPoly;
|
||||
|
||||
hPoly = (POLYREF)NULL_PTR;
|
||||
if (PtCount > 0)
|
||||
{
|
||||
PPOLYGON_DESC lpPoly;
|
||||
|
||||
if ((hPoly = AllocPolygon (PtCount)) != (POLYREF)NULL_PTR)
|
||||
{
|
||||
if ((lpPoly = LockPolygon (hPoly)) == (PPOLYGON_DESC)NULL_PTR)
|
||||
{
|
||||
FreePolygon (hPoly);
|
||||
hPoly = (POLYREF)NULL_PTR;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpPoly->hPoly = hPoly;
|
||||
lpPoly->PtCount = PtCount;
|
||||
UnlockPolygon (hPoly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (hPoly);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
DestroyPolygon (POLYREF PolyRef)
|
||||
{
|
||||
return (FreePolygon (PolyRef));
|
||||
}
|
||||
|
||||
POLYGON
|
||||
CapturePolygon (POLYREF PolyRef)
|
||||
{
|
||||
PPOLYGON_DESC lpPoly;
|
||||
|
||||
if (PolyRef == (POLYREF)NULL_PTR)
|
||||
lpPoly = (PPOLYGON_DESC)NULL_PTR;
|
||||
else
|
||||
{
|
||||
lpPoly = LockPolygon (PolyRef);
|
||||
lpPoly->PtList = (PPOINT)&lpPoly[1];
|
||||
}
|
||||
|
||||
return ((POLYGON)lpPoly);
|
||||
}
|
||||
|
||||
POLYREF
|
||||
ReleasePolygon (POLYGON Polygon)
|
||||
{
|
||||
POLYREF PolyRef;
|
||||
|
||||
PolyRef = (POLYREF)NULL_PTR;
|
||||
if (Polygon != (POLYGON)NULL_PTR)
|
||||
{
|
||||
PolyRef = ((PPOLYGON_DESC)Polygon)->hPoly;
|
||||
UnlockPolygon (PolyRef);
|
||||
}
|
||||
|
||||
return (PolyRef);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
SetPolygonPoint (POLYGON Polygon, COUNT PtIndex, COORD x, COORD y)
|
||||
{
|
||||
BOOLEAN retval;
|
||||
|
||||
retval = FALSE;
|
||||
if (Polygon != (POLYGON)NULL_PTR)
|
||||
{
|
||||
PPOLYGON_DESC lpPoly;
|
||||
PPOINT lpPt;
|
||||
|
||||
lpPoly = (PPOLYGON_DESC)Polygon;
|
||||
if (lpPoly->BoundRect.extent.width == 0)
|
||||
{
|
||||
lpPoly->BoundRect.corner.x = x;
|
||||
lpPoly->BoundRect.corner.y = y;
|
||||
lpPoly->BoundRect.extent.width =
|
||||
lpPoly->BoundRect.extent.height = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SIZE delta, width, height;
|
||||
|
||||
width = height = 1;
|
||||
if ((delta = x - lpPoly->BoundRect.corner.x) >= 0)
|
||||
width += delta;
|
||||
else
|
||||
{
|
||||
lpPoly->BoundRect.extent.width -= delta;
|
||||
lpPoly->BoundRect.corner.x = x;
|
||||
}
|
||||
if ((delta = y - lpPoly->BoundRect.corner.y) >= 0)
|
||||
height += delta;
|
||||
else
|
||||
{
|
||||
lpPoly->BoundRect.extent.height -= delta;
|
||||
lpPoly->BoundRect.corner.y = y;
|
||||
}
|
||||
if ((delta = width - lpPoly->BoundRect.extent.width) > 0)
|
||||
lpPoly->BoundRect.extent.width += delta;
|
||||
if ((delta = height - lpPoly->BoundRect.extent.height) > 0)
|
||||
lpPoly->BoundRect.extent.height += delta;
|
||||
}
|
||||
|
||||
lpPt = &lpPoly->PtList[PtIndex];
|
||||
lpPt->x = x;
|
||||
lpPt->y = y;
|
||||
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
GetPolygonPoint (POLYGON Polygon, COUNT PtIndex, PCOORD px, PCOORD py)
|
||||
{
|
||||
BOOLEAN retval;
|
||||
|
||||
retval = FALSE;
|
||||
if (Polygon != (POLYGON)NULL_PTR)
|
||||
{
|
||||
PPOINT lpPt;
|
||||
|
||||
lpPt = &((PPOLYGON_DESC)Polygon)->PtList[PtIndex];
|
||||
*px = lpPt->x;
|
||||
*py = lpPt->y;
|
||||
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gfxintrn.h"
|
||||
|
||||
void
|
||||
DrawPoint (PPOINT lpPoint)
|
||||
{
|
||||
SetPrimType (&_locPrim, POINT_PRIM);
|
||||
_locPrim.Object.Point = *lpPoint;
|
||||
|
||||
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
||||
}
|
||||
|
||||
void
|
||||
DrawRectangle (PRECT lpRect)
|
||||
{
|
||||
SetPrimType (&_locPrim, RECT_PRIM);
|
||||
_locPrim.Object.Rect = *lpRect;
|
||||
|
||||
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
||||
}
|
||||
|
||||
void
|
||||
DrawFilledRectangle (PRECT lpRect)
|
||||
{
|
||||
SetPrimType (&_locPrim, RECTFILL_PRIM);
|
||||
_locPrim.Object.Rect = *lpRect;
|
||||
|
||||
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
||||
}
|
||||
|
||||
void
|
||||
_rect_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||
{
|
||||
COORD x, y;
|
||||
RECTPTR RectPtr;
|
||||
PRIMITIVE locPrim;
|
||||
|
||||
locPrim = *PrimPtr;
|
||||
SetPrimType (&locPrim, RECTFILL_PRIM);
|
||||
|
||||
RectPtr = &PrimPtr->Object.Rect;
|
||||
locPrim.Object.Rect = *pClipRect;
|
||||
if (locPrim.Object.Rect.corner.x == RectPtr->corner.x)
|
||||
{
|
||||
locPrim.Object.Rect.extent.width = 1;
|
||||
DrawGraphicsFunc (&locPrim.Object.Rect, &locPrim);
|
||||
locPrim.Object.Rect.extent.width = pClipRect->extent.width;
|
||||
}
|
||||
if (locPrim.Object.Rect.corner.y == RectPtr->corner.y)
|
||||
{
|
||||
locPrim.Object.Rect.extent.height = 1;
|
||||
DrawGraphicsFunc (&locPrim.Object.Rect, &locPrim);
|
||||
locPrim.Object.Rect.extent.height = pClipRect->extent.height;
|
||||
}
|
||||
if ((x = locPrim.Object.Rect.corner.x
|
||||
+ locPrim.Object.Rect.extent.width) ==
|
||||
RectPtr->corner.x + RectPtr->extent.width)
|
||||
{
|
||||
locPrim.Object.Rect.corner.x = x - 1;
|
||||
locPrim.Object.Rect.extent.width = 1;
|
||||
DrawGraphicsFunc (&locPrim.Object.Rect, &locPrim);
|
||||
locPrim.Object.Rect.corner.x = pClipRect->corner.x;
|
||||
locPrim.Object.Rect.extent.width = pClipRect->extent.width;
|
||||
}
|
||||
if ((y = locPrim.Object.Rect.corner.y
|
||||
+ locPrim.Object.Rect.extent.height) ==
|
||||
RectPtr->corner.y + RectPtr->extent.height)
|
||||
{
|
||||
locPrim.Object.Rect.corner.y = y - 1;
|
||||
locPrim.Object.Rect.extent.height = 1;
|
||||
DrawGraphicsFunc (&locPrim.Object.Rect, &locPrim);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,240 +30,10 @@ SetGraphicScale (int scale)
|
||||
gscale = scale;
|
||||
}
|
||||
|
||||
static void
|
||||
blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||
int
|
||||
GetGraphicScale ()
|
||||
{
|
||||
TFB_Image *img;
|
||||
PFRAME_DESC SrcFramePtr;
|
||||
|
||||
SrcFramePtr = (PFRAME_DESC)PrimPtr->Object.Stamp.frame;
|
||||
if (!SrcFramePtr->image)
|
||||
{
|
||||
fprintf (stderr, "Non-existent image to blt()\n");
|
||||
return;
|
||||
}
|
||||
|
||||
img = SrcFramePtr->image;
|
||||
|
||||
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||
{
|
||||
int x, y;
|
||||
BOOLEAN scaled, paletted, filled;
|
||||
TFB_Palette palette[256];
|
||||
|
||||
LockMutex (img->mutex);
|
||||
|
||||
x = pClipRect->corner.x - GetFrameHotX (_CurFramePtr);
|
||||
y = pClipRect->corner.y - GetFrameHotY (_CurFramePtr);
|
||||
scaled = filled = FALSE;
|
||||
|
||||
if (gscale != 0 && gscale != 256)
|
||||
{
|
||||
x += (GetFrameHotX (SrcFramePtr) *
|
||||
((1 << 8) - gscale)) >> 8;
|
||||
y += (GetFrameHotY (SrcFramePtr) *
|
||||
((1 << 8) - gscale)) >> 8;
|
||||
scaled = TRUE;
|
||||
|
||||
if (img->ScaledImg)
|
||||
{
|
||||
if (img->scale != gscale)
|
||||
{
|
||||
SDL_FreeSurface(img->ScaledImg);
|
||||
img->ScaledImg = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!img->ScaledImg)
|
||||
{
|
||||
// atleast melee zooming uses this
|
||||
|
||||
SDL_Surface *new_surf;
|
||||
|
||||
img->scale = gscale;
|
||||
img->dirty = FALSE;
|
||||
new_surf = zoomSurface (img->NormalImg, gscale / 256.0f,
|
||||
gscale / 256.0f, SMOOTHING_OFF);
|
||||
|
||||
if (new_surf)
|
||||
{
|
||||
if (!new_surf->format->palette)
|
||||
{
|
||||
img->ScaledImg = TFB_DrawCanvas_ToScreenFormat (new_surf);
|
||||
}
|
||||
else
|
||||
{
|
||||
img->ScaledImg = new_surf;
|
||||
SDL_SetColors (img->ScaledImg, (SDL_Color *)img->Palette, 0, 256);
|
||||
if (((SDL_Surface *)img->NormalImg)->flags & SDL_SRCCOLORKEY)
|
||||
{
|
||||
SDL_SetColorKey (img->ScaledImg, SDL_SRCCOLORKEY,
|
||||
((SDL_Surface *)img->NormalImg)->format->colorkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "blt(): zoomSurface failed\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
paletted = FALSE;
|
||||
|
||||
if (GetPrimType (PrimPtr) == STAMPFILL_PRIM)
|
||||
{
|
||||
int r, g, b;
|
||||
DWORD c32k;
|
||||
|
||||
c32k = GetPrimColor (PrimPtr) >> 8; // shift out color index
|
||||
r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
b = (c32k << (8 - 5)) & 0xF8;
|
||||
|
||||
palette[0].r = r;
|
||||
palette[0].g = g;
|
||||
palette[0].b = b;
|
||||
|
||||
filled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((SDL_Surface *)img->NormalImg)->format->palette && img->colormap_index != -1)
|
||||
{
|
||||
TFB_ColorMapToRGB (palette, img->colormap_index);
|
||||
paletted = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
UnlockMutex (img->mutex);
|
||||
if (filled)
|
||||
{
|
||||
TFB_DrawScreen_FilledImage (img, x, y,
|
||||
scaled, palette[0].r,
|
||||
palette[0].g, palette[0].b,
|
||||
TFB_SCREEN_MAIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
TFB_DrawScreen_Image (img, x, y, scaled,
|
||||
(paletted ? palette : NULL),
|
||||
TFB_SCREEN_MAIN);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TFB_Image *dst_img;
|
||||
|
||||
dst_img = _CurFramePtr->image;
|
||||
|
||||
if (GetPrimType (PrimPtr) == STAMPFILL_PRIM)
|
||||
{
|
||||
int r, g, b;
|
||||
DWORD c32k;
|
||||
|
||||
c32k = GetPrimColor (PrimPtr) >> 8; // shift out color index
|
||||
r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
b = (c32k << (8 - 5)) & 0xF8;
|
||||
|
||||
TFB_DrawImage_FilledImage(img,
|
||||
pClipRect->corner.x - GetFrameHotX (_CurFramePtr),
|
||||
pClipRect->corner.y - GetFrameHotY (_CurFramePtr),
|
||||
FALSE, r, g, b, dst_img);
|
||||
} else {
|
||||
TFB_DrawImage_Image(img,
|
||||
pClipRect->corner.x - GetFrameHotX (_CurFramePtr),
|
||||
pClipRect->corner.y - GetFrameHotY (_CurFramePtr),
|
||||
FALSE, img->Palette, dst_img);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fillrect_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||
{
|
||||
int r, g, b;
|
||||
DWORD c32k;
|
||||
|
||||
c32k = GetPrimColor (PrimPtr) >> 8; //shift out color index
|
||||
r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
b = (c32k << (8 - 5)) & 0xF8;
|
||||
|
||||
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||
{
|
||||
RECT rect;
|
||||
rect.corner.x = pClipRect->corner.x - GetFrameHotX (_CurFramePtr);
|
||||
rect.corner.y = pClipRect->corner.y - GetFrameHotY (_CurFramePtr);
|
||||
rect.extent.width = pClipRect->extent.width;
|
||||
rect.extent.height = pClipRect->extent.height;
|
||||
|
||||
if (gscale && GetPrimType (PrimPtr) != POINT_PRIM)
|
||||
{
|
||||
rect.extent.width = (rect.extent.width * gscale) >> 8;
|
||||
rect.extent.height = (rect.extent.height * gscale) >> 8;
|
||||
rect.corner.x += (pClipRect->extent.width -
|
||||
rect.extent.width) >> 1;
|
||||
rect.corner.y += (pClipRect->extent.height -
|
||||
rect.extent.height) >> 1;
|
||||
}
|
||||
|
||||
TFB_DrawScreen_Rect (&rect, r, g, b, TFB_SCREEN_MAIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_Rect SDLRect;
|
||||
TFB_Image *img;
|
||||
|
||||
img = _CurFramePtr->image;
|
||||
|
||||
LockMutex (img->mutex);
|
||||
|
||||
SDLRect.x = (short) (pClipRect->corner.x -
|
||||
GetFrameHotX (_CurFramePtr));
|
||||
SDLRect.y = (short) (pClipRect->corner.y -
|
||||
GetFrameHotY (_CurFramePtr));
|
||||
SDLRect.w = (short) pClipRect->extent.width;
|
||||
SDLRect.h = (short) pClipRect->extent.height;
|
||||
|
||||
SDL_FillRect (img->NormalImg, &SDLRect, SDL_MapRGB (((SDL_Surface *)img->NormalImg)->format, r, g, b));
|
||||
|
||||
UnlockMutex (img->mutex);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cmap_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||
{
|
||||
fprintf (stderr, "Unimplemented function activated: cmap_blt()\n");
|
||||
}
|
||||
|
||||
static void
|
||||
line_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||
{
|
||||
int x1,y1,x2,y2;
|
||||
int r, g, b;
|
||||
DWORD c32k;
|
||||
|
||||
c32k = GetPrimColor (PrimPtr) >> 8; // shift out color index
|
||||
r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||
g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||
b = (c32k << (8 - 5)) & 0xF8;
|
||||
|
||||
x1=PrimPtr->Object.Line.first.x - GetFrameHotX (_CurFramePtr);
|
||||
y1=PrimPtr->Object.Line.first.y - GetFrameHotY (_CurFramePtr);
|
||||
x2=PrimPtr->Object.Line.second.x - GetFrameHotX (_CurFramePtr);
|
||||
y2=PrimPtr->Object.Line.second.y - GetFrameHotY (_CurFramePtr);
|
||||
|
||||
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||
{
|
||||
TFB_DrawScreen_Line (x1, y1, x2, y2, r, g, b, TFB_SCREEN_MAIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Maybe we should do something about this?
|
||||
}
|
||||
return gscale;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -291,20 +61,6 @@ alloc_image (COUNT NumFrames, DRAWABLE_TYPE DrawableType, CREATE_FLAGS
|
||||
return AllocDrawable (NumFrames, 0);
|
||||
}
|
||||
|
||||
void (*func_array[]) (PRECT pClipRect, PRIMITIVEPTR PrimPtr) =
|
||||
{
|
||||
fillrect_blt,
|
||||
blt,
|
||||
blt,
|
||||
line_blt,
|
||||
_text_blt,
|
||||
cmap_blt,
|
||||
_rect_blt,
|
||||
fillrect_blt,
|
||||
_fillpoly_blt,
|
||||
_fillpoly_blt,
|
||||
};
|
||||
|
||||
static DISPLAY_INTERFACE DisplayInterface =
|
||||
{
|
||||
WANT_MASK,
|
||||
@@ -315,8 +71,6 @@ static DISPLAY_INTERFACE DisplayInterface =
|
||||
|
||||
alloc_image,
|
||||
read_screen,
|
||||
|
||||
func_array,
|
||||
};
|
||||
|
||||
void
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include "sdl_common.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/graphics/sdl/primitives.h"
|
||||
#include "libs/graphics/tfb_draw.h"
|
||||
#include "rotozoom.h"
|
||||
|
||||
typedef SDL_Surface *NativeCanvas;
|
||||
|
||||
@@ -32,7 +34,7 @@ TFB_DrawCanvas_Rect (PRECT rect, int r, int g, int b, TFB_Canvas target)
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawCanvas_Image (TFB_Image *img, int x, int y, BOOLEAN scaled, TFB_Palette *palette, TFB_Canvas target)
|
||||
TFB_DrawCanvas_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *palette, TFB_Canvas target)
|
||||
{
|
||||
SDL_Rect targetRect;
|
||||
SDL_Surface *surf;
|
||||
@@ -47,8 +49,11 @@ TFB_DrawCanvas_Image (TFB_Image *img, int x, int y, BOOLEAN scaled, TFB_Palette
|
||||
targetRect.x = x;
|
||||
targetRect.y = y;
|
||||
|
||||
if (scaled)
|
||||
if (scale != 0 && scale != 256)
|
||||
{
|
||||
// TFB_DrawImage_FixScaling (img, scale);
|
||||
surf = img->ScaledImg;
|
||||
}
|
||||
else
|
||||
surf = img->NormalImg;
|
||||
|
||||
@@ -69,7 +74,7 @@ TFB_DrawCanvas_Image (TFB_Image *img, int x, int y, BOOLEAN scaled, TFB_Palette
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, BOOLEAN scaled, int r, int g, int b, TFB_Canvas target)
|
||||
TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int g, int b, TFB_Canvas target)
|
||||
{
|
||||
SDL_Rect targetRect;
|
||||
SDL_Surface *surf;
|
||||
@@ -87,8 +92,11 @@ TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, BOOLEAN scaled, int r,
|
||||
targetRect.x = x;
|
||||
targetRect.y = y;
|
||||
|
||||
if (scaled)
|
||||
if (scale != 0 && scale != 256)
|
||||
{
|
||||
// TFB_DrawImage_FixScaling (img, scale);
|
||||
surf = img->ScaledImg;
|
||||
}
|
||||
else
|
||||
surf = img->NormalImg;
|
||||
|
||||
@@ -178,15 +186,71 @@ TFB_DrawCanvas_ExtractPalette (TFB_Canvas canvas)
|
||||
TFB_Canvas
|
||||
TFB_DrawCanvas_ToScreenFormat (TFB_Canvas canvas)
|
||||
{
|
||||
SDL_Surface *result = TFB_DisplayFormatAlpha (canvas);
|
||||
SDL_Surface *result = TFB_DisplayFormatAlpha ((SDL_Surface *)canvas);
|
||||
if (result == NULL)
|
||||
{
|
||||
fprintf (stderr, "WARNING: Could not convert sprite-canvas to display format. Expect performance penalties.\n");
|
||||
fprintf (stderr, "WARNING: Could not convert sprite-canvas to display format.\n");
|
||||
return canvas;
|
||||
}
|
||||
else
|
||||
{
|
||||
TFB_DrawCanvas_Delete(canvas);
|
||||
TFB_DrawCanvas_Delete (canvas);
|
||||
return result;
|
||||
}
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
||||
TFB_Canvas
|
||||
TFB_DrawCanvas_New_Scaled (TFB_Canvas src, int scale)
|
||||
{
|
||||
SDL_Surface *new_surf;
|
||||
|
||||
new_surf = zoomSurface ((SDL_Surface *)src, scale / 256.0f,
|
||||
scale / 256.0f, SMOOTHING_OFF);
|
||||
|
||||
if (new_surf)
|
||||
{
|
||||
if (!TFB_DrawCanvas_IsPaletted (new_surf))
|
||||
{
|
||||
new_surf = TFB_DrawCanvas_ToScreenFormat (new_surf);
|
||||
}
|
||||
return new_surf;
|
||||
}
|
||||
|
||||
fprintf (stderr, "TFB_DrawCanvas_New_Scaled failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
TFB_DrawCanvas_IsPaletted (TFB_Canvas canvas)
|
||||
{
|
||||
return ((SDL_Surface *)canvas)->format->palette != NULL;
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawCanvas_SetPalette (TFB_Canvas target, TFB_Palette *palette)
|
||||
{
|
||||
SDL_SetColors ((SDL_Surface *)target, (SDL_Color *)palette, 0, 256);
|
||||
}
|
||||
|
||||
int
|
||||
TFB_DrawCanvas_GetTransparentIndex (TFB_Canvas canvas)
|
||||
{
|
||||
if (((SDL_Surface *)canvas)->flags & SDL_SRCCOLORKEY)
|
||||
return ((SDL_Surface *)canvas)->format->colorkey;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawCanvas_SetTransparentIndex (TFB_Canvas canvas, int index)
|
||||
{
|
||||
if (index >= 0)
|
||||
{
|
||||
SDL_SetColorKey ((SDL_Surface *)canvas, SDL_SRCCOLORKEY, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_SetColorKey ((SDL_Surface *)canvas, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -918,7 +918,7 @@ SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smoo
|
||||
* Call the 8bit transformation routine to do the zooming
|
||||
*/
|
||||
zoomSurfaceY(rz_src, rz_dst);
|
||||
SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, rz_src->format->colorkey);
|
||||
SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY, rz_src->format->colorkey);
|
||||
}
|
||||
/*
|
||||
* Unlock source surface
|
||||
|
||||
@@ -509,7 +509,7 @@ TFB_FlushGraphics () // Only call from main thread!!
|
||||
int x = DC.data.image.x;
|
||||
int y = DC.data.image.y;
|
||||
|
||||
if (DC.data.image.UseScaling)
|
||||
if (DC.data.image.scale)
|
||||
TFB_BBox_RegisterCanvas (DC_image->ScaledImg, x, y);
|
||||
else
|
||||
TFB_BBox_RegisterCanvas (DC_image->NormalImg, x, y);
|
||||
@@ -524,7 +524,7 @@ TFB_FlushGraphics () // Only call from main thread!!
|
||||
}
|
||||
|
||||
TFB_DrawCanvas_Image (DC_image, x, y,
|
||||
DC.data.image.UseScaling, pal,
|
||||
DC.data.image.scale, pal,
|
||||
SDL_Screens[DC.data.image.destBuffer]);
|
||||
|
||||
break;
|
||||
@@ -535,13 +535,13 @@ TFB_FlushGraphics () // Only call from main thread!!
|
||||
int x = DC.data.filledimage.x;
|
||||
int y = DC.data.filledimage.y;
|
||||
|
||||
if (DC.data.filledimage.UseScaling)
|
||||
if (DC.data.filledimage.scale)
|
||||
TFB_BBox_RegisterCanvas (DC_image->ScaledImg, x, y);
|
||||
else
|
||||
TFB_BBox_RegisterCanvas (DC_image->NormalImg, x, y);
|
||||
|
||||
TFB_DrawCanvas_FilledImage (DC.data.filledimage.image, DC.data.filledimage.x, DC.data.filledimage.y,
|
||||
DC.data.filledimage.UseScaling, DC.data.filledimage.r, DC.data.filledimage.g,
|
||||
DC.data.filledimage.scale, DC.data.filledimage.r, DC.data.filledimage.g,
|
||||
DC.data.filledimage.b, SDL_Screens[DC.data.filledimage.destBuffer]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gfxintrn.h"
|
||||
|
||||
void
|
||||
DrawStamp (PSTAMP lpStamp)
|
||||
{
|
||||
SetPrimType (&_locPrim, STAMP_PRIM);
|
||||
_locPrim.Object.Stamp = *lpStamp;
|
||||
|
||||
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
||||
}
|
||||
|
||||
void
|
||||
DrawFilledStamp (PSTAMP lpStamp)
|
||||
{
|
||||
SetPrimType (&_locPrim, STAMPFILL_PRIM);
|
||||
_locPrim.Object.Stamp = *lpStamp;
|
||||
|
||||
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
||||
}
|
||||
|
||||
void
|
||||
DrawStampCMap (PSTAMP_CMAP lpStampCMap)
|
||||
{
|
||||
SetPrimType (&_locPrim, STAMPCMAP_PRIM);
|
||||
_locPrim.Object.StampCMap = *lpStampCMap;
|
||||
|
||||
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ TFB_FlushPaletteCache ()
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawScreen_Image (TFB_Image *img, int x, int y, BOOLEAN scaled, TFB_Palette *palette, SCREEN dest)
|
||||
TFB_DrawScreen_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *palette, SCREEN dest)
|
||||
{
|
||||
TFB_DrawCommand DC;
|
||||
|
||||
@@ -84,7 +84,7 @@ TFB_DrawScreen_Image (TFB_Image *img, int x, int y, BOOLEAN scaled, TFB_Palette
|
||||
DC.data.image.image = img;
|
||||
DC.data.image.x = x;
|
||||
DC.data.image.y = y;
|
||||
DC.data.image.UseScaling = scaled;
|
||||
DC.data.image.scale = (scale == 256) ? 0 : scale;
|
||||
|
||||
if (palette != NULL)
|
||||
{
|
||||
@@ -121,7 +121,7 @@ TFB_DrawScreen_Image (TFB_Image *img, int x, int y, BOOLEAN scaled, TFB_Palette
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, BOOLEAN scaled, int r, int g, int b, SCREEN dest)
|
||||
TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int g, int b, SCREEN dest)
|
||||
{
|
||||
TFB_DrawCommand DC;
|
||||
|
||||
@@ -129,7 +129,7 @@ TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, BOOLEAN scaled, int r,
|
||||
DC.data.filledimage.image = img;
|
||||
DC.data.filledimage.x = x;
|
||||
DC.data.filledimage.y = y;
|
||||
DC.data.filledimage.UseScaling = scaled;
|
||||
DC.data.filledimage.scale = (scale == 256) ? 0 : scale;
|
||||
DC.data.filledimage.r = r;
|
||||
DC.data.filledimage.g = g;
|
||||
DC.data.filledimage.b = b;
|
||||
@@ -226,19 +226,19 @@ TFB_DrawImage_Rect (PRECT rect, int r, int g, int b, TFB_Image *image)
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawImage_Image (TFB_Image *img, int x, int y, BOOLEAN scaled, TFB_Palette *palette, TFB_Image *target)
|
||||
TFB_DrawImage_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *palette, TFB_Image *target)
|
||||
{
|
||||
LockMutex (target->mutex);
|
||||
TFB_DrawCanvas_Image (img, x, y, scaled, palette, target->NormalImg);
|
||||
TFB_DrawCanvas_Image (img, x, y, scale, palette, target->NormalImg);
|
||||
target->dirty = TRUE;
|
||||
UnlockMutex (target->mutex);
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawImage_FilledImage (TFB_Image *img, int x, int y, BOOLEAN scaled, int r, int g, int b, TFB_Image *target)
|
||||
TFB_DrawImage_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int g, int b, TFB_Image *target)
|
||||
{
|
||||
LockMutex (target->mutex);
|
||||
TFB_DrawCanvas_FilledImage (img, x, y, scaled, r, g, b, target->NormalImg);
|
||||
TFB_DrawCanvas_FilledImage (img, x, y, scale, r, g, b, target->NormalImg);
|
||||
target->dirty = TRUE;
|
||||
UnlockMutex (target->mutex);
|
||||
}
|
||||
@@ -290,3 +290,33 @@ TFB_DrawImage_Delete (TFB_Image *image)
|
||||
|
||||
HFree (image);
|
||||
}
|
||||
|
||||
void
|
||||
TFB_DrawImage_FixScaling (TFB_Image *image, int target)
|
||||
{
|
||||
if (image->ScaledImg)
|
||||
{
|
||||
if (image->scale != target)
|
||||
{
|
||||
TFB_DrawCanvas_Delete(image->ScaledImg);
|
||||
image->ScaledImg = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!image->ScaledImg)
|
||||
{
|
||||
image->scale = target;
|
||||
image->dirty = FALSE;
|
||||
image->ScaledImg = TFB_DrawCanvas_New_Scaled (image->NormalImg, target);
|
||||
if (TFB_DrawCanvas_IsPaletted (image->ScaledImg))
|
||||
{
|
||||
int colorkey = TFB_DrawCanvas_GetTransparentIndex (image->NormalImg);
|
||||
|
||||
TFB_DrawCanvas_SetPalette (image->ScaledImg, image->Palette);
|
||||
if (colorkey != -1)
|
||||
{
|
||||
TFB_DrawCanvas_SetTransparentIndex (image->ScaledImg, colorkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,9 +55,9 @@ typedef struct tfb_image
|
||||
|
||||
void TFB_DrawScreen_Line (int x1, int y1, int x2, int y2, int r, int g, int b, SCREEN dest);
|
||||
void TFB_DrawScreen_Rect (PRECT rect, int r, int g, int b, SCREEN dest);
|
||||
void TFB_DrawScreen_Image (TFB_Image *img, int x, int y, BOOLEAN scaled, TFB_Palette *palette, SCREEN dest);
|
||||
void TFB_DrawScreen_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *palette, SCREEN dest);
|
||||
void TFB_DrawScreen_Copy (PRECT r, SCREEN src, SCREEN dest);
|
||||
void TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, BOOLEAN scaled, int r, int g, int b, SCREEN dest);
|
||||
void TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int g, int b, SCREEN dest);
|
||||
void TFB_DrawScreen_CopyToImage (TFB_Image *img, PRECT lpRect, SCREEN src);
|
||||
void TFB_DrawScreen_DeleteImage (TFB_Image *img);
|
||||
void TFB_DrawScreen_WaitForSignal (void);
|
||||
@@ -66,21 +66,28 @@ void TFB_FlushPaletteCache (void);
|
||||
|
||||
TFB_Image *TFB_DrawImage_New (TFB_Canvas canvas);
|
||||
void TFB_DrawImage_Delete (TFB_Image *image);
|
||||
void TFB_DrawImage_FixScaling (TFB_Image *image, int target);
|
||||
|
||||
void TFB_DrawImage_Line (int x1, int y1, int x2, int y2, int r, int g, int b, TFB_Image *dest);
|
||||
void TFB_DrawImage_Rect (PRECT rect, int r, int g, int b, TFB_Image *image);
|
||||
void TFB_DrawImage_Image (TFB_Image *img, int x, int y, BOOLEAN scaled, TFB_Palette *palette, TFB_Image *target);
|
||||
void TFB_DrawImage_FilledImage (TFB_Image *img, int x, int y, BOOLEAN scaled, int r, int g, int b, TFB_Image *target);
|
||||
void TFB_DrawImage_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *palette, TFB_Image *target);
|
||||
void TFB_DrawImage_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int g, int b, TFB_Image *target);
|
||||
|
||||
TFB_Canvas TFB_DrawCanvas_New_TrueColor (int w, int h, BOOLEAN hasalpha);
|
||||
TFB_Canvas TFB_DrawCanvas_New_Paletted (int w, int h, TFB_Palette *palette, int transparent_index);
|
||||
TFB_Canvas TFB_DrawCanvas_New_Scaled (TFB_Canvas src, int scale);
|
||||
TFB_Canvas TFB_DrawCanvas_ToScreenFormat (TFB_Canvas canvas);
|
||||
BOOLEAN TFB_DrawCanvas_IsPaletted (TFB_Canvas canvas);
|
||||
void TFB_DrawCanvas_Delete (TFB_Canvas canvas);
|
||||
|
||||
void TFB_DrawCanvas_Line (int x1, int y1, int x2, int y2, int r, int g, int b, TFB_Canvas dest);
|
||||
void TFB_DrawCanvas_Rect (PRECT rect, int r, int g, int b, TFB_Canvas image);
|
||||
void TFB_DrawCanvas_Image (TFB_Image *img, int x, int y, BOOLEAN scaled, TFB_Palette *palette, TFB_Canvas target);
|
||||
void TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, BOOLEAN scaled, int r, int g, int b, TFB_Canvas target);
|
||||
void TFB_DrawCanvas_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *palette, TFB_Canvas target);
|
||||
void TFB_DrawCanvas_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int g, int b, TFB_Canvas target);
|
||||
|
||||
TFB_Palette *TFB_DrawCanvas_ExtractPalette (TFB_Canvas canvas);
|
||||
void TFB_DrawCanvas_SetPalette (TFB_Canvas target, TFB_Palette *palette);
|
||||
int TFB_DrawCanvas_GetTransparentIndex (TFB_Canvas canvas);
|
||||
void TFB_DrawCanvas_SetTransparentIndex (TFB_Canvas canvas, int index);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
// Copyright Michael Martin, 2003
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* The original Primitive routines do various elaborate checks to
|
||||
* ensure we're within bounds for the clipping. Since clipping is
|
||||
* handled by the underlying TFB_Canvas implementation, we need not
|
||||
* worry about this. */
|
||||
|
||||
#include "gfxintrn.h"
|
||||
#include "tfb_draw.h"
|
||||
#include "tfb_prim.h"
|
||||
|
||||
void
|
||||
TFB_Prim_Point (PPOINT p, TFB_Palette *color)
|
||||
{
|
||||
RECT r;
|
||||
|
||||
r.corner.x = p->x - GetFrameHotX (_CurFramePtr);
|
||||
r.corner.y = p->y - GetFrameHotY (_CurFramePtr);
|
||||
r.extent.width = r.extent.height = 1;
|
||||
|
||||
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||
TFB_DrawScreen_Rect (&r, color->r, color->g, color->b, TFB_SCREEN_MAIN);
|
||||
else
|
||||
TFB_DrawImage_Rect (&r, color->r, color->g, color->b, _CurFramePtr->image);
|
||||
}
|
||||
|
||||
void
|
||||
TFB_Prim_Rect (PRECT r, TFB_Palette *color)
|
||||
{
|
||||
RECT arm;
|
||||
int gscale;
|
||||
gscale = GetGraphicScale ();
|
||||
if (!gscale)
|
||||
gscale = 256;
|
||||
arm = *r;
|
||||
arm.extent.width = r->extent.width;
|
||||
arm.extent.height = 1;
|
||||
TFB_Prim_FillRect (&arm, color);
|
||||
arm.extent.height = r->extent.height;
|
||||
arm.extent.width = 1;
|
||||
TFB_Prim_FillRect (&arm, color);
|
||||
arm.corner.x += ((r->extent.width * gscale) >> 8) - 1;
|
||||
TFB_Prim_FillRect (&arm, color);
|
||||
arm.corner.x = r->corner.x;
|
||||
arm.corner.y += ((r->extent.height * gscale) >> 8) - 1;
|
||||
arm.extent.width = r->extent.width;
|
||||
arm.extent.height = 1;
|
||||
TFB_Prim_FillRect (&arm, color);
|
||||
}
|
||||
|
||||
void
|
||||
TFB_Prim_FillRect (PRECT r, TFB_Palette *color)
|
||||
{
|
||||
RECT rect;
|
||||
int gscale;
|
||||
|
||||
rect.corner.x = r->corner.x - GetFrameHotX (_CurFramePtr);
|
||||
rect.corner.y = r->corner.y - GetFrameHotY (_CurFramePtr);
|
||||
rect.extent.width = r->extent.width;
|
||||
rect.extent.height = r->extent.height;
|
||||
|
||||
gscale = GetGraphicScale ();
|
||||
if (gscale)
|
||||
{
|
||||
rect.extent.width = (rect.extent.width * gscale) >> 8;
|
||||
rect.extent.height = (rect.extent.height * gscale) >> 8;
|
||||
rect.corner.x += (r->extent.width -
|
||||
rect.extent.width) >> 1;
|
||||
rect.corner.y += (r->extent.height -
|
||||
rect.extent.height) >> 1;
|
||||
}
|
||||
|
||||
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||
TFB_DrawScreen_Rect (&rect, color->r, color->g, color->b, TFB_SCREEN_MAIN);
|
||||
else
|
||||
TFB_DrawImage_Rect (&rect, color->r, color->g, color->b, _CurFramePtr->image);
|
||||
}
|
||||
|
||||
void
|
||||
TFB_Prim_Line (PLINE line, TFB_Palette *color)
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
|
||||
x1=line->first.x - GetFrameHotX (_CurFramePtr);
|
||||
y1=line->first.y - GetFrameHotY (_CurFramePtr);
|
||||
x2=line->second.x - GetFrameHotX (_CurFramePtr);
|
||||
y2=line->second.y - GetFrameHotY (_CurFramePtr);
|
||||
|
||||
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||
TFB_DrawScreen_Line (x1, y1, x2, y2, color->r, color->g, color->b, TFB_SCREEN_MAIN);
|
||||
else
|
||||
TFB_DrawImage_Line (x1, y1, x2, y2, color->r, color->g, color->b, _CurFramePtr->image);
|
||||
}
|
||||
|
||||
void
|
||||
TFB_Prim_Stamp (PSTAMP stmp)
|
||||
{
|
||||
int x, y;
|
||||
PFRAME_DESC SrcFramePtr;
|
||||
TFB_Image *img;
|
||||
BOOLEAN paletted;
|
||||
TFB_Palette palette[256];
|
||||
int gscale;
|
||||
|
||||
SrcFramePtr = (PFRAME_DESC)stmp->frame;
|
||||
img = SrcFramePtr->image;
|
||||
gscale = GetGraphicScale ();
|
||||
|
||||
if (!img)
|
||||
{
|
||||
fprintf (stderr, "Non-existent image to TFB_Prim_Stamp()\n");
|
||||
return;
|
||||
}
|
||||
|
||||
LockMutex (img->mutex);
|
||||
|
||||
x = stmp->origin.x - GetFrameHotX (_CurFramePtr) - GetFrameHotX (SrcFramePtr);
|
||||
y = stmp->origin.y - GetFrameHotY (_CurFramePtr) - GetFrameHotY (SrcFramePtr);
|
||||
paletted = FALSE;
|
||||
|
||||
if (gscale != 0 && gscale != 256)
|
||||
{
|
||||
TFB_DrawImage_FixScaling (img, gscale);
|
||||
x += (GetFrameHotX (SrcFramePtr) *
|
||||
((1 << 8) - gscale)) >> 8;
|
||||
y += (GetFrameHotY (SrcFramePtr) *
|
||||
((1 << 8) - gscale)) >> 8;
|
||||
}
|
||||
|
||||
if (TFB_DrawCanvas_IsPaletted(img->NormalImg) && img->colormap_index != -1)
|
||||
{
|
||||
TFB_ColorMapToRGB (palette, img->colormap_index);
|
||||
paletted = TRUE;
|
||||
}
|
||||
|
||||
UnlockMutex (img->mutex);
|
||||
|
||||
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||
{
|
||||
TFB_DrawScreen_Image (img, x, y, gscale, (paletted ? palette : NULL),
|
||||
TFB_SCREEN_MAIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
TFB_DrawImage_Image (img, x, y, gscale, (paletted ? palette : NULL),
|
||||
_CurFramePtr->image);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TFB_Prim_StampFill (PSTAMP stmp, TFB_Palette *color)
|
||||
{
|
||||
int x, y;
|
||||
PFRAME_DESC SrcFramePtr;
|
||||
TFB_Image *img;
|
||||
int r, g, b;
|
||||
int gscale;
|
||||
|
||||
SrcFramePtr = (PFRAME_DESC)stmp->frame;
|
||||
img = SrcFramePtr->image;
|
||||
gscale = GetGraphicScale ();
|
||||
|
||||
if (!img)
|
||||
{
|
||||
fprintf (stderr, "Non-existent image to TFB_Prim_StampFill()\n");
|
||||
return;
|
||||
}
|
||||
|
||||
LockMutex (img->mutex);
|
||||
|
||||
x = stmp->origin.x - GetFrameHotX (_CurFramePtr) - GetFrameHotX (SrcFramePtr);
|
||||
y = stmp->origin.y - GetFrameHotY (_CurFramePtr) - GetFrameHotY (SrcFramePtr);
|
||||
r = color->r;
|
||||
g = color->g;
|
||||
b = color->b;
|
||||
|
||||
if (gscale != 0 && gscale != 256)
|
||||
{
|
||||
TFB_DrawImage_FixScaling (img, gscale);
|
||||
x += (GetFrameHotX (SrcFramePtr) *
|
||||
((1 << 8) - gscale)) >> 8;
|
||||
y += (GetFrameHotY (SrcFramePtr) *
|
||||
((1 << 8) - gscale)) >> 8;
|
||||
}
|
||||
|
||||
UnlockMutex (img->mutex);
|
||||
|
||||
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||
{
|
||||
TFB_DrawScreen_FilledImage (img, x, y, gscale, r, g, b,
|
||||
TFB_SCREEN_MAIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
TFB_DrawImage_FilledImage (img, x, y, gscale, r, g, b,
|
||||
_CurFramePtr->image);
|
||||
}
|
||||
}
|
||||
|
||||
// Text rendering is in font.c, under the name _text_blt
|
||||
@@ -1,4 +1,4 @@
|
||||
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||
// Copyright Michael Martin, 2003
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -16,14 +16,13 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gfxintrn.h"
|
||||
#include "gfxlib.h"
|
||||
#include "tfb_draw.h"
|
||||
|
||||
void
|
||||
DrawLine (PLINE lpLine)
|
||||
{
|
||||
SetPrimType (&_locPrim, LINE_PRIM);
|
||||
_locPrim.Object.Line = *lpLine;
|
||||
|
||||
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
||||
}
|
||||
|
||||
void TFB_Prim_Line (PLINE line, TFB_Palette *color);
|
||||
void TFB_Prim_Point (PPOINT p, TFB_Palette *color);
|
||||
void TFB_Prim_Rect (PRECT r, TFB_Palette *color);
|
||||
void TFB_Prim_FillRect (PRECT r, TFB_Palette *color);
|
||||
void TFB_Prim_Stamp (PSTAMP stamp);
|
||||
void TFB_Prim_StampFill (PSTAMP stamp, TFB_Palette *color);
|
||||
@@ -37,7 +37,7 @@ InitOscilloscope (DWORD x, DWORD y, DWORD width, DWORD height, FRAME_DESC *f)
|
||||
scope_bg = TFB_DrawImage_New (scope_bg_canvas);
|
||||
scope_surf_canvas = TFB_DrawCanvas_New_Paletted (width, height, f->image->Palette, -1);
|
||||
scope_surf = TFB_DrawImage_New (scope_surf_canvas);
|
||||
TFB_DrawImage_Image (f->image, 0, 0, FALSE, NULL, scope_bg);
|
||||
TFB_DrawImage_Image (f->image, 0, 0, 0, NULL, scope_bg);
|
||||
scope_init = 1;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ Oscilloscope (DWORD grab_data)
|
||||
if (!grab_data)
|
||||
return;
|
||||
|
||||
TFB_DrawImage_Image (scope_bg, 0, 0, FALSE, NULL, scope_surf);
|
||||
TFB_DrawImage_Image (scope_bg, 0, 0, 0, NULL, scope_surf);
|
||||
if (GetSoundData (scope_data))
|
||||
{
|
||||
int i, r, g, b;
|
||||
@@ -77,7 +77,7 @@ Oscilloscope (DWORD grab_data)
|
||||
for (i = 0; i < RADAR_WIDTH - 1; ++i)
|
||||
TFB_DrawImage_Line (i, scope_data[i], i + 1, scope_data[i + 1], r, g, b, scope_surf);
|
||||
}
|
||||
TFB_DrawImage_Image (scope_surf, 0, 0, FALSE, NULL, scope_frame->image);
|
||||
TFB_DrawImage_Image (scope_surf, 0, 0, 0, NULL, scope_frame->image);
|
||||
|
||||
s.frame = scope_frame;
|
||||
s.origin.x = s.origin.y = 0;
|
||||
|
||||
@@ -221,7 +221,6 @@ DoInstallModule (INPUT_STATE InputState, PMENU_STATE pMS)
|
||||
SetSemaphore (GraphicsSem);
|
||||
|
||||
SetContext (SpaceContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
ClearSISRect (CLEAR_SIS_RADAR);
|
||||
SetFlashRect (NULL_PTR, (FRAME)0);
|
||||
goto InitFlash;
|
||||
@@ -608,7 +607,6 @@ DoOutfit (INPUT_STATE InputState, PMENU_STATE pMS)
|
||||
DrawSISTitle (GAME_STRING (STARBASE_STRING_BASE));
|
||||
|
||||
SetContext (SpaceContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
DrawStamp (&s);
|
||||
DestroyDrawable (ReleaseDrawable (s.frame));
|
||||
@@ -691,7 +689,6 @@ DoOutfit (INPUT_STATE InputState, PMENU_STATE pMS)
|
||||
}
|
||||
|
||||
SetContext (StatusContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
}
|
||||
else if ((InputState & DEVICE_BUTTON2)
|
||||
|| ((InputState & DEVICE_BUTTON1)
|
||||
|
||||
@@ -116,8 +116,6 @@ LoadPlanet (BOOLEAN IsDefined)
|
||||
}
|
||||
|
||||
SetContext (SpaceContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
|
||||
s.frame = pSolarSysState->PlanetSideFrame[2];
|
||||
if (s.frame)
|
||||
|
||||
@@ -111,7 +111,6 @@ RenderTopography (BOOLEAN Reconstruct)
|
||||
|
||||
OldContext = SetContext (TaskContext);
|
||||
OldFrame = SetContextFGFrame (pSolarSysState->TopoFrame);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
if (pSolarSysState->XlatRef == 0)
|
||||
{
|
||||
|
||||
@@ -243,7 +243,6 @@ DrawStarMap (COUNT race_update, PRECT pClipRect)
|
||||
STAMP s;
|
||||
FRAME star_frame;
|
||||
STAR_DESCPTR SDPtr;
|
||||
FRAME OldFrame;
|
||||
BOOLEAN draw_cursor;
|
||||
|
||||
if (pClipRect == (PRECT)-1)
|
||||
@@ -269,11 +268,8 @@ DrawStarMap (COUNT race_update, PRECT pClipRect)
|
||||
SetFrameHot (Screen,
|
||||
MAKE_HOT_SPOT (pClipRect->corner.x, pClipRect->corner.y));
|
||||
}
|
||||
OldFrame = SetContextBGFrame ((FRAME)0);
|
||||
BatchGraphics ();
|
||||
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
which_space = GET_GAME_STATE (ARILOU_SPACE_SIDE);
|
||||
|
||||
if (which_space <= 1)
|
||||
@@ -511,8 +507,6 @@ wprintf ("%s\n", buf);
|
||||
SetFrameHot (Screen, MAKE_HOT_SPOT (0, 0));
|
||||
}
|
||||
|
||||
SetContextBGFrame (OldFrame);
|
||||
|
||||
if (race_update == 0)
|
||||
{
|
||||
if (draw_cursor)
|
||||
@@ -1237,7 +1231,6 @@ DoFlagshipCommands (INPUT_STATE InputState, PMENU_STATE pMS)
|
||||
DrawSISTitle(GLOBAL_SIS(PlanetName));
|
||||
DrawStarBackGround(TRUE);
|
||||
OldContext = SetContext(SpaceContext);
|
||||
SetContextDrawState(DEST_PIXMAP | DRAW_REPLACE);
|
||||
BatchGraphics();
|
||||
DrawPlanet(SIS_SCREEN_WIDTH - MAP_WIDTH, SIS_SCREEN_HEIGHT - MAP_HEIGHT, 0, 0);
|
||||
UnbatchGraphics();
|
||||
|
||||
@@ -218,7 +218,6 @@ DoDiscoveryReport (SOUND ReadOutSounds)
|
||||
{
|
||||
POINT old_curs;
|
||||
CONTEXT OldContext;
|
||||
FRAME OldFrame;
|
||||
extern void DrawScannedObjects (BOOLEAN Reversed);
|
||||
|
||||
if (pMenuState)
|
||||
@@ -229,7 +228,6 @@ DoDiscoveryReport (SOUND ReadOutSounds)
|
||||
}
|
||||
|
||||
OldContext = SetContext (ScanContext);
|
||||
OldFrame = SetContextBGFrame ((FRAME)0);
|
||||
{
|
||||
FONT OldFont;
|
||||
|
||||
@@ -250,7 +248,6 @@ DoDiscoveryReport (SOUND ReadOutSounds)
|
||||
GetStringLength (pSolarSysState->SysInfo.PlanetInfo.DiscoveryString));
|
||||
SetContextFont (OldFont);
|
||||
}
|
||||
SetContextBGFrame (OldFrame);
|
||||
#ifdef OLD
|
||||
ClearDrawable ();
|
||||
if (pSolarSysState->MenuState.Initialized >= 3)
|
||||
|
||||
@@ -352,7 +352,6 @@ FreeSolarSys (void)
|
||||
SetSemaphore (GraphicsSem);
|
||||
|
||||
SetContext (SpaceContext);
|
||||
SetContextBGFrame ((FRAME)0);
|
||||
|
||||
StopMusic ();
|
||||
|
||||
@@ -936,7 +935,6 @@ ScaleSystem (void)
|
||||
GetContextClipRect (&r);
|
||||
SetGraphicGrabOther (1); // to grab from hidden screen (since we haven't flipped yet)
|
||||
LoadIntoExtraScreen (&r);
|
||||
SetContextBGFrame ((FRAME)0);
|
||||
SetGraphicGrabOther (0);
|
||||
SetContextFGFrame (Screen);
|
||||
|
||||
@@ -1437,8 +1435,6 @@ LoadLanderData ();
|
||||
DrawSISMessage (NULL_PTR);
|
||||
SetContext (SpaceContext);
|
||||
SetContextFGFrame (Screen);
|
||||
SetContextBGFrame ((FRAME)0);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
SetContextBackGroundColor (BLACK_COLOR);
|
||||
ClearSemaphore (GraphicsSem);
|
||||
|
||||
@@ -1760,8 +1756,6 @@ DrawStarBackGround (BOOLEAN ForPlanet)
|
||||
DWORD old_seed;
|
||||
|
||||
SetContext (SpaceContext);
|
||||
SetContextBGFrame ((FRAME)0);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
SetContextBackGroundColor (BLACK_COLOR);
|
||||
|
||||
ClearDrawable ();
|
||||
|
||||
@@ -183,8 +183,6 @@ TryAgain:
|
||||
black_buf[0] = FadeAllToBlack;
|
||||
|
||||
SetContext (ScreenContext);
|
||||
SetContextBGFrame ((FRAME)0);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
GLOBAL (CurrentActivity) |= CHECK_ABORT;
|
||||
if (GLOBAL_SIS (CrewEnlisted) == (COUNT)~0
|
||||
|
||||
@@ -1216,8 +1216,6 @@ DoShipyard (INPUT_STATE InputState, PMENU_STATE pMS)
|
||||
|
||||
SetSemaphore (GraphicsSem);
|
||||
SetContext (SpaceContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
s.origin.x = s.origin.y = 0;
|
||||
#ifdef USE_3DO_HANGAR
|
||||
DrawStamp (&s);
|
||||
|
||||
@@ -304,7 +304,6 @@ DoStarBase (INPUT_STATE InputState, PMENU_STATE pMS)
|
||||
|
||||
pMS->Initialized = TRUE;
|
||||
SetContext (ScreenContext);
|
||||
SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);
|
||||
|
||||
ClearSemaphore (GraphicsSem);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user