package mapped;

import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSRasterizer2D;

@ObfuscatedName("uw")
public class Rasterizer2D extends DualNode implements RSRasterizer2D {
   @ObfuscatedName("ag")
   public static int[] Rasterizer2D_pixels;
   @ObfuscatedName("ad")
   public static int Rasterizer2D_width;
   @ObfuscatedName("af")
   public static int Rasterizer2D_height;
   @ObfuscatedName("be")
   public static float[] field5209;
   @ObfuscatedName("bl")
   public static int Rasterizer2D_yClipStart;
   @ObfuscatedName("bi")
   public static int Rasterizer2D_yClipEnd;
   @ObfuscatedName("bv")
   public static int Rasterizer2D_xClipStart;
   @ObfuscatedName("bf")
   public static int Rasterizer2D_xClipEnd;

   static {
      Rasterizer2D_yClipStart = 0;
      Rasterizer2D_yClipEnd = 0;
      Rasterizer2D_xClipStart = 0;
      Rasterizer2D_xClipEnd = 0;
   }

   @ObfuscatedName("eh")
   protected static void method9607_base(int[] var0, int var1, int var2, float[] var3) {
      Rasterizer2D_pixels = var0;
      Rasterizer2D_width = var1;
      Rasterizer2D_height = var2;
      field5209 = var3;
      Rasterizer2D_setClip_base(0, 0, var1, var2);
   }

   @ObfuscatedName("ei")
   public static void Rasterizer2D_resetClip_base() {
      Rasterizer2D_xClipStart = 0;
      Rasterizer2D_yClipStart = 0;
      Rasterizer2D_xClipEnd = Rasterizer2D_width;
      Rasterizer2D_yClipEnd = Rasterizer2D_height;
   }

   @ObfuscatedName("et")
   public static void Rasterizer2D_setClip_base(int var0, int var1, int var2, int var3) {
      if(var0 < 0) {
         var0 = 0;
      }

      if(var1 < 0) {
         var1 = 0;
      }

      if(var2 > Rasterizer2D_width) {
         var2 = Rasterizer2D_width;
      }

      if(var3 > Rasterizer2D_height) {
         var3 = Rasterizer2D_height;
      }

      Rasterizer2D_xClipStart = var0;
      Rasterizer2D_yClipStart = var1;
      Rasterizer2D_xClipEnd = var2;
      Rasterizer2D_yClipEnd = var3;
   }

   @ObfuscatedName("er")
   public static void Rasterizer2D_expandClip_base(int var0, int var1, int var2, int var3) {
      if(Rasterizer2D_xClipStart < var0) {
         Rasterizer2D_xClipStart = var0;
      }

      if(Rasterizer2D_yClipStart < var1) {
         Rasterizer2D_yClipStart = var1;
      }

      if(Rasterizer2D_xClipEnd > var2) {
         Rasterizer2D_xClipEnd = var2;
      }

      if(Rasterizer2D_yClipEnd > var3) {
         Rasterizer2D_yClipEnd = var3;
      }

   }

   @ObfuscatedName("ez")
   public static void Rasterizer2D_getClipArray_base(int[] var0) {
      var0[0] = Rasterizer2D_xClipStart;
      var0[1] = Rasterizer2D_yClipStart;
      var0[2] = Rasterizer2D_xClipEnd;
      var0[3] = Rasterizer2D_yClipEnd;
   }

   @ObfuscatedName("eu")
   public static void Rasterizer2D_setClipArray_base(int[] var0) {
      Rasterizer2D_xClipStart = var0[0];
      Rasterizer2D_yClipStart = var0[1];
      Rasterizer2D_xClipEnd = var0[2];
      Rasterizer2D_yClipEnd = var0[3];
   }

   @ObfuscatedName("eg")
   public static void Rasterizer2D_clear_base() {
      int var0 = 0;

      int var1;
      for(var1 = Rasterizer2D_width * Rasterizer2D_height - 7; var0 < var1; Rasterizer2D_pixels[var0++] = 0) {
         Rasterizer2D_pixels[var0++] = 0;
         Rasterizer2D_pixels[var0++] = 0;
         Rasterizer2D_pixels[var0++] = 0;
         Rasterizer2D_pixels[var0++] = 0;
         Rasterizer2D_pixels[var0++] = 0;
         Rasterizer2D_pixels[var0++] = 0;
         Rasterizer2D_pixels[var0++] = 0;
      }

      for(var1 += 7; var0 < var1; Rasterizer2D_pixels[var0++] = 0) {
         ;
      }

      method9630_base();
   }

