From 96070f0c89722e509321b473eb121cfb5886c6d5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 Apr 2020 02:28:52 -0400 Subject: [PATCH] CGuiTextPane: Eliminate implicit float->int conversions --- Runtime/GuiSys/CGuiTextPane.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Runtime/GuiSys/CGuiTextPane.cpp b/Runtime/GuiSys/CGuiTextPane.cpp index 16c7a32c0..dafb36b8b 100644 --- a/Runtime/GuiSys/CGuiTextPane.cpp +++ b/Runtime/GuiSys/CGuiTextPane.cpp @@ -132,23 +132,22 @@ bool CGuiTextPane::TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2 } std::shared_ptr CGuiTextPane::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) { - CGuiWidgetParms parms = ReadWidgetHeader(frame, in); - zeus::CVector2f dim = zeus::CVector2f::ReadBig(in); - zeus::CVector3f vec = zeus::CVector3f::ReadBig(in); - u32 fontId = in.readUint32Big(); - bool wordWrap = in.readBool(); - bool horizontal = in.readBool(); - EJustification justification = EJustification(in.readUint32Big()); - EVerticalJustification vJustification = EVerticalJustification(in.readUint32Big()); - CGuiTextProperties props(wordWrap, horizontal, justification, vJustification); + const CGuiWidgetParms parms = ReadWidgetHeader(frame, in); + const zeus::CVector2f dim = zeus::CVector2f::ReadBig(in); + const zeus::CVector3f vec = zeus::CVector3f::ReadBig(in); + const u32 fontId = in.readUint32Big(); + const bool wordWrap = in.readBool(); + const bool horizontal = in.readBool(); + const auto justification = EJustification(in.readUint32Big()); + const auto vJustification = EVerticalJustification(in.readUint32Big()); + const CGuiTextProperties props(wordWrap, horizontal, justification, vJustification); zeus::CColor fontCol; fontCol.readRGBABig(in); zeus::CColor outlineCol; outlineCol.readRGBABig(in); - int extentX = in.readFloatBig(); - int extentY = in.readFloatBig(); - std::shared_ptr ret = - std::make_shared(parms, sp, dim, vec, fontId, props, fontCol, outlineCol, extentX, extentY); + const int extentX = static_cast(in.readFloatBig()); + const int extentY = static_cast(in.readFloatBig()); + auto ret = std::make_shared(parms, sp, dim, vec, fontId, props, fontCol, outlineCol, extentX, extentY); ret->ParseBaseInfo(frame, in, parms); ret->InitializeBuffers(); ret->TextSupport().SetText(u"");