Bug #702 fixes; disposed of locPrim in _text_blt; removed manual bit-packing from PRIMITIVE

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1582 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2005-03-16 12:50:16 +00:00
parent 4d9150023f
commit 1b2c3544fb
3 changed files with 26 additions and 44 deletions
+18 -28
View File
@@ -251,18 +251,13 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
wchar_t next_ch;
const unsigned char *pStr;
TEXTPTR TextPtr;
PRIMITIVE locPrim;
STAMP s;
TFB_Palette color;
FontPtr = _CurFontPtr;
if (FontPtr == NULL)
return;
if (FontEffect.Use)
SetPrimType (&locPrim, STAMP_PRIM);
else
SetPrimType (&locPrim, STAMPFILL_PRIM);
{
DWORD c32k = _get_context_fg_color () >> 8;
color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
@@ -271,8 +266,8 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
}
TextPtr = &PrimPtr->Object.Text;
locPrim.Object.Stamp.origin.x = _save_stamp.origin.x;
locPrim.Object.Stamp.origin.y = TextPtr->baseline.y;
s.origin.x = _save_stamp.origin.x;
s.origin.y = TextPtr->baseline.y;
num_chars = TextPtr->CharCount;
if (num_chars == 0)
return;
@@ -294,43 +289,38 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
num_chars = 0;
}
locPrim.Object.Stamp.frame = getCharFrame (FontPtr, ch);
if (locPrim.Object.Stamp.frame != NULL &&
GetFrameWidth (locPrim.Object.Stamp.frame))
s.frame = getCharFrame (FontPtr, ch);
if (s.frame != NULL && GetFrameWidth (s.frame))
{
RECT r;
r.corner.x = locPrim.Object.Stamp.origin.x
- ((FRAMEPTR)locPrim.Object.Stamp.frame)->HotSpot.x;
r.corner.y = locPrim.Object.Stamp.origin.y
- ((FRAMEPTR)locPrim.Object.Stamp.frame)->HotSpot.y;
r.extent.width = GetFrameWidth (locPrim.Object.Stamp.frame);
r.extent.height = GetFrameHeight (locPrim.Object.Stamp.frame);
r.corner.x = s.origin.x - ((FRAMEPTR)s.frame)->HotSpot.x;
r.corner.y = s.origin.y - ((FRAMEPTR)s.frame)->HotSpot.y;
r.extent.width = GetFrameWidth (s.frame);
r.extent.height = GetFrameHeight (s.frame);
_save_stamp.origin = r.corner;
if (BoxIntersect (&r, pClipRect, &r))
{
if (FontEffect.Use)
{
FRAME origFrame = locPrim.Object.Stamp.frame;
locPrim.Object.Stamp.frame = Build_Font_Effect(
locPrim.Object.Stamp.frame, FontEffect.from,
FRAME origFrame = s.frame;
s.frame = Build_Font_Effect(
s.frame, FontEffect.from,
FontEffect.to, FontEffect.type);
TFB_Prim_Stamp (&locPrim.Object.Stamp);
DestroyDrawable (ReleaseDrawable (
locPrim.Object.Stamp.frame));
locPrim.Object.Stamp.frame = origFrame;
TFB_Prim_Stamp (&s);
DestroyDrawable (ReleaseDrawable (s.frame));
s.frame = origFrame;
}
else
TFB_Prim_StampFill (&locPrim.Object.Stamp, &color);
TFB_Prim_StampFill (&s, &color);
}
locPrim.Object.Stamp.origin.x += GetFrameWidth (
locPrim.Object.Stamp.frame);
s.origin.x += GetFrameWidth (s.frame);
#if 0
if (num_chars && next_ch < (UNICODE) MAX_CHARS
&& !(FontPtr->KernTab[ch]
& (FontPtr->KernTab[next_ch] >> 2)))
locPrim.Object.Stamp.origin.x -= FontPtr->KernAmount;
s.origin.x -= FontPtr->KernAmount;
#endif
}
}
+2 -1
View File
@@ -46,7 +46,8 @@ typedef PINTERNAL_PRIM_DESC INTERNAL_PRIM_DESCPTR;
typedef struct
{
PRIM_LINKS Links;
DWORD TypeAndColor;
GRAPHICS_PRIM Type;
COLOR Color;
INTERNAL_PRIM_DESC Object;
} INTERNAL_PRIMITIVE;
typedef INTERNAL_PRIMITIVE *PINTERNAL_PRIMITIVE;
+6 -15
View File
@@ -45,32 +45,23 @@ typedef DWORD PRIM_LINKS;
typedef struct
{
PRIM_LINKS Links;
DWORD TypeAndColor;
GRAPHICS_PRIM Type;
COLOR Color;
PRIM_DESC Object;
} PRIMITIVE;
typedef PRIMITIVE *PPRIMITIVE;
#define END_OF_LIST ((COUNT)0xFFFF)
#define PRIM_COLOR_SHIFT 8
#define PRIM_COLOR_MASK ((DWORD)~0L << PRIM_COLOR_SHIFT)
#define PRIM_TYPE_MASK (~PRIM_COLOR_MASK)
#define GetPredLink(l) LOWORD(l)
#define GetSuccLink(l) HIWORD(l)
#define MakeLinks MAKE_DWORD
#define SetPrimLinks(pPrim,p,s) ((pPrim)->Links = MakeLinks (p, s))
#define GetPrimLinks(pPrim) ((pPrim)->Links)
#define SetPrimType(pPrim,t) \
((pPrim)->TypeAndColor = ((pPrim)->TypeAndColor & PRIM_COLOR_MASK) \
| ((t) & PRIM_TYPE_MASK))
#define GetPrimType(pPrim) \
((GRAPHICS_PRIM)LOBYTE ((pPrim)->TypeAndColor))
#define SetPrimColor(pPrim,c) \
((pPrim)->TypeAndColor = ((pPrim)->TypeAndColor & PRIM_TYPE_MASK) \
| ((c) << PRIM_COLOR_SHIFT))
#define GetPrimColor(pPrim) \
((COLOR)((pPrim)->TypeAndColor >> PRIM_COLOR_SHIFT))
#define SetPrimType(pPrim,t) ((pPrim)->Type = t)
#define GetPrimType(pPrim) ((pPrim)->Type)
#define SetPrimColor(pPrim,c) ((pPrim)->Color = c)
#define GetPrimColor(pPrim) ((pPrim)->Color)
static inline void
SetPrimNextLink (PPRIMITIVE pPrim, COUNT Link)