- Fixed: DCanvas::DrawTextV needs to accept the entire tag list in one parameter. Otherwise, it

can't pass it to DrawTexture with a simple TAG_MORE. (Not sure why I thought the initial tag
  needed to be separate, though it did catch one case where it wasn't provided.)

SVN r3351 (trunk)
This commit is contained in:
Randy Heit 2012-02-11 00:15:03 +00:00
parent 68fbd75897
commit e4728ba6f0
2 changed files with 13 additions and 12 deletions

View file

@ -78,7 +78,7 @@ void STACK_ARGS DCanvas::DrawChar (FFont *font, int normalcolor, int x, int y, B
// //
// Write a string using the given font // Write a string using the given font
// //
void DCanvas::DrawTextV(FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag1, va_list taglist) void DCanvas::DrawTextV(FFont *font, int normalcolor, int x, int y, const char *string, va_list taglist)
{ {
INTBOOL boolval; INTBOOL boolval;
va_list tags; va_list tags;
@ -122,7 +122,7 @@ void DCanvas::DrawTextV(FFont *font, int normalcolor, int x, int y, const char *
#else #else
tags = taglist; tags = taglist;
#endif #endif
tag = tag1; tag = va_arg(tags, uint32);
while (tag != TAG_DONE) while (tag != TAG_DONE)
{ {
@ -209,6 +209,7 @@ void DCanvas::DrawTextV(FFont *font, int normalcolor, int x, int y, const char *
} }
tag = va_arg (tags, uint32); tag = va_arg (tags, uint32);
} }
va_end(tags);
height *= scaley; height *= scaley;
@ -242,7 +243,6 @@ void DCanvas::DrawTextV(FFont *font, int normalcolor, int x, int y, const char *
#else #else
tags = taglist; tags = taglist;
#endif #endif
tag = tag1;
if (forcedwidth) if (forcedwidth)
{ {
w = forcedwidth; w = forcedwidth;
@ -262,21 +262,22 @@ void DCanvas::DrawTextV(FFont *font, int normalcolor, int x, int y, const char *
} }
cx += (w + kerning) * scalex; cx += (w + kerning) * scalex;
} }
va_end(taglist);
} }
void STACK_ARGS DCanvas::DrawText (FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag, ...) void STACK_ARGS DCanvas::DrawText (FFont *font, int normalcolor, int x, int y, const char *string, ...)
{ {
va_list tags; va_list tags;
va_start(tags, tag); va_start(tags, string);
DrawTextV(font, normalcolor, x, y, string, tag, tags); DrawTextV(font, normalcolor, x, y, string, tags);
} }
// A synonym so that this can still be used in files that #include Windows headers // A synonym so that this can still be used in files that #include Windows headers
void STACK_ARGS DCanvas::DrawTextA (FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag, ...) void STACK_ARGS DCanvas::DrawTextA (FFont *font, int normalcolor, int x, int y, const char *string, ...)
{ {
va_list tags; va_list tags;
va_start(tags, tag); va_start(tags, string);
DrawTextV(font, normalcolor, x, y, string, tag, tags); DrawTextV(font, normalcolor, x, y, string, tags);
} }
// //

View file

@ -214,11 +214,11 @@ public:
void VirtualToRealCoordsInt(int &x, int &y, int &w, int &h, int vwidth, int vheight, bool vbottom=false, bool handleaspect=true) const; void VirtualToRealCoordsInt(int &x, int &y, int &w, int &h, int vwidth, int vheight, bool vbottom=false, bool handleaspect=true) const;
// 2D Text drawing // 2D Text drawing
void STACK_ARGS DrawText (FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag, ...); void STACK_ARGS DrawText (FFont *font, int normalcolor, int x, int y, const char *string, ...);
#ifndef DrawText // See WinUser.h for the definition of DrawText as a macro #ifndef DrawText // See WinUser.h for the definition of DrawText as a macro
void STACK_ARGS DrawTextA (FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag, ...); void STACK_ARGS DrawTextA (FFont *font, int normalcolor, int x, int y, const char *string, ...);
#endif #endif
void DrawTextV (FFont *font, int normalcolor, int x, int y, const char *string, uint32 tag, va_list tags); void DrawTextV (FFont *font, int normalcolor, int x, int y, const char *string, va_list tags);
void STACK_ARGS DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, ...); void STACK_ARGS DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, ...);
struct DrawParms struct DrawParms