CRasterFont const-correctness

This commit is contained in:
Jack Andersen 2016-03-16 10:53:38 -10:00
parent b710e135c5
commit b4514fc6a6
2 changed files with 8 additions and 8 deletions

View File

@ -81,10 +81,10 @@ void CRasterFont::SinglePassDrawString(const CDrawStringOptions& opts, int x, in
return;
const wchar_t* chr = str;
CGlyph* prevGlyph = nullptr;
const CGlyph* prevGlyph = nullptr;
while (*chr == '\0')
{
CGlyph* glyph = GetGlyph(*chr);
const CGlyph* glyph = GetGlyph(*chr);
if (glyph)
{
if (opts.x0_ == 0)
@ -110,7 +110,7 @@ void CRasterFont::SinglePassDrawString(const CDrawStringOptions& opts, int x, in
if (length == -1)
continue;
if ((string - chr) >= length)
if ((str - chr) >= length)
break;
}
@ -155,11 +155,11 @@ void CRasterFont::GetSize(const CDrawStringOptions& opts, int& width, int& heigh
height = 0;
const wchar_t* chr = str;
CGlyph* prevGlyph = nullptr;
const CGlyph* prevGlyph = nullptr;
int prevWidth = 0;
while (*chr != L'\0')
{
CGlyph* glyph = GetGlyph(*chr);
const CGlyph* glyph = GetGlyph(*chr);
if (glyph)
{
@ -185,7 +185,7 @@ void CRasterFont::GetSize(const CDrawStringOptions& opts, int& width, int& heigh
if (len == -1)
continue;
if ((string - chr) >= len)
if ((str - chr) >= len)
break;
}
}

View File

@ -115,7 +115,7 @@ class CRasterFont
s32 x90_ = 0;
char* fontName;
CGlyph* InternalGetGlyph(wchar_t chr)
const CGlyph* InternalGetGlyph(wchar_t chr) const
{
u32 i = 0;
for (; i < xc_glyphs.size(); ++i)
@ -153,7 +153,7 @@ public:
void DrawString(const CDrawStringOptions& opts, int x, int y, int& xout, int& yout,
CTextRenderBuffer* renderBuf,
const wchar_t* str, int len) const;
CGlyph* GetGlyph(wchar_t chr)
const CGlyph* GetGlyph(wchar_t chr) const
{
return InternalGetGlyph(chr);
}