Make context cliprect + foreground frame hotspot semantics actually sane; do not hack _CurFramePtr->HotSpot
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3401 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -247,8 +247,11 @@ extern Color GetContextBackGroundColor (void);
|
|||||||
extern FRAME SetContextFGFrame (FRAME Frame);
|
extern FRAME SetContextFGFrame (FRAME Frame);
|
||||||
extern FRAME GetContextFGFrame (void);
|
extern FRAME GetContextFGFrame (void);
|
||||||
extern BOOLEAN SetContextClipping (BOOLEAN ClipStatus);
|
extern BOOLEAN SetContextClipping (BOOLEAN ClipStatus);
|
||||||
|
// Context cliprect defines the drawing bounds. Additionally, all
|
||||||
|
// drawing positions (x,y) are relative to the cliprect corner.
|
||||||
extern BOOLEAN SetContextClipRect (RECT *pRect);
|
extern BOOLEAN SetContextClipRect (RECT *pRect);
|
||||||
extern BOOLEAN GetContextClipRect (RECT *pRect);
|
extern BOOLEAN GetContextClipRect (RECT *pRect);
|
||||||
|
|
||||||
extern TIME_VALUE DrawablesIntersect (INTERSECT_CONTROL *pControl0,
|
extern TIME_VALUE DrawablesIntersect (INTERSECT_CONTROL *pControl0,
|
||||||
INTERSECT_CONTROL *pControl1, TIME_VALUE max_time_val);
|
INTERSECT_CONTROL *pControl1, TIME_VALUE max_time_val);
|
||||||
extern void DrawStamp (STAMP *pStamp);
|
extern void DrawStamp (STAMP *pStamp);
|
||||||
@@ -264,7 +267,6 @@ extern void DrawBatch (PRIMITIVE *pBasePrim, PRIM_LINKS PrimLinks,
|
|||||||
extern void BatchGraphics (void);
|
extern void BatchGraphics (void);
|
||||||
extern void UnbatchGraphics (void);
|
extern void UnbatchGraphics (void);
|
||||||
extern void FlushGraphics (void);
|
extern void FlushGraphics (void);
|
||||||
extern void ClearBackGround (RECT *pClipRect);
|
|
||||||
extern void ClearDrawable (void);
|
extern void ClearDrawable (void);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
extern CONTEXT CreateContextAux (const char *name);
|
extern CONTEXT CreateContextAux (const char *name);
|
||||||
@@ -297,6 +299,7 @@ extern DRAWABLE LoadDisplayPixmap (RECT *area, FRAME frame);
|
|||||||
extern FRAME SetContextFontEffect (FRAME EffectFrame);
|
extern FRAME SetContextFontEffect (FRAME EffectFrame);
|
||||||
extern FONT SetContextFont (FONT Font);
|
extern FONT SetContextFont (FONT Font);
|
||||||
extern BOOLEAN DestroyFont (FONT FontRef);
|
extern BOOLEAN DestroyFont (FONT FontRef);
|
||||||
|
// The returned pRect is relative to the context drawing origin
|
||||||
extern BOOLEAN TextRect (TEXT *pText, RECT *pRect, BYTE *pdelta);
|
extern BOOLEAN TextRect (TEXT *pText, RECT *pRect, BYTE *pdelta);
|
||||||
extern BOOLEAN GetContextFontLeading (SIZE *pheight);
|
extern BOOLEAN GetContextFontLeading (SIZE *pheight);
|
||||||
extern BOOLEAN GetContextFontLeadingWidth (SIZE *pwidth);
|
extern BOOLEAN GetContextFontLeadingWidth (SIZE *pwidth);
|
||||||
|
|||||||
@@ -152,5 +152,8 @@ extern GRAPHICS_STATUS _GraphicsStatusFlags;
|
|||||||
(_GraphicsStatusFlags & (GRAPHICS_STATUS)(GRAPHICS_ACTIVE \
|
(_GraphicsStatusFlags & (GRAPHICS_STATUS)(GRAPHICS_ACTIVE \
|
||||||
| GRAPHICS_VISIBLE))
|
| GRAPHICS_VISIBLE))
|
||||||
|
|
||||||
|
// pValidRect or origin may be NULL
|
||||||
|
BOOLEAN GetContextValidRect (RECT *pValidRect, POINT *origin);
|
||||||
|
|
||||||
#endif /* _CONTEXT_H */
|
#endif /* _CONTEXT_H */
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ struct drawable_desc
|
|||||||
|
|
||||||
#define GetFrameWidth(f) ((f)->Bounds.width)
|
#define GetFrameWidth(f) ((f)->Bounds.width)
|
||||||
#define GetFrameHeight(f) ((f)->Bounds.height)
|
#define GetFrameHeight(f) ((f)->Bounds.height)
|
||||||
|
#define GetFrameBounds(f) ((f)->Bounds)
|
||||||
#define SetFrameBounds(f,w,h) \
|
#define SetFrameBounds(f,w,h) \
|
||||||
((f)->Bounds.width=(w), \
|
((f)->Bounds.width=(w), \
|
||||||
((f))->Bounds.height=(h))
|
((f))->Bounds.height=(h))
|
||||||
@@ -84,11 +85,10 @@ extern INTERSECT_CODE _clip_line (RECT *pClipRect, BRESENHAM_LINE *pLine);
|
|||||||
extern void *_GetCelData (uio_Stream *fp, DWORD length);
|
extern void *_GetCelData (uio_Stream *fp, DWORD length);
|
||||||
extern BOOLEAN _ReleaseCelData (void *handle);
|
extern BOOLEAN _ReleaseCelData (void *handle);
|
||||||
|
|
||||||
extern STAMP _save_stamp;
|
|
||||||
extern FRAME _CurFramePtr;
|
extern FRAME _CurFramePtr;
|
||||||
|
|
||||||
extern void _rect_blt (RECT *pClipRect, PRIMITIVE *PrimPtr);
|
// ClipRect is relative to ctxOrigin
|
||||||
extern void _text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr);
|
extern void _text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr, POINT ctxOrigin);
|
||||||
|
|
||||||
#endif /* _DRAWABLE_H */
|
#endif /* _DRAWABLE_H */
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ font_DrawText (TEXT *lpText)
|
|||||||
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Draw the stroke by drawing the same text in the
|
/* Draw the stroke by drawing the same text in the
|
||||||
* background color one pixel shifted to all 4 directions.
|
* background color one pixel shifted to all 4 directions.
|
||||||
*/
|
*/
|
||||||
@@ -225,7 +224,7 @@ TextRect (TEXT *lpText, RECT *pRect, BYTE *pdelta)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr)
|
_text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr, POINT ctxOrigin)
|
||||||
{
|
{
|
||||||
FONT FontPtr;
|
FONT FontPtr;
|
||||||
|
|
||||||
@@ -244,7 +243,7 @@ _text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TextPtr = &PrimPtr->Object.Text;
|
TextPtr = &PrimPtr->Object.Text;
|
||||||
origin.x = _save_stamp.origin.x;
|
origin.x = pClipRect->corner.x;
|
||||||
origin.y = TextPtr->baseline.y;
|
origin.y = TextPtr->baseline.y;
|
||||||
num_chars = TextPtr->CharCount;
|
num_chars = TextPtr->CharCount;
|
||||||
if (num_chars == 0)
|
if (num_chars == 0)
|
||||||
@@ -277,10 +276,9 @@ _text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr)
|
|||||||
r.corner.y = origin.y - fontChar->HotSpot.y;
|
r.corner.y = origin.y - fontChar->HotSpot.y;
|
||||||
r.extent.width = fontChar->disp.width;
|
r.extent.width = fontChar->disp.width;
|
||||||
r.extent.height = fontChar->disp.height;
|
r.extent.height = fontChar->disp.height;
|
||||||
_save_stamp.origin = r.corner;
|
|
||||||
if (BoxIntersect (&r, pClipRect, &r))
|
if (BoxIntersect (&r, pClipRect, &r))
|
||||||
{
|
{
|
||||||
TFB_Prim_FontChar (&origin, fontChar, backing);
|
TFB_Prim_FontChar (origin, fontChar, backing, ctxOrigin);
|
||||||
}
|
}
|
||||||
|
|
||||||
origin.x += fontChar->disp.width;
|
origin.x += fontChar->disp.width;
|
||||||
|
|||||||
@@ -48,43 +48,51 @@ typedef struct
|
|||||||
INTERNAL_PRIM_DESC Object;
|
INTERNAL_PRIM_DESC Object;
|
||||||
} INTERNAL_PRIMITIVE;
|
} INTERNAL_PRIMITIVE;
|
||||||
|
|
||||||
STAMP _save_stamp;
|
|
||||||
|
|
||||||
static BOOLEAN
|
// pValidRect or origin may be NULL
|
||||||
GetFrameValidRect (RECT *pValidRect, HOT_SPOT *pOldHot)
|
BOOLEAN
|
||||||
|
GetContextValidRect (RECT *pValidRect, POINT *origin)
|
||||||
{
|
{
|
||||||
COORD hx, hy;
|
RECT tempRect;
|
||||||
HOT_SPOT OldHot;
|
POINT tempPt;
|
||||||
|
|
||||||
|
if (!pValidRect)
|
||||||
|
pValidRect = &tempRect;
|
||||||
|
if (!origin)
|
||||||
|
origin = &tempPt;
|
||||||
|
|
||||||
|
// Start with a rect the size of foreground frame
|
||||||
|
pValidRect->corner.x = 0;
|
||||||
|
pValidRect->corner.y = 0;
|
||||||
|
pValidRect->extent = GetFrameBounds (_CurFramePtr);
|
||||||
|
*origin = _CurFramePtr->HotSpot;
|
||||||
|
|
||||||
OldHot = _CurFramePtr->HotSpot;
|
|
||||||
hx = OldHot.x;
|
|
||||||
hy = OldHot.y;
|
|
||||||
pValidRect->corner.x = hx;
|
|
||||||
pValidRect->corner.y = hy;
|
|
||||||
pValidRect->extent.width = GetFrameWidth (_CurFramePtr);
|
|
||||||
pValidRect->extent.height = GetFrameHeight (_CurFramePtr);
|
|
||||||
if (_pCurContext->ClipRect.extent.width)
|
if (_pCurContext->ClipRect.extent.width)
|
||||||
{
|
{
|
||||||
|
// If the cliprect is completely outside of the valid frame
|
||||||
|
// bounds we have nothing to draw
|
||||||
if (!BoxIntersect (&_pCurContext->ClipRect,
|
if (!BoxIntersect (&_pCurContext->ClipRect,
|
||||||
pValidRect, pValidRect))
|
pValidRect, pValidRect))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
|
||||||
hx -= _pCurContext->ClipRect.corner.x;
|
// Foreground frame hotspot defines a drawing position offset
|
||||||
hy -= _pCurContext->ClipRect.corner.y;
|
// WRT the context cliprect
|
||||||
pValidRect->corner.x += hx;
|
origin->x += _pCurContext->ClipRect.corner.x;
|
||||||
pValidRect->corner.y += hy;
|
origin->y += _pCurContext->ClipRect.corner.y;
|
||||||
_CurFramePtr->HotSpot = MAKE_HOT_SPOT (hx, hy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*pOldHot = OldHot;
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ClearBackGround (RECT *pClipRect)
|
ClearBackGround (RECT *pClipRect)
|
||||||
{
|
{
|
||||||
|
RECT clearRect;
|
||||||
Color color = _get_context_bg_color ();
|
Color color = _get_context_bg_color ();
|
||||||
TFB_Prim_FillRect (pClipRect, color);
|
clearRect.corner.x = 0;
|
||||||
|
clearRect.corner.y = 0;
|
||||||
|
clearRect.extent = pClipRect->extent;
|
||||||
|
TFB_Prim_FillRect (&clearRect, color, pClipRect->corner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -92,9 +100,9 @@ DrawBatch (PRIMITIVE *lpBasePrim, PRIM_LINKS PrimLinks,
|
|||||||
BATCH_FLAGS BatchFlags)
|
BATCH_FLAGS BatchFlags)
|
||||||
{
|
{
|
||||||
RECT ValidRect;
|
RECT ValidRect;
|
||||||
HOT_SPOT OldHot;
|
POINT origin;
|
||||||
|
|
||||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
if (GraphicsSystemActive () && GetContextValidRect (&ValidRect, &origin))
|
||||||
{
|
{
|
||||||
COUNT CurIndex;
|
COUNT CurIndex;
|
||||||
PRIM_LINKS OldLinks;
|
PRIM_LINKS OldLinks;
|
||||||
@@ -145,43 +153,39 @@ DrawBatch (PRIMITIVE *lpBasePrim, PRIM_LINKS PrimLinks,
|
|||||||
{
|
{
|
||||||
case POINT_PRIM:
|
case POINT_PRIM:
|
||||||
color = GetPrimColor (lpWorkPrim);
|
color = GetPrimColor (lpWorkPrim);
|
||||||
TFB_Prim_Point (&lpWorkPrim->Object.Point, color);
|
TFB_Prim_Point (&lpWorkPrim->Object.Point, color, origin);
|
||||||
break;
|
break;
|
||||||
case STAMP_PRIM:
|
case STAMP_PRIM:
|
||||||
TFB_Prim_Stamp (&lpWorkPrim->Object.Stamp);
|
TFB_Prim_Stamp (&lpWorkPrim->Object.Stamp, origin);
|
||||||
break;
|
break;
|
||||||
case STAMPFILL_PRIM:
|
case STAMPFILL_PRIM:
|
||||||
color = GetPrimColor (lpWorkPrim);
|
color = GetPrimColor (lpWorkPrim);
|
||||||
TFB_Prim_StampFill (&lpWorkPrim->Object.Stamp, color);
|
TFB_Prim_StampFill (&lpWorkPrim->Object.Stamp, color,
|
||||||
|
origin);
|
||||||
break;
|
break;
|
||||||
case LINE_PRIM:
|
case LINE_PRIM:
|
||||||
color = GetPrimColor (lpWorkPrim);
|
color = GetPrimColor (lpWorkPrim);
|
||||||
TFB_Prim_Line (&lpWorkPrim->Object.Line, color);
|
TFB_Prim_Line (&lpWorkPrim->Object.Line, color, origin);
|
||||||
break;
|
break;
|
||||||
case TEXT_PRIM:
|
case TEXT_PRIM:
|
||||||
if (!TextRect (&lpWorkPrim->Object.Text,
|
if (!TextRect (&lpWorkPrim->Object.Text, &ClipRect, NULL))
|
||||||
&ClipRect, NULL))
|
|
||||||
continue;
|
continue;
|
||||||
|
// ClipRect is relative to origin
|
||||||
_save_stamp.origin = ClipRect.corner;
|
_text_blt (&ClipRect, lpWorkPrim, origin);
|
||||||
|
|
||||||
_text_blt (&ClipRect, lpWorkPrim);
|
|
||||||
break;
|
break;
|
||||||
case RECT_PRIM:
|
case RECT_PRIM:
|
||||||
color = GetPrimColor (lpWorkPrim);
|
color = GetPrimColor (lpWorkPrim);
|
||||||
TFB_Prim_Rect (&lpWorkPrim->Object.Rect, color);
|
TFB_Prim_Rect (&lpWorkPrim->Object.Rect, color, origin);
|
||||||
break;
|
break;
|
||||||
case RECTFILL_PRIM:
|
case RECTFILL_PRIM:
|
||||||
color = GetPrimColor (lpWorkPrim);
|
color = GetPrimColor (lpWorkPrim);
|
||||||
TFB_Prim_FillRect (&lpWorkPrim->Object.Rect, color);
|
TFB_Prim_FillRect (&lpWorkPrim->Object.Rect, color, origin);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
|
|
||||||
_CurFramePtr->HotSpot = OldHot;
|
|
||||||
|
|
||||||
if (BatchFlags & BATCH_SINGLE)
|
if (BatchFlags & BATCH_SINGLE)
|
||||||
SetPrimLinks (lpBasePrim,
|
SetPrimLinks (lpBasePrim,
|
||||||
GetPredLink (OldLinks), GetSuccLink (OldLinks));
|
GetPredLink (OldLinks), GetSuccLink (OldLinks));
|
||||||
@@ -192,98 +196,81 @@ void
|
|||||||
ClearDrawable (void)
|
ClearDrawable (void)
|
||||||
{
|
{
|
||||||
RECT ValidRect;
|
RECT ValidRect;
|
||||||
HOT_SPOT OldHot;
|
|
||||||
|
|
||||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
if (GraphicsSystemActive () && GetContextValidRect (&ValidRect, NULL))
|
||||||
{
|
{
|
||||||
BatchGraphics ();
|
|
||||||
ClearBackGround (&ValidRect);
|
ClearBackGround (&ValidRect);
|
||||||
UnbatchGraphics ();
|
|
||||||
|
|
||||||
_CurFramePtr->HotSpot = OldHot;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DrawPoint (POINT *lpPoint)
|
DrawPoint (POINT *lpPoint)
|
||||||
{
|
{
|
||||||
RECT ValidRect;
|
POINT origin;
|
||||||
HOT_SPOT OldHot;
|
|
||||||
|
|
||||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
if (GraphicsSystemActive () && GetContextValidRect (NULL, &origin))
|
||||||
{
|
{
|
||||||
Color color = GetPrimColor (&_locPrim);
|
Color color = GetPrimColor (&_locPrim);
|
||||||
TFB_Prim_Point (lpPoint, color);
|
TFB_Prim_Point (lpPoint, color, origin);
|
||||||
_CurFramePtr->HotSpot = OldHot;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DrawRectangle (RECT *lpRect)
|
DrawRectangle (RECT *lpRect)
|
||||||
{
|
{
|
||||||
RECT ValidRect;
|
POINT origin;
|
||||||
HOT_SPOT OldHot;
|
|
||||||
|
|
||||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
if (GraphicsSystemActive () && GetContextValidRect (NULL, &origin))
|
||||||
{
|
{
|
||||||
Color color = GetPrimColor (&_locPrim);
|
Color color = GetPrimColor (&_locPrim);
|
||||||
TFB_Prim_Rect (lpRect, color);
|
TFB_Prim_Rect (lpRect, color, origin);
|
||||||
_CurFramePtr->HotSpot = OldHot;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DrawFilledRectangle (RECT *lpRect)
|
DrawFilledRectangle (RECT *lpRect)
|
||||||
{
|
{
|
||||||
RECT ValidRect;
|
POINT origin;
|
||||||
HOT_SPOT OldHot;
|
|
||||||
|
|
||||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
if (GraphicsSystemActive () && GetContextValidRect (NULL, &origin))
|
||||||
{
|
{
|
||||||
Color color = GetPrimColor (&_locPrim);
|
Color color = GetPrimColor (&_locPrim);
|
||||||
TFB_Prim_FillRect (lpRect, color);
|
TFB_Prim_FillRect (lpRect, color, origin);
|
||||||
_CurFramePtr->HotSpot = OldHot;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DrawLine (LINE *lpLine)
|
DrawLine (LINE *lpLine)
|
||||||
{
|
{
|
||||||
RECT ValidRect;
|
POINT origin;
|
||||||
HOT_SPOT OldHot;
|
|
||||||
|
|
||||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
if (GraphicsSystemActive () && GetContextValidRect (NULL, &origin))
|
||||||
{
|
{
|
||||||
Color color = GetPrimColor (&_locPrim);
|
Color color = GetPrimColor (&_locPrim);
|
||||||
TFB_Prim_Line (lpLine, color);
|
TFB_Prim_Line (lpLine, color, origin);
|
||||||
_CurFramePtr->HotSpot = OldHot;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DrawStamp (STAMP *stmp)
|
DrawStamp (STAMP *stmp)
|
||||||
{
|
{
|
||||||
RECT ValidRect;
|
POINT origin;
|
||||||
HOT_SPOT OldHot;
|
|
||||||
|
|
||||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
if (GraphicsSystemActive () && GetContextValidRect (NULL, &origin))
|
||||||
{
|
{
|
||||||
TFB_Prim_Stamp (stmp);
|
TFB_Prim_Stamp (stmp, origin);
|
||||||
_CurFramePtr->HotSpot = OldHot;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DrawFilledStamp (STAMP *stmp)
|
DrawFilledStamp (STAMP *stmp)
|
||||||
{
|
{
|
||||||
RECT ValidRect;
|
POINT origin;
|
||||||
HOT_SPOT OldHot;
|
|
||||||
|
|
||||||
if (GraphicsSystemActive () && GetFrameValidRect (&ValidRect, &OldHot))
|
if (GraphicsSystemActive () && GetContextValidRect (NULL, &origin))
|
||||||
{
|
{
|
||||||
Color color = GetPrimColor (&_locPrim);
|
Color color = GetPrimColor (&_locPrim);
|
||||||
TFB_Prim_StampFill (stmp, color);
|
TFB_Prim_StampFill (stmp, color, origin);
|
||||||
_CurFramePtr->HotSpot = OldHot;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,12 +29,12 @@
|
|||||||
#include "libs/log.h"
|
#include "libs/log.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_Prim_Point (POINT *p, Color color)
|
TFB_Prim_Point (POINT *p, Color color, POINT ctxOrigin)
|
||||||
{
|
{
|
||||||
RECT r;
|
RECT r;
|
||||||
|
|
||||||
r.corner.x = p->x - _CurFramePtr->HotSpot.x;
|
r.corner.x = p->x + ctxOrigin.x;
|
||||||
r.corner.y = p->y - _CurFramePtr->HotSpot.y;
|
r.corner.y = p->y + ctxOrigin.y;
|
||||||
r.extent.width = r.extent.height = 1;
|
r.extent.width = r.extent.height = 1;
|
||||||
|
|
||||||
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
||||||
@@ -44,7 +44,7 @@ TFB_Prim_Point (POINT *p, Color color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_Prim_Rect (RECT *r, Color color)
|
TFB_Prim_Rect (RECT *r, Color color, POINT ctxOrigin)
|
||||||
{
|
{
|
||||||
RECT arm;
|
RECT arm;
|
||||||
int gscale;
|
int gscale;
|
||||||
@@ -52,30 +52,30 @@ TFB_Prim_Rect (RECT *r, Color color)
|
|||||||
arm = *r;
|
arm = *r;
|
||||||
arm.extent.width = r->extent.width;
|
arm.extent.width = r->extent.width;
|
||||||
arm.extent.height = 1;
|
arm.extent.height = 1;
|
||||||
TFB_Prim_FillRect (&arm, color);
|
TFB_Prim_FillRect (&arm, color, ctxOrigin);
|
||||||
arm.extent.height = r->extent.height;
|
arm.extent.height = r->extent.height;
|
||||||
arm.extent.width = 1;
|
arm.extent.width = 1;
|
||||||
TFB_Prim_FillRect (&arm, color);
|
TFB_Prim_FillRect (&arm, color, ctxOrigin);
|
||||||
// rounding error correction here
|
// rounding error correction here
|
||||||
arm.corner.x += ((r->extent.width * gscale + (GSCALE_IDENTITY >> 1))
|
arm.corner.x += ((r->extent.width * gscale + (GSCALE_IDENTITY >> 1))
|
||||||
/ GSCALE_IDENTITY) - 1;
|
/ GSCALE_IDENTITY) - 1;
|
||||||
TFB_Prim_FillRect (&arm, color);
|
TFB_Prim_FillRect (&arm, color, ctxOrigin);
|
||||||
arm.corner.x = r->corner.x;
|
arm.corner.x = r->corner.x;
|
||||||
arm.corner.y += ((r->extent.height * gscale + (GSCALE_IDENTITY >> 1))
|
arm.corner.y += ((r->extent.height * gscale + (GSCALE_IDENTITY >> 1))
|
||||||
/ GSCALE_IDENTITY) - 1;
|
/ GSCALE_IDENTITY) - 1;
|
||||||
arm.extent.width = r->extent.width;
|
arm.extent.width = r->extent.width;
|
||||||
arm.extent.height = 1;
|
arm.extent.height = 1;
|
||||||
TFB_Prim_FillRect (&arm, color);
|
TFB_Prim_FillRect (&arm, color, ctxOrigin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_Prim_FillRect (RECT *r, Color color)
|
TFB_Prim_FillRect (RECT *r, Color color, POINT ctxOrigin)
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
int gscale;
|
int gscale;
|
||||||
|
|
||||||
rect.corner.x = r->corner.x - _CurFramePtr->HotSpot.x;
|
rect.corner.x = r->corner.x + ctxOrigin.x;
|
||||||
rect.corner.y = r->corner.y - _CurFramePtr->HotSpot.y;
|
rect.corner.y = r->corner.y + ctxOrigin.y;
|
||||||
rect.extent.width = r->extent.width;
|
rect.extent.width = r->extent.width;
|
||||||
rect.extent.height = r->extent.height;
|
rect.extent.height = r->extent.height;
|
||||||
|
|
||||||
@@ -97,14 +97,14 @@ TFB_Prim_FillRect (RECT *r, Color color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_Prim_Line (LINE *line, Color color)
|
TFB_Prim_Line (LINE *line, Color color, POINT ctxOrigin)
|
||||||
{
|
{
|
||||||
int x1, y1, x2, y2;
|
int x1, y1, x2, y2;
|
||||||
|
|
||||||
x1=line->first.x - _CurFramePtr->HotSpot.x;
|
x1=line->first.x + ctxOrigin.x;
|
||||||
y1=line->first.y - _CurFramePtr->HotSpot.y;
|
y1=line->first.y + ctxOrigin.y;
|
||||||
x2=line->second.x - _CurFramePtr->HotSpot.x;
|
x2=line->second.x + ctxOrigin.x;
|
||||||
y2=line->second.y - _CurFramePtr->HotSpot.y;
|
y2=line->second.y + ctxOrigin.y;
|
||||||
|
|
||||||
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
||||||
TFB_DrawScreen_Line (x1, y1, x2, y2, color, TFB_SCREEN_MAIN);
|
TFB_DrawScreen_Line (x1, y1, x2, y2, color, TFB_SCREEN_MAIN);
|
||||||
@@ -113,7 +113,7 @@ TFB_Prim_Line (LINE *line, Color color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_Prim_Stamp (STAMP *stmp)
|
TFB_Prim_Stamp (STAMP *stmp, POINT ctxOrigin)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
FRAME SrcFramePtr;
|
FRAME SrcFramePtr;
|
||||||
@@ -140,8 +140,8 @@ TFB_Prim_Stamp (STAMP *stmp)
|
|||||||
LockMutex (img->mutex);
|
LockMutex (img->mutex);
|
||||||
|
|
||||||
img->NormalHs = SrcFramePtr->HotSpot;
|
img->NormalHs = SrcFramePtr->HotSpot;
|
||||||
x = stmp->origin.x - _CurFramePtr->HotSpot.x;
|
x = stmp->origin.x + ctxOrigin.x;
|
||||||
y = stmp->origin.y - _CurFramePtr->HotSpot.y;
|
y = stmp->origin.y + ctxOrigin.y;
|
||||||
|
|
||||||
if (TFB_DrawCanvas_IsPaletted(img->NormalImg) && img->colormap_index != -1)
|
if (TFB_DrawCanvas_IsPaletted(img->NormalImg) && img->colormap_index != -1)
|
||||||
{
|
{
|
||||||
@@ -162,7 +162,7 @@ TFB_Prim_Stamp (STAMP *stmp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_Prim_StampFill (STAMP *stmp, Color color)
|
TFB_Prim_StampFill (STAMP *stmp, Color color, POINT ctxOrigin)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
FRAME SrcFramePtr;
|
FRAME SrcFramePtr;
|
||||||
@@ -188,8 +188,8 @@ TFB_Prim_StampFill (STAMP *stmp, Color color)
|
|||||||
LockMutex (img->mutex);
|
LockMutex (img->mutex);
|
||||||
|
|
||||||
img->NormalHs = SrcFramePtr->HotSpot;
|
img->NormalHs = SrcFramePtr->HotSpot;
|
||||||
x = stmp->origin.x - _CurFramePtr->HotSpot.x;
|
x = stmp->origin.x + ctxOrigin.x;
|
||||||
y = stmp->origin.y - _CurFramePtr->HotSpot.y;
|
y = stmp->origin.y + ctxOrigin.y;
|
||||||
|
|
||||||
UnlockMutex (img->mutex);
|
UnlockMutex (img->mutex);
|
||||||
|
|
||||||
@@ -205,12 +205,13 @@ TFB_Prim_StampFill (STAMP *stmp, Color color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_Prim_FontChar (POINT *origin, TFB_Char *fontChar, TFB_Image *backing)
|
TFB_Prim_FontChar (POINT charOrigin, TFB_Char *fontChar, TFB_Image *backing,
|
||||||
|
POINT ctxOrigin)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
x = origin->x - _CurFramePtr->HotSpot.x;
|
x = charOrigin.x + ctxOrigin.x;
|
||||||
y = origin->y - _CurFramePtr->HotSpot.y;
|
y = charOrigin.y + ctxOrigin.y;
|
||||||
|
|
||||||
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
if (_CurFramePtr->Type == SCREEN_DRAWABLE)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,11 +20,11 @@
|
|||||||
#include "tfb_draw.h"
|
#include "tfb_draw.h"
|
||||||
|
|
||||||
|
|
||||||
void TFB_Prim_Line (LINE *line, Color color);
|
void TFB_Prim_Line (LINE *line, Color color, POINT ctxOrigin);
|
||||||
void TFB_Prim_Point (POINT *p, Color color);
|
void TFB_Prim_Point (POINT *p, Color color, POINT ctxOrigin);
|
||||||
void TFB_Prim_Rect (RECT *r, Color color);
|
void TFB_Prim_Rect (RECT *r, Color color, POINT ctxOrigin);
|
||||||
void TFB_Prim_FillRect (RECT *r, Color color);
|
void TFB_Prim_FillRect (RECT *r, Color color, POINT ctxOrigin);
|
||||||
void TFB_Prim_Stamp (STAMP *stamp);
|
void TFB_Prim_Stamp (STAMP *stamp, POINT ctxOrigin);
|
||||||
void TFB_Prim_StampFill (STAMP *stamp, Color color);
|
void TFB_Prim_StampFill (STAMP *stamp, Color color, POINT ctxOrigin);
|
||||||
void TFB_Prim_FontChar (POINT *origin, TFB_Char *fontChar,
|
void TFB_Prim_FontChar (POINT charOrigin, TFB_Char *fontChar,
|
||||||
TFB_Image *backing);
|
TFB_Image *backing, POINT ctxOrigin);
|
||||||
|
|||||||
Reference in New Issue
Block a user