   @ObfuscatedName("ey")
   static void drawCircle_base(int var0, int var1, int var2, int var3) {
      if(var2 == 0) {
         Rasterizer2D_setPixel_base(var0, var1, var3);
      } else {
         if(var2 < 0) {
            var2 = -var2;
         }

         int var4 = var1 - var2;
         if(var4 < Rasterizer2D_yClipStart) {
            var4 = Rasterizer2D_yClipStart;
         }

         int var5 = var2 + var1 + 1;
         if(var5 > Rasterizer2D_yClipEnd) {
            var5 = Rasterizer2D_yClipEnd;
         }

         int var6 = var4;
         int var7 = var2 * var2;
         int var8 = 0;
         int var9 = var1 - var4;
         int var10 = var9 * var9;
         int var11 = var10 - var9;
         if(var1 > var5) {
            var1 = var5;
         }

         int var12;
         int var13;
         int var14;
         int var15;
         while(var6 < var1) {
            while(var11 <= var7 || var10 <= var7) {
               var10 = var10 + var8 + var8;
               var11 += var8++ + var8;
            }

            var12 = var0 - var8 + 1;
            if(var12 < Rasterizer2D_xClipStart) {
               var12 = Rasterizer2D_xClipStart;
            }

            var13 = var0 + var8;
            if(var13 > Rasterizer2D_xClipEnd) {
               var13 = Rasterizer2D_xClipEnd;
            }

            var14 = var12 + var6 * Rasterizer2D_width;

            for(var15 = var12; var15 < var13; ++var15) {
               Rasterizer2D_pixels[var14++] = var3 | -16777216;
            }

            ++var6;
            var10 -= var9-- + var9;
            var11 -= var9 + var9;
         }

         var8 = var2;
         var9 = var6 - var1;
         var11 = var7 + var9 * var9;
         var10 = var11 - var2;

         for(var11 -= var9; var6 < var5; var10 += var9++ + var9) {
            while(var11 > var7 && var10 > var7) {
               var11 -= var8-- + var8;
               var10 -= var8 + var8;
            }

            var12 = var0 - var8;
            if(var12 < Rasterizer2D_xClipStart) {
               var12 = Rasterizer2D_xClipStart;
            }

            var13 = var0 + var8;
            if(var13 > Rasterizer2D_xClipEnd - 1) {
               var13 = Rasterizer2D_xClipEnd - 1;
            }

            var14 = var12 + var6 * Rasterizer2D_width;

            for(var15 = var12; var15 <= var13; ++var15) {
               Rasterizer2D_pixels[var14++] = var3 | -16777216;
            }

            ++var6;
            var11 = var11 + var9 + var9;
         }

      }
   }

