Uncouple text drawing from batching
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3402 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -88,7 +88,7 @@ extern BOOLEAN _ReleaseCelData (void *handle);
|
|||||||
extern FRAME _CurFramePtr;
|
extern FRAME _CurFramePtr;
|
||||||
|
|
||||||
// ClipRect is relative to ctxOrigin
|
// ClipRect is relative to ctxOrigin
|
||||||
extern void _text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr, POINT ctxOrigin);
|
extern void _text_blt (RECT *pClipRect, TEXT *TextPtr, POINT ctxOrigin);
|
||||||
|
|
||||||
#endif /* _DRAWABLE_H */
|
#endif /* _DRAWABLE_H */
|
||||||
|
|
||||||
|
|||||||
@@ -49,13 +49,24 @@ DestroyFont (FONT FontRef)
|
|||||||
return (FreeFont (FontRef));
|
return (FreeFont (FontRef));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX: Should be in frame.c (renamed to something decent?)
|
||||||
void
|
void
|
||||||
font_DrawText (TEXT *lpText)
|
font_DrawText (TEXT *lpText)
|
||||||
{
|
{
|
||||||
|
RECT ClipRect;
|
||||||
|
POINT origin;
|
||||||
|
TEXT text;
|
||||||
|
|
||||||
FixContextFontEffect ();
|
FixContextFontEffect ();
|
||||||
SetPrimType (&_locPrim, TEXT_PRIM);
|
if (!GraphicsSystemActive () || !GetContextValidRect (NULL, &origin))
|
||||||
_locPrim.Object.Text = *lpText;
|
return;
|
||||||
DrawBatch (&_locPrim, 0, BATCH_SINGLE);
|
|
||||||
|
// TextRect() clobbers TEXT.CharCount so we have to make a copy
|
||||||
|
text = *lpText;
|
||||||
|
if (!TextRect (&text, &ClipRect, NULL))
|
||||||
|
return;
|
||||||
|
// ClipRect is relative to origin
|
||||||
|
_text_blt (&ClipRect, &text, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the stroke by drawing the same text in the
|
/* Draw the stroke by drawing the same text in the
|
||||||
@@ -224,14 +235,12 @@ TextRect (TEXT *lpText, RECT *pRect, BYTE *pdelta)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr, POINT ctxOrigin)
|
_text_blt (RECT *pClipRect, TEXT *TextPtr, POINT ctxOrigin)
|
||||||
{
|
{
|
||||||
FONT FontPtr;
|
FONT FontPtr;
|
||||||
|
|
||||||
COUNT num_chars;
|
COUNT num_chars;
|
||||||
UniChar next_ch;
|
UniChar next_ch;
|
||||||
const unsigned char *pStr;
|
const unsigned char *pStr;
|
||||||
TEXT *TextPtr;
|
|
||||||
POINT origin;
|
POINT origin;
|
||||||
TFB_Image *backing;
|
TFB_Image *backing;
|
||||||
|
|
||||||
@@ -242,7 +251,6 @@ _text_blt (RECT *pClipRect, PRIMITIVE *PrimPtr, POINT ctxOrigin)
|
|||||||
if (!backing)
|
if (!backing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TextPtr = &PrimPtr->Object.Text;
|
|
||||||
origin.x = pClipRect->corner.x;
|
origin.x = pClipRect->corner.x;
|
||||||
origin.y = TextPtr->baseline.y;
|
origin.y = TextPtr->baseline.y;
|
||||||
num_chars = TextPtr->CharCount;
|
num_chars = TextPtr->CharCount;
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ DrawBatch (PRIMITIVE *lpBasePrim, PRIM_LINKS PrimLinks,
|
|||||||
if (!TextRect (&lpWorkPrim->Object.Text, &ClipRect, NULL))
|
if (!TextRect (&lpWorkPrim->Object.Text, &ClipRect, NULL))
|
||||||
continue;
|
continue;
|
||||||
// ClipRect is relative to origin
|
// ClipRect is relative to origin
|
||||||
_text_blt (&ClipRect, lpWorkPrim, origin);
|
_text_blt (&ClipRect, &lpWorkPrim->Object.Text, origin);
|
||||||
break;
|
break;
|
||||||
case RECT_PRIM:
|
case RECT_PRIM:
|
||||||
color = GetPrimColor (lpWorkPrim);
|
color = GetPrimColor (lpWorkPrim);
|
||||||
|
|||||||
Reference in New Issue
Block a user