From e22eb05d05ddd0c12e96293c16e4df6f3e6b2f5f Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 25 Apr 2020 11:47:41 +0200 Subject: [PATCH] Optimize DrawCircleClippedPic when drawing full image --- qcsrc/client/miscfunctions.qc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index a7af09c7c..1af1b971f 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -427,12 +427,6 @@ void DrawCircleClippedPic(vector centre, float radi, string pic, float f, vector centre = HUD_Shift(centre); ringsize = HUD_Scale(ringsize); - float co = cos(f * 2 * M_PI); - float si = sin(f * 2 * M_PI); - float q = fabs(co) + fabs(si); - co /= q; - si /= q; - if(f >= 1) { // draw full rectangle @@ -455,7 +449,14 @@ void DrawCircleClippedPic(vector centre, float radi, string pic, float f, vector R_EndPolygon(); return; // Complete rectangle, nothing more needed. } - else if(f > 0.75) + + float co = cos(f * 2 * M_PI); + float si = sin(f * 2 * M_PI); + float q = fabs(co) + fabs(si); + co /= q; + si /= q; + + if(f > 0.75) { // draw upper half in full R_BeginPolygon(pic, drawflag, true); -- 2.39.2