   @ObfuscatedName("eb")
   public static void Rasterizer2D_drawCircleAlpha_base(int var0, int var1, int var2, int var3, int var4) {
      if(var4 != 0) {
         if(var4 == 256) {
            drawCircle_base(var0, var1, var2, var3);
         } else {
            if(var2 < 0) {
               var2 = -var2;
            }

            int var5 = 256 - var4;
            int var6 = (var3 >> 16 & 255) * var4;
            int var7 = (var3 >> 8 & 255) * var4;
            int var8 = var4 * (var3 & 255);
            int var12 = var1 - var2;
            if(var12 < Rasterizer2D_yClipStart) {
               var12 = Rasterizer2D_yClipStart;
            }

            int var13 = var2 + var1 + 1;
            if(var13 > Rasterizer2D_yClipEnd) {
               var13 = Rasterizer2D_yClipEnd;
            }

            int var14 = var12;
            int var15 = var2 * var2;
            int var16 = 0;
            int var17 = var1 - var12;
            int var18 = var17 * var17;
            int var19 = var18 - var17;
            if(var1 > var13) {
               var1 = var13;
            }

            int var9;
            int var10;
            int var11;
            int var20;
            int var21;
            int var22;
            int var23;
            int var24;
            while(var14 < var1) {
               while(var19 <= var15 || var18 <= var15) {
                  var18 = var18 + var16 + var16;
                  var19 += var16++ + var16;
               }

               var20 = var0 - var16 + 1;
               if(var20 < Rasterizer2D_xClipStart) {
                  var20 = Rasterizer2D_xClipStart;
               }

               var21 = var0 + var16;
               if(var21 > Rasterizer2D_xClipEnd) {
                  var21 = Rasterizer2D_xClipEnd;
               }

               var22 = var20 + var14 * Rasterizer2D_width;

               for(var23 = var20; var23 < var21; ++var23) {
                  var9 = var5 * (Rasterizer2D_pixels[var22] >> 16 & 255);
                  var10 = (Rasterizer2D_pixels[var22] >> 8 & 255) * var5;
                  var11 = var5 * (Rasterizer2D_pixels[var22] & 255);
                  var24 = (var8 + var11 >> 8) + (var6 + var9 >> 8 << 16) + (var7 + var10 >> 8 << 8);
                  Client.drawAlpha(Rasterizer2D_pixels, var22++, var24, var4);
               }

               ++var14;
               var18 -= var17-- + var17;
               var19 -= var17 + var17;
            }

            var16 = var2;
            var17 = -var17;
            var19 = var15 + var17 * var17;
            var18 = var19 - var2;

            for(var19 -= var17; var14 < var13; var18 += var17++ + var17) {
               while(var19 > var15 && var18 > var15) {
                  var19 -= var16-- + var16;
                  var18 -= var16 + var16;
               }

               var20 = var0 - var16;
               if(var20 < Rasterizer2D_xClipStart) {
                  var20 = Rasterizer2D_xClipStart;
               }

               var21 = var0 + var16;
               if(var21 > Rasterizer2D_xClipEnd - 1) {
                  var21 = Rasterizer2D_xClipEnd - 1;
               }

               var22 = var20 + var14 * Rasterizer2D_width;

               for(var23 = var20; var23 <= var21; ++var23) {
                  var9 = var5 * (Rasterizer2D_pixels[var22] >> 16 & 255);
                  var10 = (Rasterizer2D_pixels[var22] >> 8 & 255) * var5;
                  var11 = var5 * (Rasterizer2D_pixels[var22] & 255);
                  var24 = (var8 + var11 >> 8) + (var6 + var9 >> 8 << 16) + (var7 + var10 >> 8 << 8);
                  Client.drawAlpha(Rasterizer2D_pixels, var22++, var24, var4);
               }

               ++var14;
               var19 = var19 + var17 + var17;
            }

         }
      }
   }

   @ObfuscatedName("ed")
   public static void Rasterizer2D_fillRectangleAlpha_base(int var0, int var1, int var2, int var3, int var4, int var5) {
      if(var0 < Rasterizer2D_xClipStart) {
         var2 -= Rasterizer2D_xClipStart - var0;
         var0 = Rasterizer2D_xClipStart;
      }

      if(var1 < Rasterizer2D_yClipStart) {
         var3 -= Rasterizer2D_yClipStart - var1;
         var1 = Rasterizer2D_yClipStart;
      }

      if(var0 + var2 > Rasterizer2D_xClipEnd) {
         var2 = Rasterizer2D_xClipEnd - var0;
      }

      if(var3 + var1 > Rasterizer2D_yClipEnd) {
         var3 = Rasterizer2D_yClipEnd - var1;
      }

      var4 = (var5 * (var4 & 16711935) >> 8 & 16711935) + (var5 * (var4 & 65280) >> 8 & 65280);
      int var6 = 256 - var5;
      int var7 = Rasterizer2D_width - var2;
      int var8 = var0 + Rasterizer2D_width * var1;

      for(int var9 = 0; var9 < var3; ++var9) {
         for(int var10 = -var2; var10 < 0; ++var10) {
            int var11 = Rasterizer2D_pixels[var8];
            var11 = ((var11 & 16711935) * var6 >> 8 & 16711935) + (var6 * (var11 & 65280) >> 8 & 65280);
            Client.drawAlpha(Rasterizer2D_pixels, var8++, var11 + var4, var5);
         }

         var8 += var7;
      }

   }

