mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-21 18:58:14 +00:00
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.
This commit is contained in:
11
src/rlgl.h
11
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
|
// 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)
|
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();
|
Matrix matOrtho = MatrixOrtho(left, right, bottom, top, znear, zfar);
|
||||||
return;
|
*RLGL.State.currentMatrix = MatrixMultiply(*RLGL.State.currentMatrix, matOrtho);
|
||||||
}
|
}
|
||||||
|
else *RLGL.State.currentMatrix = MatrixIdentity();
|
||||||
Matrix matOrtho = MatrixOrtho(left, right, bottom, top, znear, zfar);
|
|
||||||
|
|
||||||
*RLGL.State.currentMatrix = MatrixMultiply(*RLGL.State.currentMatrix, matOrtho);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user