From b4514fc6a697d4cba6455dabbd838be5fe5cb49a Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 16 Mar 2016 10:53:38 -1000 Subject: [PATCH] CRasterFont const-correctness --- Runtime/GuiSys/CRasterFont.cpp | 12 ++++++------ Runtime/GuiSys/CRasterFont.hpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Runtime/GuiSys/CRasterFont.cpp b/Runtime/GuiSys/CRasterFont.cpp index ac3906a46..0bb630368 100644 --- a/Runtime/GuiSys/CRasterFont.cpp +++ b/Runtime/GuiSys/CRasterFont.cpp @@ -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; } } diff --git a/Runtime/GuiSys/CRasterFont.hpp b/Runtime/GuiSys/CRasterFont.hpp index 582da7284..6fad88ccc 100644 --- a/Runtime/GuiSys/CRasterFont.hpp +++ b/Runtime/GuiSys/CRasterFont.hpp @@ -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); }