   @ObfuscatedName("eq")
   public static void Rasterizer2D_fillRectangle_base(int var0, int var1, int var2, int var3, int var4) {
      if(var0 < Rasterizer2D_xClipStart) {
         var2 -= Rasterizer2D_xClipStart - var0;
         var0 = Rasterizer2D_xClipStart;
      }

      if(var1 < Rasterizer2D_yClipStart) {
         var3 -= Rasterizer2D_yClipStart - var1;
         var1 = Rasterizer2D_yClipStart;
      }

      if(var0 + var2 > Rasterizer2D_xClipEnd) {
         var2 = Rasterizer2D_xClipEnd - var0;
      }

      if(var3 + var1 > Rasterizer2D_yClipEnd) {
         var3 = Rasterizer2D_yClipEnd - var1;
      }

      int var5 = Rasterizer2D_width - var2;
      int var6 = var0 + Rasterizer2D_width * var1;

      for(int var7 = -var3; var7 < 0; ++var7) {
         for(int var8 = -var2; var8 < 0; ++var8) {
            Rasterizer2D_pixels[var6++] = var4 | -16777216;
         }

         var6 += var5;
      }

   }

   @ObfuscatedName("ee")
   public static void Rasterizer2D_fillRectangleGradient_base(int var0, int var1, int var2, int var3, int var4, int var5) {
      if(var2 > 0 && var3 > 0) {
         int var6 = 0;
         int var7 = 65536 / var3;
         if(var0 < Rasterizer2D_xClipStart) {
            var2 -= Rasterizer2D_xClipStart - var0;
            var0 = Rasterizer2D_xClipStart;
         }

         if(var1 < Rasterizer2D_yClipStart) {
            var6 += (Rasterizer2D_yClipStart - var1) * var7;
            var3 -= Rasterizer2D_yClipStart - var1;
            var1 = Rasterizer2D_yClipStart;
         }

         if(var0 + var2 > Rasterizer2D_xClipEnd) {
            var2 = Rasterizer2D_xClipEnd - var0;
         }

         if(var3 + var1 > Rasterizer2D_yClipEnd) {
            var3 = Rasterizer2D_yClipEnd - var1;
         }

         int var8 = Rasterizer2D_width - var2;
         int var9 = var0 + Rasterizer2D_width * var1;

         for(int var10 = -var3; var10 < 0; ++var10) {
            int var11 = 65536 - var6 >> 8;
            int var12 = var6 >> 8;
            int var13 = (var12 * (var5 & 16711935) + var11 * (var4 & 16711935) & -16711936) + (var12 * (var5 & 65280) + var11 * (var4 & 65280) & 16711680) >>> 8;

            for(int var14 = -var2; var14 < 0; ++var14) {
               Rasterizer2D_pixels[var9++] = var13 | -16777216;
            }

            var9 += var8;
            var6 += var7;
         }

      }
   }

   @ObfuscatedName("ej")
   public static void Rasterizer2D_fillRectangleGradientAlpha_base(int var0, int var1, int var2, int var3, int var4, int var5, int var6, int var7) {
      int var8 = SpriteMask.client.getGraphicsPixelsWidth();
      int var9 = SpriteMask.client.getStartX();
      int var10 = SpriteMask.client.getStartY();
      int var11 = SpriteMask.client.getEndX();
      int var12 = SpriteMask.client.getEndY();
      int[] var13 = SpriteMask.client.getGraphicsPixels();
      if(!SpriteMask.client.isGpu()) {
         Client.copy$Rasterizer2D_fillRectangleGradientAlpha(var0, var1, var2, var3, var4, var5, var6, var7);
      } else {
         if(var2 > 0 && var3 > 0) {
            int var14 = 0;
            int var15 = 65536 / var3;
            if(var0 < var9) {
               var2 -= var9 - var0;
               var0 = var9;
            }

            if(var1 < var10) {
               var14 += (var10 - var1) * var15;
               var3 -= var10 - var1;
               var1 = var10;
            }

            if(var0 + var2 > var11) {
               var2 = var11 - var0;
            }

            if(var3 + var1 > var12) {
               var3 = var12 - var1;
            }

            int var16 = var8 - var2;
            int var17 = var0 + var8 * var1;

            for(int var18 = -var3; var18 < 0; ++var18) {
               int var19 = 65536 - var14 >> 8;
               int var20 = var14 >> 8;
               int var21 = (var19 * var6 + var20 * var7 & 65280) >>> 8;
               if(var21 == 0) {
                  var17 += var8;
                  var14 += var15;
               } else {
                  int var22 = (var19 * (var4 & 65280) + var20 * (var5 & 65280) & 16711680) + (var19 * (var4 & 16711935) + var20 * (var5 & 16711935) & -16711936) >>> 8;
                  int var23 = 255 - var21;
                  int var24 = ((var22 & 16711935) * var21 >> 8 & 16711935) + (var21 * (var22 & 65280) >> 8 & 65280);

                  for(int var25 = -var2; var25 < 0; ++var25) {
                     int var26 = var13[var17];
                     var26 = ((var26 & 16711935) * var23 >> 8 & 16711935) + (var23 * (var26 & 65280) >> 8 & 65280);
                     Client.drawAlpha(var13, var17++, var24 + var26, var21);
                  }

                  var17 += var16;
                  var14 += var15;
               }
            }
         }

      }
   }

