]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Optimize DrawCircleClippedPic when drawing full image
authorterencehill <piuntn@gmail.com>
Sat, 25 Apr 2020 09:47:41 +0000 (11:47 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 25 Apr 2020 09:47:41 +0000 (11:47 +0200)
qcsrc/client/miscfunctions.qc

index a7af09c7c82a146fcc259558ae8c46e9bd789a2c..1af1b971ffe91272af6cfcb915c1de041cbf49a8 100644 (file)
@@ -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);