summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2021-01-06 13:26:55 +0100
committerraysan5 <[email protected]>2021-01-06 13:26:55 +0100
commit7bd33e4406adc31b0c72fd771733c24397b783b5 (patch)
tree137b4e87341f385d90de4ae69e93b4f5027ff810
parent5d4aada52649e0a43ba6eb446b205a68cd0831f6 (diff)
downloadraylib-7bd33e4406adc31b0c72fd771733c24397b783b5.tar.gz
raylib-7bd33e4406adc31b0c72fd771733c24397b783b5.zip
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.
-rw-r--r--src/rlgl.h11
1 files 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