   @ObfuscatedName("ep")
   @ObfuscatedSignature(
      descriptor = "(IIIIII[BIZ)V",
      garbageValue = "1"
   )
   public static void Rasterizer2D_drawGradientPixels_base(int var0, int var1, int var2, int var3, int var4, int var5, byte[] var6, int var7) {
      int var8 = SpriteMask.client.getGraphicsPixelsWidth();
      int var9 = SpriteMask.client.getGraphicsPixelsHeight();
      int[] var10 = SpriteMask.client.getGraphicsPixels();
      if(!SpriteMask.client.isGpu()) {
         Client.copy$Rasterizer2D_drawGradientPixels(var0, var1, var2, var3, var4, var5, var6, var7, true);
      } else {
         if(var0 + var2 >= 0 && var3 + var1 >= 0 && var0 < var8 && var1 < var9) {
            int var11 = 0;
            int var12 = 0;
            if(var0 < 0) {
               var11 -= var0;
               var2 += var0;
            }

            if(var1 < 0) {
               var12 -= var1;
               var3 += var1;
            }

            if(var0 + var2 > var8) {
               var2 = var8 - var0;
            }

            if(var3 + var1 > var9) {
               var3 = var9 - var1;
            }

            int var13 = var6.length / var7;
            int var14 = var8 - var2;
            int var15 = var4 >>> 24;
            int var16 = var5 >>> 24;
            int var17;
            int var18;
            int var19;
            int var20;
            int var21;
            if(var15 == 255 && var16 == 255) {
               var17 = var0 + var11 + var8 * (var12 + var1);

               for(var18 = var12 + var1; var18 < var3 + var12 + var1; ++var18) {
                  for(var19 = var0 + var11; var19 < var0 + var11 + var2; ++var19) {
                     var20 = (var18 - var1) % var13;
                     var21 = (var19 - var0) % var7;
                     if(var6[var21 + var20 * var7] != 0) {
                        var10[var17++] = var5;
                     } else {
                        var10[var17++] = var4;
                     }
                  }

                  var17 += var14;
               }
            } else {
               var17 = var0 + var11 + var8 * (var12 + var1);

               for(var18 = var12 + var1; var18 < var3 + var12 + var1; ++var18) {
                  for(var19 = var0 + var11; var19 < var0 + var11 + var2; ++var19) {
                     var20 = (var18 - var1) % var13;
                     var21 = (var19 - var0) % var7;
                     int var22 = var4;
                     if(var6[var21 + var20 * var7] != 0) {
                        var22 = var5;
                     }

                     int var23 = var22 >>> 24;
                     int var24 = 255 - var23;
                     int var25 = var10[var17];
                     int var26 = (var23 * (var22 & 65280) + var24 * (var25 & 65280) & 16711680) + ((var22 & 16711935) * var23 + (var25 & 16711935) * var24 & -16711936) >> 8;
                     Client.drawAlpha(var10, var17++, var26, var23);
                  }

                  var17 += var14;
               }
            }
         }

      }
   }

