Better context drawing origin semantics; also chaser fix for foreground frame hotspot left broken in r3401
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3407 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -164,6 +164,13 @@ typedef struct line
|
|||||||
POINT first, second;
|
POINT first, second;
|
||||||
} LINE;
|
} LINE;
|
||||||
|
|
||||||
|
static inline POINT
|
||||||
|
MAKE_POINT (COORD x, COORD y)
|
||||||
|
{
|
||||||
|
POINT pt = {x, y};
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
pointsEqual (POINT p1, POINT p2)
|
pointsEqual (POINT p1, POINT p2)
|
||||||
{
|
{
|
||||||
@@ -278,6 +285,8 @@ extern BOOLEAN SetContextClipRect (RECT *pRect);
|
|||||||
// The returned rect is always filled in. If the context cliprect
|
// The returned rect is always filled in. If the context cliprect
|
||||||
// is undefined, the returned rect has foreground frame dimensions.
|
// is undefined, the returned rect has foreground frame dimensions.
|
||||||
extern BOOLEAN GetContextClipRect (RECT *pRect);
|
extern BOOLEAN GetContextClipRect (RECT *pRect);
|
||||||
|
// The actual origin will be orgOffset + context ClipRect.corner
|
||||||
|
extern POINT SetContextOrigin (POINT orgOffset);
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -249,6 +249,12 @@ GetContextClipRect (RECT *lpRect)
|
|||||||
return (_pCurContext->ClipRect.extent.width != 0);
|
return (_pCurContext->ClipRect.extent.width != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
POINT
|
||||||
|
SetContextOrigin (POINT orgOffset)
|
||||||
|
{
|
||||||
|
// XXX: This is a hack, kind of. But that's what the original did.
|
||||||
|
return SetFrameHot (_CurFramePtr, orgOffset);
|
||||||
|
}
|
||||||
|
|
||||||
FRAME
|
FRAME
|
||||||
SetContextFontEffect (FRAME EffectFrame)
|
SetContextFontEffect (FRAME EffectFrame)
|
||||||
|
|||||||
+5
-3
@@ -363,6 +363,7 @@ RepairMeleeFrame (RECT *pRect)
|
|||||||
RECT r;
|
RECT r;
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
RECT OldRect;
|
RECT OldRect;
|
||||||
|
POINT oldOrigin;
|
||||||
|
|
||||||
r.corner.x = pRect->corner.x + SAFE_X;
|
r.corner.x = pRect->corner.x + SAFE_X;
|
||||||
r.corner.y = pRect->corner.y + SAFE_Y;
|
r.corner.y = pRect->corner.y + SAFE_Y;
|
||||||
@@ -376,8 +377,9 @@ RepairMeleeFrame (RECT *pRect)
|
|||||||
OldContext = SetContext (SpaceContext);
|
OldContext = SetContext (SpaceContext);
|
||||||
GetContextClipRect (&OldRect);
|
GetContextClipRect (&OldRect);
|
||||||
SetContextClipRect (&r);
|
SetContextClipRect (&r);
|
||||||
SetFrameHot (Screen,
|
// Offset the origin so that we draw the correct gfx in the cliprect
|
||||||
MAKE_HOT_SPOT (r.corner.x - SAFE_X, r.corner.y - SAFE_Y));
|
oldOrigin = SetContextOrigin (MAKE_POINT (-r.corner.x + SAFE_X,
|
||||||
|
-r.corner.y + SAFE_Y));
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
|
|
||||||
DrawMeleeIcon (0); /* Entire melee screen */
|
DrawMeleeIcon (0); /* Entire melee screen */
|
||||||
@@ -413,7 +415,7 @@ RepairMeleeFrame (RECT *pRect)
|
|||||||
DrawPickFrame (pMeleeState);
|
DrawPickFrame (pMeleeState);
|
||||||
|
|
||||||
UnbatchGraphics ();
|
UnbatchGraphics ();
|
||||||
SetFrameHot (Screen, MAKE_HOT_SPOT (0, 0));
|
SetContextOrigin (oldOrigin);
|
||||||
SetContextClipRect (&OldRect);
|
SetContextClipRect (&OldRect);
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,10 +128,10 @@ RenderTopography (FRAME DstFrame, BYTE *pTopoData, int w, int h)
|
|||||||
BYTE *pSrc;
|
BYTE *pSrc;
|
||||||
BYTE *xlat_tab;
|
BYTE *xlat_tab;
|
||||||
BYTE *cbase;
|
BYTE *cbase;
|
||||||
HOT_SPOT OldHot;
|
POINT oldOrigin;
|
||||||
RECT ClipRect;
|
RECT ClipRect;
|
||||||
|
|
||||||
OldHot = SetFrameHot (DstFrame, MAKE_HOT_SPOT (0, 0));
|
oldOrigin = SetContextOrigin (MAKE_POINT (0, 0));
|
||||||
GetContextClipRect (&ClipRect);
|
GetContextClipRect (&ClipRect);
|
||||||
SetContextClipRect (NULL);
|
SetContextClipRect (NULL);
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ RenderTopography (FRAME DstFrame, BYTE *pTopoData, int w, int h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetContextClipRect (&ClipRect);
|
SetContextClipRect (&ClipRect);
|
||||||
SetFrameHot (DstFrame, OldHot);
|
SetContextOrigin (oldOrigin);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetContextFGFrame (OldFrame);
|
SetContextFGFrame (OldFrame);
|
||||||
|
|||||||
@@ -287,6 +287,7 @@ DrawStarMap (COUNT race_update, RECT *pClipRect)
|
|||||||
COUNT which_space;
|
COUNT which_space;
|
||||||
long diameter;
|
long diameter;
|
||||||
RECT r, old_r;
|
RECT r, old_r;
|
||||||
|
POINT oldOrigin;
|
||||||
STAMP s;
|
STAMP s;
|
||||||
FRAME star_frame;
|
FRAME star_frame;
|
||||||
STAR_DESC *SDPtr;
|
STAR_DESC *SDPtr;
|
||||||
@@ -312,8 +313,9 @@ DrawStarMap (COUNT race_update, RECT *pClipRect)
|
|||||||
SetContextClipRect (pClipRect);
|
SetContextClipRect (pClipRect);
|
||||||
pClipRect->corner.x -= old_r.corner.x;
|
pClipRect->corner.x -= old_r.corner.x;
|
||||||
pClipRect->corner.y -= old_r.corner.y;
|
pClipRect->corner.y -= old_r.corner.y;
|
||||||
SetFrameHot (Screen,
|
// Offset the origin so that we draw the correct gfx in the cliprect
|
||||||
MAKE_HOT_SPOT (pClipRect->corner.x, pClipRect->corner.y));
|
oldOrigin = SetContextOrigin (MAKE_POINT (-pClipRect->corner.x,
|
||||||
|
-pClipRect->corner.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transition_pending)
|
if (transition_pending)
|
||||||
@@ -548,7 +550,7 @@ printf ("%s\n", buf);
|
|||||||
if (pClipRect)
|
if (pClipRect)
|
||||||
{
|
{
|
||||||
SetContextClipRect (&old_r);
|
SetContextClipRect (&old_r);
|
||||||
SetFrameHot (Screen, MAKE_HOT_SPOT (0, 0));
|
SetContextOrigin (oldOrigin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (race_update == 0)
|
if (race_update == 0)
|
||||||
|
|||||||
+1
-1
@@ -107,7 +107,7 @@ LoadKernel (int argc, char *argv[])
|
|||||||
|
|
||||||
SetContext (ScreenContext);
|
SetContext (ScreenContext);
|
||||||
SetContextFGFrame (Screen);
|
SetContextFGFrame (Screen);
|
||||||
SetFrameHot (Screen, MAKE_HOT_SPOT (0, 0));
|
SetContextOrigin (MAKE_POINT (0, 0));
|
||||||
|
|
||||||
hResIndex = (RESOURCE_INDEX) InitResourceSystem ();
|
hResIndex = (RESOURCE_INDEX) InitResourceSystem ();
|
||||||
if (hResIndex == 0)
|
if (hResIndex == 0)
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ InitShipStatus (SHIP_INFO *SIPtr, STARSHIP *StarShipPtr, RECT *pClipRect)
|
|||||||
COORD y = 0; // default, for Melee menu
|
COORD y = 0; // default, for Melee menu
|
||||||
STAMP Stamp;
|
STAMP Stamp;
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
|
RECT oldClipRect;
|
||||||
|
POINT oldOrigin;
|
||||||
|
|
||||||
if (StarShipPtr) // set during battle
|
if (StarShipPtr) // set during battle
|
||||||
{
|
{
|
||||||
@@ -149,14 +151,16 @@ InitShipStatus (SHIP_INFO *SIPtr, STARSHIP *StarShipPtr, RECT *pClipRect)
|
|||||||
OldContext = SetContext (StatusContext);
|
OldContext = SetContext (StatusContext);
|
||||||
if (pClipRect)
|
if (pClipRect)
|
||||||
{
|
{
|
||||||
GetContextClipRect (&r);
|
GetContextClipRect (&oldClipRect);
|
||||||
|
r = oldClipRect;
|
||||||
r.corner.x += pClipRect->corner.x;
|
r.corner.x += pClipRect->corner.x;
|
||||||
r.corner.y += (pClipRect->corner.y & ~1);
|
r.corner.y += (pClipRect->corner.y & ~1);
|
||||||
r.extent = pClipRect->extent;
|
r.extent = pClipRect->extent;
|
||||||
r.extent.height += pClipRect->corner.y & 1;
|
r.extent.height += pClipRect->corner.y & 1;
|
||||||
SetContextClipRect (&r);
|
SetContextClipRect (&r);
|
||||||
SetFrameHot (Screen, MAKE_HOT_SPOT (
|
// Offset the origin so that we draw into the cliprect
|
||||||
pClipRect->corner.x, (pClipRect->corner.y & ~1)));
|
oldOrigin = SetContextOrigin (MAKE_POINT (-pClipRect->corner.x,
|
||||||
|
-(pClipRect->corner.y & ~1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
@@ -291,12 +295,8 @@ InitShipStatus (SHIP_INFO *SIPtr, STARSHIP *StarShipPtr, RECT *pClipRect)
|
|||||||
|
|
||||||
if (pClipRect)
|
if (pClipRect)
|
||||||
{
|
{
|
||||||
SetFrameHot (Screen, MAKE_HOT_SPOT (0, 0));
|
SetContextOrigin (oldOrigin);
|
||||||
r.corner.x = SPACE_WIDTH + SAFE_X;
|
SetContextClipRect (&oldClipRect);
|
||||||
r.corner.y = SAFE_Y;
|
|
||||||
r.extent.width = STATUS_WIDTH;
|
|
||||||
r.extent.height = STATUS_HEIGHT;
|
|
||||||
SetContextClipRect (&r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
|
|||||||
+3
-3
@@ -144,7 +144,7 @@ PauseGame (void)
|
|||||||
STAMP s;
|
STAMP s;
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
FRAME F;
|
FRAME F;
|
||||||
HOT_SPOT OldHot;
|
POINT oldOrigin;
|
||||||
RECT OldRect;
|
RECT OldRect;
|
||||||
|
|
||||||
if (ActivityFrame == 0
|
if (ActivityFrame == 0
|
||||||
@@ -159,7 +159,7 @@ PauseGame (void)
|
|||||||
|
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
OldContext = SetContext (ScreenContext);
|
OldContext = SetContext (ScreenContext);
|
||||||
OldHot = SetFrameHot (Screen, MAKE_HOT_SPOT (0, 0));
|
oldOrigin = SetContextOrigin (MAKE_POINT (0, 0));
|
||||||
GetContextClipRect (&OldRect);
|
GetContextClipRect (&OldRect);
|
||||||
SetContextClipRect (NULL);
|
SetContextClipRect (NULL);
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ PauseGame (void)
|
|||||||
ClearSystemRect ();
|
ClearSystemRect ();
|
||||||
|
|
||||||
SetContextClipRect (&OldRect);
|
SetContextClipRect (&OldRect);
|
||||||
SetFrameHot (Screen, OldHot);
|
SetContextOrigin (oldOrigin);
|
||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
|
|
||||||
WaitForNoInput (ONE_SECOND / 4, TRUE);
|
WaitForNoInput (ONE_SECOND / 4, TRUE);
|
||||||
|
|||||||
Reference in New Issue
Block a user