From: terencehill Date: Sat, 25 Apr 2020 09:47:41 +0000 (+0200) Subject: Optimize DrawCircleClippedPic when drawing full image X-Git-Tag: xonotic-v0.8.5~1099 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e22eb05d05ddd0c12e96293c16e4df6f3e6b2f5f;p=xonotic%2Fxonotic-data.pk3dir.git Optimize DrawCircleClippedPic when drawing full image --- 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);