   @ObfuscatedName("fq")
   public static void Rasterizer2D_drawRectangle_base(int var0, int var1, int var2, int var3, int var4) {
      Rasterizer2D_drawHorizontalLine_base(var0, var1, var2, var4);
      Rasterizer2D_drawHorizontalLine_base(var0, var3 + var1 - 1, var2, var4);
      Rasterizer2D_drawVerticalLine_base(var0, var1, var3, var4);
      Rasterizer2D_drawVerticalLine_base(var0 + var2 - 1, var1, var3, var4);
   }

   @ObfuscatedName("fe")
   public static void Rasterizer2D_drawRectangleAlpha_base(int var0, int var1, int var2, int var3, int var4, int var5) {
      Rasterizer2D_drawHorizontalLineAlpha_base(var0, var1, var2, var4, var5);
      Rasterizer2D_drawHorizontalLineAlpha_base(var0, var3 + var1 - 1, var2, var4, var5);
      if(var3 >= 3) {
         Rasterizer2D_drawVerticalLineAlpha_base(var0, var1 + 1, var3 - 2, var4, var5);
         Rasterizer2D_drawVerticalLineAlpha_base(var0 + var2 - 1, var1 + 1, var3 - 2, var4, var5);
      }

   }

   @ObfuscatedName("ff")
   public static void Rasterizer2D_drawHorizontalLine_base(int var0, int var1, int var2, int var3) {
      if(var1 >= Rasterizer2D_yClipStart && var1 < Rasterizer2D_yClipEnd) {
         if(var0 < Rasterizer2D_xClipStart) {
            var2 -= Rasterizer2D_xClipStart - var0;
            var0 = Rasterizer2D_xClipStart;
         }

         if(var0 + var2 > Rasterizer2D_xClipEnd) {
            var2 = Rasterizer2D_xClipEnd - var0;
         }

         int var4 = var0 + Rasterizer2D_width * var1;

         for(int var5 = 0; var5 < var2; ++var5) {
            Rasterizer2D_pixels[var4 + var5] = var3 | -16777216;
         }

      }
   }

   @ObfuscatedName("fb")
   static void Rasterizer2D_drawHorizontalLineAlpha_base(int var0, int var1, int var2, int var3, int var4) {
      if(var1 >= Rasterizer2D_yClipStart && var1 < Rasterizer2D_yClipEnd) {
         if(var0 < Rasterizer2D_xClipStart) {
            var2 -= Rasterizer2D_xClipStart - var0;
            var0 = Rasterizer2D_xClipStart;
         }

         if(var0 + var2 > Rasterizer2D_xClipEnd) {
            var2 = Rasterizer2D_xClipEnd - var0;
         }

         int var5 = 256 - var4;
         int var6 = (var3 >> 16 & 255) * var4;
         int var7 = (var3 >> 8 & 255) * var4;
         int var8 = var4 * (var3 & 255);
         int var12 = var0 + Rasterizer2D_width * var1;

         for(int var13 = 0; var13 < var2; ++var13) {
            int var9 = var5 * (Rasterizer2D_pixels[var12] >> 16 & 255);
            int var10 = (Rasterizer2D_pixels[var12] >> 8 & 255) * var5;
            int var11 = var5 * (Rasterizer2D_pixels[var12] & 255);
            int var14 = (var8 + var11 >> 8) + (var6 + var9 >> 8 << 16) + (var7 + var10 >> 8 << 8);
            Client.drawAlpha(Rasterizer2D_pixels, var12++, var14, var4);
         }

      }
   }

   @ObfuscatedName("fr")
   public static void Rasterizer2D_drawVerticalLine_base(int var0, int var1, int var2, int var3) {
      if(var0 >= Rasterizer2D_xClipStart && var0 < Rasterizer2D_xClipEnd) {
         if(var1 < Rasterizer2D_yClipStart) {
            var2 -= Rasterizer2D_yClipStart - var1;
            var1 = Rasterizer2D_yClipStart;
         }

         if(var2 + var1 > Rasterizer2D_yClipEnd) {
            var2 = Rasterizer2D_yClipEnd - var1;
         }

         int var4 = var0 + Rasterizer2D_width * var1;

         for(int var5 = 0; var5 < var2; ++var5) {
            Rasterizer2D_pixels[var4 + var5 * Rasterizer2D_width] = var3 | -16777216;
         }

      }
   }

