CGuiTextSupport: Invert conditionals where applicable

Unindents code and allows for easier placement of breakpoints when the
conditions are equal to the early exit path.
This commit is contained in:
Lioncash 2020-04-23 02:39:37 -04:00
parent 787fc3276f
commit b700da547e
1 changed files with 39 additions and 25 deletions

View File

@ -230,17 +230,21 @@ void CGuiTextSupport::Render() {
void CGuiTextSupport::SetGeometryColor(const zeus::CColor& col) { x2c_geometryColor = col; } void CGuiTextSupport::SetGeometryColor(const zeus::CColor& col) { x2c_geometryColor = col; }
void CGuiTextSupport::SetOutlineColor(const zeus::CColor& col) { void CGuiTextSupport::SetOutlineColor(const zeus::CColor& col) {
if (col != x28_outlineColor) { if (col == x28_outlineColor) {
ClearRenderBuffer(); return;
x28_outlineColor = col;
} }
ClearRenderBuffer();
x28_outlineColor = col;
} }
void CGuiTextSupport::SetFontColor(const zeus::CColor& col) { void CGuiTextSupport::SetFontColor(const zeus::CColor& col) {
if (col != x24_fontColor) { if (col == x24_fontColor) {
ClearRenderBuffer(); return;
x24_fontColor = col;
} }
ClearRenderBuffer();
x24_fontColor = col;
} }
void CGuiTextSupport::AddText(std::u16string_view str) { void CGuiTextSupport::AddText(std::u16string_view str) {
@ -253,14 +257,16 @@ void CGuiTextSupport::AddText(std::u16string_view str) {
} }
void CGuiTextSupport::SetText(std::u16string_view str, bool multipage) { void CGuiTextSupport::SetText(std::u16string_view str, bool multipage) {
if (x0_string != str) { if (x0_string == str) {
x40_primStartTimes.clear(); return;
x3c_curTime = 0.f;
x0_string = str;
ClearRenderBuffer();
x308_multipageFlag = multipage;
x304_pageCounter = 0;
} }
x40_primStartTimes.clear();
x3c_curTime = 0.f;
x0_string = str;
ClearRenderBuffer();
x308_multipageFlag = multipage;
x304_pageCounter = 0;
} }
void CGuiTextSupport::SetText(std::string_view str, bool multipage) { SetText(hecl::UTF8ToChar16(str), multipage); } void CGuiTextSupport::SetText(std::string_view str, bool multipage) { SetText(hecl::UTF8ToChar16(str), multipage); }
@ -286,24 +292,30 @@ bool CGuiTextSupport::_GetIsTextSupportFinishedLoading() {
} }
void CGuiTextSupport::SetJustification(EJustification j) { void CGuiTextSupport::SetJustification(EJustification j) {
if (j != x14_props.x4_justification) { if (j == x14_props.x4_justification) {
x14_props.x4_justification = j; return;
ClearRenderBuffer();
} }
x14_props.x4_justification = j;
ClearRenderBuffer();
} }
void CGuiTextSupport::SetVerticalJustification(EVerticalJustification j) { void CGuiTextSupport::SetVerticalJustification(EVerticalJustification j) {
if (j != x14_props.x8_vertJustification) { if (j == x14_props.x8_vertJustification) {
x14_props.x8_vertJustification = j; return;
ClearRenderBuffer();
} }
x14_props.x8_vertJustification = j;
ClearRenderBuffer();
} }
void CGuiTextSupport::SetImageBaseline(bool b) { void CGuiTextSupport::SetImageBaseline(bool b) {
if (b != x30_imageBaseline) { if (b == x30_imageBaseline) {
x30_imageBaseline = b; return;
ClearRenderBuffer();
} }
x30_imageBaseline = b;
ClearRenderBuffer();
} }
bool CGuiTextSupport::GetIsTextSupportFinishedLoading() { bool CGuiTextSupport::GetIsTextSupportFinishedLoading() {
@ -312,10 +324,12 @@ bool CGuiTextSupport::GetIsTextSupportFinishedLoading() {
} }
void CGuiTextSupport::SetControlTXTRMap(const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap) { void CGuiTextSupport::SetControlTXTRMap(const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap) {
if (x14_props.xc_txtrMap != txtrMap) { if (x14_props.xc_txtrMap == txtrMap) {
x14_props.xc_txtrMap = txtrMap; return;
ClearRenderBuffer();
} }
x14_props.xc_txtrMap = txtrMap;
ClearRenderBuffer();
} }
int CGuiTextSupport::GetTotalPageCount() { int CGuiTextSupport::GetTotalPageCount() {