From 7bd33e4406adc31b0c72fd771733c24397b783b5 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Wed, 6 Jan 2021 13:26:55 +0100 Subject: [PATCH] Review rlOrtho() to avoid return in the middle of the function I usually try to avoid any return in the middle of functions, I try to keep them always at the end of the functions. --- src/rlgl.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/rlgl.h b/src/rlgl.h index bc851668..63b4fa7f 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -1100,15 +1100,12 @@ void rlFrustum(double left, double right, double bottom, double top, double znea // Multiply the current matrix by an orthographic matrix generated by parameters void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar) { - if (right - left <= 0 || bottom - top <= 0) + if (((right - left) > 0) && ((bottom - top) > 0)) { - *RLGL.State.currentMatrix = MatrixIdentity(); - return; + Matrix matOrtho = MatrixOrtho(left, right, bottom, top, znear, zfar); + *RLGL.State.currentMatrix = MatrixMultiply(*RLGL.State.currentMatrix, matOrtho); } - - Matrix matOrtho = MatrixOrtho(left, right, bottom, top, znear, zfar); - - *RLGL.State.currentMatrix = MatrixMultiply(*RLGL.State.currentMatrix, matOrtho); + else *RLGL.State.currentMatrix = MatrixIdentity(); } #endif