   @ObfuscatedName("fi")
   static void Rasterizer2D_drawVerticalLineAlpha_base(int var0, int var1, int var2, int var3, int var4) {
      if(var0 >= Rasterizer2D_xClipStart && var0 < Rasterizer2D_xClipEnd) {
         if(var1 < Rasterizer2D_yClipStart) {
            var2 -= Rasterizer2D_yClipStart - var1;
            var1 = Rasterizer2D_yClipStart;
         }

         if(var2 + var1 > Rasterizer2D_yClipEnd) {
            var2 = Rasterizer2D_yClipEnd - var1;
         }

         int var5 = 256 - var4;
         int var6 = (var3 >> 16 & 255) * var4;
         int var7 = (var3 >> 8 & 255) * var4;
         int var8 = var4 * (var3 & 255);
         int var12 = var0 + Rasterizer2D_width * var1;

         for(int var13 = 0; var13 < var2; ++var13) {
            int var9 = var5 * (Rasterizer2D_pixels[var12] >> 16 & 255);
            int var10 = (Rasterizer2D_pixels[var12] >> 8 & 255) * var5;
            int var11 = var5 * (Rasterizer2D_pixels[var12] & 255);
            int var14 = (var8 + var11 >> 8) + (var6 + var9 >> 8 << 16) + (var7 + var10 >> 8 << 8);
            Client.drawAlpha(Rasterizer2D_pixels, var12, var14, var4);
            var12 += Rasterizer2D_width;
         }

      }
   }

   @ObfuscatedName("fo")
   public static void Rasterizer2D_drawLine_base(int var0, int var1, int var2, int var3, int var4) {
      var2 -= var0;
      var3 -= var1;
      if(var3 == 0) {
         if(var2 >= 0) {
            Rasterizer2D_drawHorizontalLine_base(var0, var1, var2 + 1, var4);
         } else {
            Rasterizer2D_drawHorizontalLine_base(var0 + var2, var1, -var2 + 1, var4);
         }

      } else if(var2 == 0) {
         if(var3 >= 0) {
            Rasterizer2D_drawVerticalLine_base(var0, var1, var3 + 1, var4);
         } else {
            Rasterizer2D_drawVerticalLine_base(var0, var3 + var1, -var3 + 1, var4);
         }

      } else {
         if(var3 + var2 < 0) {
            var0 += var2;
            var2 = -var2;
            var1 += var3;
            var3 = -var3;
         }

         int var5;
         int var6;
         if(var2 > var3) {
            var1 <<= 16;
            var1 += 32768;
            var3 <<= 16;
            var5 = (int)Math.floor((double)var3 / (double)var2 + 0.5D);
            var2 += var0;
            if(var0 < Rasterizer2D_xClipStart) {
               var1 += var5 * (Rasterizer2D_xClipStart - var0);
               var0 = Rasterizer2D_xClipStart;
            }

            if(var2 >= Rasterizer2D_xClipEnd) {
               var2 = Rasterizer2D_xClipEnd - 1;
            }

            while(var0 <= var2) {
               var6 = var1 >> 16;
               if(var6 >= Rasterizer2D_yClipStart && var6 < Rasterizer2D_yClipEnd) {
                  Rasterizer2D_pixels[var0 + var6 * Rasterizer2D_width] = var4 | -16777216;
               }

               var1 += var5;
               ++var0;
            }
         } else {
            var0 <<= 16;
            var0 += 32768;
            var2 <<= 16;
            var5 = (int)Math.floor((double)var2 / (double)var3 + 0.5D);
            var3 += var1;
            if(var1 < Rasterizer2D_yClipStart) {
               var0 += (Rasterizer2D_yClipStart - var1) * var5;
               var1 = Rasterizer2D_yClipStart;
            }

            if(var3 >= Rasterizer2D_yClipEnd) {
               var3 = Rasterizer2D_yClipEnd - 1;
            }

            while(var1 <= var3) {
               var6 = var0 >> 16;
               if(var6 >= Rasterizer2D_xClipStart && var6 < Rasterizer2D_xClipEnd) {
                  Rasterizer2D_pixels[var6 + Rasterizer2D_width * var1] = var4 | -16777216;
               }

               var0 += var5;
               ++var1;
            }
         }

      }
   }

