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; wchar_t next_ch;
const unsigned char *pStr; const unsigned char *pStr;
TEXTPTR TextPtr; TEXTPTR TextPtr;
PRIMITIVE locPrim; STAMP s;
TFB_Palette color; TFB_Palette color;
FontPtr = _CurFontPtr; FontPtr = _CurFontPtr;
if (FontPtr == NULL) if (FontPtr == NULL)
return; return;
if (FontEffect.Use)
SetPrimType (&locPrim, STAMP_PRIM);
else
SetPrimType (&locPrim, STAMPFILL_PRIM);
{ {
DWORD c32k = _get_context_fg_color () >> 8; DWORD c32k = _get_context_fg_color () >> 8;
color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8); color.r = (UBYTE)((c32k >> (10 - (8 - 5))) & 0xF8);
@@ -271,8 +266,8 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
} }
TextPtr = &PrimPtr->Object.Text; TextPtr = &PrimPtr->Object.Text;
locPrim.Object.Stamp.origin.x = _save_stamp.origin.x; s.origin.x = _save_stamp.origin.x;
locPrim.Object.Stamp.origin.y = TextPtr->baseline.y; s.origin.y = TextPtr->baseline.y;
num_chars = TextPtr->CharCount; num_chars = TextPtr->CharCount;
if (num_chars == 0) if (num_chars == 0)
return; return;
@@ -294,43 +289,38 @@ _text_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
num_chars = 0; num_chars = 0;
} }
locPrim.Object.Stamp.frame = getCharFrame (FontPtr, ch); s.frame = getCharFrame (FontPtr, ch);
if (locPrim.Object.Stamp.frame != NULL && if (s.frame != NULL && GetFrameWidth (s.frame))
GetFrameWidth (locPrim.Object.Stamp.frame))
{ {
RECT r; RECT r;
r.corner.x = locPrim.Object.Stamp.origin.x r.corner.x = s.origin.x - ((FRAMEPTR)s.frame)->HotSpot.x;
- ((FRAMEPTR)locPrim.Object.Stamp.frame)->HotSpot.x; r.corner.y = s.origin.y - ((FRAMEPTR)s.frame)->HotSpot.y;
r.corner.y = locPrim.Object.Stamp.origin.y r.extent.width = GetFrameWidth (s.frame);
- ((FRAMEPTR)locPrim.Object.Stamp.frame)->HotSpot.y; r.extent.height = GetFrameHeight (s.frame);
r.extent.width = GetFrameWidth (locPrim.Object.Stamp.frame);
r.extent.height = GetFrameHeight (locPrim.Object.Stamp.frame);
_save_stamp.origin = r.corner; _save_stamp.origin = r.corner;
if (BoxIntersect (&r, pClipRect, &r)) if (BoxIntersect (&r, pClipRect, &r))
{ {
if (FontEffect.Use) if (FontEffect.Use)
{ {
FRAME origFrame = locPrim.Object.Stamp.frame; FRAME origFrame = s.frame;
locPrim.Object.Stamp.frame = Build_Font_Effect( s.frame = Build_Font_Effect(
locPrim.Object.Stamp.frame, FontEffect.from, s.frame, FontEffect.from,
FontEffect.to, FontEffect.type); FontEffect.to, FontEffect.type);
TFB_Prim_Stamp (&locPrim.Object.Stamp); TFB_Prim_Stamp (&s);
DestroyDrawable (ReleaseDrawable ( DestroyDrawable (ReleaseDrawable (s.frame));
locPrim.Object.Stamp.frame)); s.frame = origFrame;
locPrim.Object.Stamp.frame = origFrame;
} }
else else
TFB_Prim_StampFill (&locPrim.Object.Stamp, &color); TFB_Prim_StampFill (&s, &color);
} }
locPrim.Object.Stamp.origin.x += GetFrameWidth ( s.origin.x += GetFrameWidth (s.frame);
locPrim.Object.Stamp.frame);
#if 0 #if 0
if (num_chars && next_ch < (UNICODE) MAX_CHARS if (num_chars && next_ch < (UNICODE) MAX_CHARS
&& !(FontPtr->KernTab[ch] && !(FontPtr->KernTab[ch]
& (FontPtr->KernTab[next_ch] >> 2))) & (FontPtr->KernTab[next_ch] >> 2)))
locPrim.Object.Stamp.origin.x -= FontPtr->KernAmount; s.origin.x -= FontPtr->KernAmount;
#endif #endif
} }
} }
+2 -1
View File
@@ -46,7 +46,8 @@ typedef PINTERNAL_PRIM_DESC INTERNAL_PRIM_DESCPTR;
typedef struct typedef struct
{ {
PRIM_LINKS Links; PRIM_LINKS Links;
DWORD TypeAndColor; GRAPHICS_PRIM Type;
COLOR Color;
INTERNAL_PRIM_DESC Object; INTERNAL_PRIM_DESC Object;
} INTERNAL_PRIMITIVE; } INTERNAL_PRIMITIVE;
typedef INTERNAL_PRIMITIVE *PINTERNAL_PRIMITIVE; typedef INTERNAL_PRIMITIVE *PINTERNAL_PRIMITIVE;
+6 -15
View File
@@ -45,32 +45,23 @@ typedef DWORD PRIM_LINKS;
typedef struct typedef struct
{ {
PRIM_LINKS Links; PRIM_LINKS Links;
DWORD TypeAndColor; GRAPHICS_PRIM Type;
COLOR Color;
PRIM_DESC Object; PRIM_DESC Object;
} PRIMITIVE; } PRIMITIVE;
typedef PRIMITIVE *PPRIMITIVE; typedef PRIMITIVE *PPRIMITIVE;
#define END_OF_LIST ((COUNT)0xFFFF) #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 GetPredLink(l) LOWORD(l)
#define GetSuccLink(l) HIWORD(l) #define GetSuccLink(l) HIWORD(l)
#define MakeLinks MAKE_DWORD #define MakeLinks MAKE_DWORD
#define SetPrimLinks(pPrim,p,s) ((pPrim)->Links = MakeLinks (p, s)) #define SetPrimLinks(pPrim,p,s) ((pPrim)->Links = MakeLinks (p, s))
#define GetPrimLinks(pPrim) ((pPrim)->Links) #define GetPrimLinks(pPrim) ((pPrim)->Links)
#define SetPrimType(pPrim,t) \ #define SetPrimType(pPrim,t) ((pPrim)->Type = t)
((pPrim)->TypeAndColor = ((pPrim)->TypeAndColor & PRIM_COLOR_MASK) \ #define GetPrimType(pPrim) ((pPrim)->Type)
| ((t) & PRIM_TYPE_MASK)) #define SetPrimColor(pPrim,c) ((pPrim)->Color = c)
#define GetPrimType(pPrim) \ #define GetPrimColor(pPrim) ((pPrim)->Color)
((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))
static inline void static inline void
SetPrimNextLink (PPRIMITIVE pPrim, COUNT Link) SetPrimNextLink (PPRIMITIVE pPrim, COUNT Link)