   @ObfuscatedName("fw")
   static void Rasterizer2D_setPixel_base(int var0, int var1, int var2) {
      if(var0 >= Rasterizer2D_xClipStart && var1 >= Rasterizer2D_yClipStart && var0 < Rasterizer2D_xClipEnd && var1 < Rasterizer2D_yClipEnd) {
         Rasterizer2D_pixels[var0 + Rasterizer2D_width * var1] = var2 | -16777216;
      }
   }

   @ObfuscatedName("fj")
   public static void Rasterizer2D_fillMaskedRectangle_base(int var0, int var1, int var2, int[] var3, int[] var4) {
      int var5 = var0 + Rasterizer2D_width * var1;

      for(var1 = 0; var1 < var3.length; ++var1) {
         int var6 = var5 + var3[var1];

         for(var0 = -var4[var1]; var0 < 0; ++var0) {
            Rasterizer2D_pixels[var6++] = var2 | -16777216;
         }

         var5 += Rasterizer2D_width;
      }

   }

   @ObfuscatedName("fh")
   public static void method9630_base() {
      if(field5209 != null) {
         int var0;
         int var1;
         int var2;
         if(Rasterizer2D_xClipStart == 0 && Rasterizer2D_xClipEnd == Rasterizer2D_width && Rasterizer2D_yClipStart == 0 && Rasterizer2D_yClipEnd == Rasterizer2D_height) {
            var0 = field5209.length;
            var1 = var0 - (var0 & 7);

            for(var2 = 0; var2 < var1; field5209[var2++] = 0.0F) {
               field5209[var2++] = 0.0F;
               field5209[var2++] = 0.0F;
               field5209[var2++] = 0.0F;
               field5209[var2++] = 0.0F;
               field5209[var2++] = 0.0F;
               field5209[var2++] = 0.0F;
               field5209[var2++] = 0.0F;
            }

            while(var2 < var0) {
               field5209[var2++] = 0.0F;
            }
         } else {
            var0 = Rasterizer2D_xClipEnd - Rasterizer2D_xClipStart;
            var1 = Rasterizer2D_yClipEnd - Rasterizer2D_yClipStart;
            var2 = Rasterizer2D_width - var0;
            int var3 = Rasterizer2D_yClipStart * Rasterizer2D_width + Rasterizer2D_xClipStart;
            int var4 = var0 >> 3;
            int var5 = var0 & 7;
            var0 = var3 - 1;

            for(int var7 = -var1; var7 < 0; ++var7) {
               int var6;
               if(var4 > 0) {
                  var6 = var4;

                  do {
                     ++var0;
                     field5209[var0] = 0.0F;
                     ++var0;
                     field5209[var0] = 0.0F;
                     ++var0;
                     field5209[var0] = 0.0F;
                     ++var0;
                     field5209[var0] = 0.0F;
                     ++var0;
                     field5209[var0] = 0.0F;
                     ++var0;
                     field5209[var0] = 0.0F;
                     ++var0;
                     field5209[var0] = 0.0F;
                     ++var0;
                     field5209[var0] = 0.0F;
                     --var6;
                  } while(var6 > 0);
               }

               if(var5 > 0) {
                  var6 = var5;

                  do {
                     ++var0;
                     field5209[var0] = 0.0F;
                     --var6;
                  } while(var6 > 0);
               }

               var0 += var2;
            }
         }

      }
   }

   @ObfuscatedName("fg")
   public static void method9664_base() {
      if(field5209 != null) {
         int var0 = field5209.length;

         for(int var1 = 0; var1 < var0; ++var1) {
            if(var1 % Rasterizer2D_width < Rasterizer2D_width / 2 && field5209[var1] > 0.0F) {
               float var3 = field5209[var1];
               float var4 = 75.0F;
               float var5 = 10000.0F;
               float var6 = 750000.0F / (10000.0F - 9925.0F * var3);
               float var2 = (var6 - 75.0F) / 9925.0F;
               int var7 = (int)(255.0F * var2);
               Rasterizer2D_pixels[var1] = var7 << 16 | var7 << 8 | var7 | -16777216;
            }
         }

      }
   }
}
