import jaggl.OpenGL;

public abstract class Class147 {

   static final int anInt1694 = 3552;
   static final int anInt1695 = 3553;
   static final int anInt1696 = 34037;
   static final int anInt1697 = 34067;
   static final int anInt1698 = 32879;
   static final int anInt1699 = 5121;
   int anInt1700;
   int anInt1701;
   int anInt1702;
   Class91 aClass91_1703;
   Class545_Sub1 aClass545_Sub1_1704;
   boolean aBool1705;
   boolean aBool1706 = false;
   Class98 aClass98_1707;
   static int[] anIntArray1708 = new int[1];


   static void method2693(int var0, int var1, int var2, int var3, Class98 var4, byte[] var5) {
      if(var2 > 0 && !Class75.method1618(var2, 98312473)) {
         throw new IllegalArgumentException("");
      } else if(var3 > 0 && !Class75.method1618(var3, 98312473)) {
         throw new IllegalArgumentException("");
      } else {
         int var6 = var4.anInt996 * 1946169797;
         int var7 = 0;
         int var8 = var2 < var3?var2:var3;
         int var9 = var2 >> 1;
         int var10 = var3 >> 1;
         byte[] var11 = var5;
         byte[] var12 = new byte[var9 * var10 * var6];

         while(true) {
            OpenGL.glTexImage2Dub(var0, var7, var1, var2, var3, 0, Class545_Sub1.method14567(var4), 5121, var11, 0);
            if(var8 <= 1) {
               return;
            }

            int var13 = var2 * var6;

            for(int var14 = 0; var14 < var6; ++var14) {
               int var15 = var14;
               int var16 = var14;
               int var17 = var14 + var13;

               for(int var18 = 0; var18 < var10; ++var18) {
                  for(int var19 = 0; var19 < var9; ++var19) {
                     byte var20 = var11[var16];
                     var16 += var6;
                     int var22 = var20 + var11[var16];
                     var16 += var6;
                     var22 += var11[var17];
                     var17 += var6;
                     var22 += var11[var17];
                     var17 += var6;
                     var12[var15] = (byte)(var22 >> 2);
                     var15 += var6;
                  }

                  var16 += var13;
                  var17 += var13;
               }
            }

            byte[] var21 = var12;
            var12 = var11;
            var11 = var21;
            var2 = var9;
            var3 = var10;
            var9 >>= 1;
            var10 >>= 1;
            var8 >>= 1;
            ++var7;
         }
      }
   }

   void method2694(boolean var1) {
      if(this.aBool1706 != var1) {
         this.aBool1706 = var1;
         this.method2695();
      }

   }

   void method2695() {
      this.aClass545_Sub1_1704.method14725(this);
      if(this.aBool1706) {
         OpenGL.glTexParameteri(this.anInt1702, 10241, this.aBool1705?9987:9729);
         OpenGL.glTexParameteri(this.anInt1702, 10240, 9729);
      } else {
         OpenGL.glTexParameteri(this.anInt1702, 10241, this.aBool1705?9984:9728);
         OpenGL.glTexParameteri(this.anInt1702, 10240, 9728);
      }

   }

   void method2696() throws Throwable {
      this.method2724();
      super.finalize();
   }

   void method2697(boolean var1) {
      if(this.aBool1705 != var1) {
         int var2 = this.method2701();
         this.aBool1705 = true;
         this.method2695();
         this.method2700(var2);
      }

   }

   void method2698() {
      if(this.anInt1701 > 0) {
         this.aClass545_Sub1_1704.anInt9125 -= this.method2701();
         int[] var1 = new int[]{this.anInt1701};
         OpenGL.glDeleteTextures(1, var1, 0);
         this.anInt1701 = 0;
      }

   }

   void method2699() throws Throwable {
      this.method2724();
      super.finalize();
   }

   Class147(Class545_Sub1 var1, int var2, Class98 var3, Class91 var4, int var5, boolean var6) {
      this.aClass545_Sub1_1704 = var1;
      this.anInt1702 = var2;
      this.aClass98_1707 = var3;
      this.aClass91_1703 = var4;
      this.aBool1705 = var6;
      this.anInt1700 = var5;
      OpenGL.glGenTextures(1, anIntArray1708, 0);
      this.anInt1701 = anIntArray1708[0];
      this.method2700(0);
   }

   void method2700(int var1) {
      this.aClass545_Sub1_1704.anInt9125 -= var1;
      this.aClass545_Sub1_1704.anInt9125 += this.method2701();
   }

   int method2701() {
      int var1 = this.aClass98_1707.anInt996 * 1946169797 * this.aClass91_1703.anInt906 * -2107221975 * this.anInt1700;
      return this.aBool1705?var1 * 4 / 3:var1;
   }

   static void method2702(int var0, int var1, int var2, int var3, int var4, int var5, int[] var6) {
      if(var2 > 0 && !Class75.method1618(var2, 98312473)) {
         throw new IllegalArgumentException("");
      } else if(var3 > 0 && !Class75.method1618(var3, 98312473)) {
         throw new IllegalArgumentException("");
      } else if(var4 != '\u80e1') {
         throw new IllegalArgumentException("");
      } else {
         int var7 = 0;
         int var8 = var2 < var3?var2:var3;
         int var9 = var2 >> 1;
         int var10 = var3 >> 1;
         int[] var11 = var6;
         int[] var12 = new int[var9 * var10];

         while(true) {
            OpenGL.glTexImage2Di(var0, var7, var1, var2, var3, 0, var4, var5, var11, 0);
            if(var8 <= 1) {
               return;
            }

            int var13 = 0;
            int var14 = 0;
            int var15 = var14 + var2;

            for(int var16 = 0; var16 < var10; ++var16) {
               for(int var17 = 0; var17 < var9; ++var17) {
                  int var18 = var11[var14++];
                  int var19 = var11[var14++];
                  int var20 = var11[var15++];
                  int var21 = var11[var15++];
                  int var22 = var18 >> 24 & 255;
                  int var23 = var18 >> 16 & 255;
                  int var24 = var18 >> 8 & 255;
                  int var25 = var18 & 255;
                  var22 += var19 >> 24 & 255;
                  var23 += var19 >> 16 & 255;
                  var24 += var19 >> 8 & 255;
                  var25 += var19 & 255;
                  var22 += var20 >> 24 & 255;
                  var23 += var20 >> 16 & 255;
                  var24 += var20 >> 8 & 255;
                  var25 += var20 & 255;
                  var22 += var21 >> 24 & 255;
                  var23 += var21 >> 16 & 255;
                  var24 += var21 >> 8 & 255;
                  var25 += var21 & 255;
                  var12[var13++] = (var22 & 1020) << 22 | (var23 & 1020) << 14 | (var24 & 1020) << 6 | (var25 & 1020) >> 2;
               }

               var14 += var2;
               var15 += var2;
            }

            int[] var26 = var12;
            var12 = var11;
            var11 = var26;
            var2 = var9;
            var3 = var10;
            var9 >>= 1;
            var10 >>= 1;
            var8 >>= 1;
            ++var7;
         }
      }
   }

   static void method2703(int var0, int var1, int var2, int var3, Class98 var4, byte[] var5) {
      if(var2 > 0 && !Class75.method1618(var2, 98312473)) {
         throw new IllegalArgumentException("");
      } else if(var3 > 0 && !Class75.method1618(var3, 98312473)) {
         throw new IllegalArgumentException("");
      } else {
         int var6 = var4.anInt996 * 1946169797;
         int var7 = 0;
         int var8 = var2 < var3?var2:var3;
         int var9 = var2 >> 1;
         int var10 = var3 >> 1;
         byte[] var11 = var5;
         byte[] var12 = new byte[var9 * var10 * var6];

         while(true) {
            OpenGL.glTexImage2Dub(var0, var7, var1, var2, var3, 0, Class545_Sub1.method14567(var4), 5121, var11, 0);
            if(var8 <= 1) {
               return;
            }

            int var13 = var2 * var6;

            for(int var14 = 0; var14 < var6; ++var14) {
               int var15 = var14;
               int var16 = var14;
               int var17 = var14 + var13;

               for(int var18 = 0; var18 < var10; ++var18) {
                  for(int var19 = 0; var19 < var9; ++var19) {
                     byte var20 = var11[var16];
                     var16 += var6;
                     int var22 = var20 + var11[var16];
                     var16 += var6;
                     var22 += var11[var17];
                     var17 += var6;
                     var22 += var11[var17];
                     var17 += var6;
                     var12[var15] = (byte)(var22 >> 2);
                     var15 += var6;
                  }

                  var16 += var13;
                  var17 += var13;
               }
            }

            byte[] var21 = var12;
            var12 = var11;
            var11 = var21;
            var2 = var9;
            var3 = var10;
            var9 >>= 1;
            var10 >>= 1;
            var8 >>= 1;
            ++var7;
         }
      }
   }

   static void method2704(int var0, int var1, int var2, int var3, Class98 var4, float[] var5) {
      if(var2 > 0 && !Class75.method1618(var2, 98312473)) {
         throw new IllegalArgumentException("");
      } else if(var3 > 0 && !Class75.method1618(var3, 98312473)) {
         throw new IllegalArgumentException("");
      } else {
         int var6 = var4.anInt996 * 1946169797;
         int var7 = 0;
         int var8 = var2 < var3?var2:var3;
         int var9 = var2 >> 1;
         int var10 = var3 >> 1;
         float[] var11 = var5;
         float[] var12 = new float[var9 * var10 * var6];

         while(true) {
            OpenGL.glTexImage2Df(var0, var7, var1, var2, var3, 0, Class545_Sub1.method14567(var4), 5126, var11, 0);
            if(var8 <= 1) {
               return;
            }

            int var13 = var2 * var6;

            for(int var14 = 0; var14 < var6; ++var14) {
               int var15 = var14;
               int var16 = var14;
               int var17 = var14 + var13;

               for(int var18 = 0; var18 < var10; ++var18) {
                  for(int var19 = 0; var19 < var9; ++var19) {
                     float var20 = var11[var16];
                     var16 += var6;
                     var20 += var11[var16];
                     var16 += var6;
                     var20 += var11[var17];
                     var17 += var6;
                     var20 += var11[var17];
                     var17 += var6;
                     var12[var15] = var20 * 0.25F;
                     var15 += var6;
                  }

                  var16 += var13;
                  var17 += var13;
               }
            }

            float[] var21 = var12;
            var12 = var11;
            var11 = var21;
            var2 = var9;
            var3 = var10;
            var9 >>= 1;
            var10 >>= 1;
            var8 >>= 1;
            ++var7;
         }
      }
   }

   void method2705(int var1) {
      this.aClass545_Sub1_1704.anInt9125 -= var1;
      this.aClass545_Sub1_1704.anInt9125 += this.method2701();
   }

   void method2706() {
      if(this.anInt1701 > 0) {
         this.aClass545_Sub1_1704.method14614(this.anInt1701, this.method2701());
         this.anInt1701 = 0;
      }

   }

   void method2707() throws Throwable {
      this.method2724();
      super.finalize();
   }

   void method2708(boolean var1) {
      if(this.aBool1706 != var1) {
         this.aBool1706 = var1;
         this.method2695();
      }

   }

   void method2709() {
      this.aClass545_Sub1_1704.method14725(this);
      if(this.aBool1706) {
         OpenGL.glTexParameteri(this.anInt1702, 10241, this.aBool1705?9987:9729);
         OpenGL.glTexParameteri(this.anInt1702, 10240, 9729);
      } else {
         OpenGL.glTexParameteri(this.anInt1702, 10241, this.aBool1705?9984:9728);
         OpenGL.glTexParameteri(this.anInt1702, 10240, 9728);
      }

   }

   int method2710() {
      int var1 = this.aClass98_1707.anInt996 * 1946169797 * this.aClass91_1703.anInt906 * -2107221975 * this.anInt1700;
      return this.aBool1705?var1 * 4 / 3:var1;
   }

   boolean method2711() {
      if(this.aClass545_Sub1_1704.aBool9266) {
         int var1 = this.method2701();
         this.aClass545_Sub1_1704.method14725(this);
         OpenGL.glGenerateMipmapEXT(this.anInt1702);
         this.aBool1705 = true;
         this.method2695();
         this.method2700(var1);
         return true;
      } else {
         return false;
      }
   }

   void method2712() {
      if(this.anInt1701 > 0) {
         this.aClass545_Sub1_1704.anInt9125 -= this.method2701();
         int[] var1 = new int[]{this.anInt1701};
         OpenGL.glDeleteTextures(1, var1, 0);
         this.anInt1701 = 0;
      }

   }

   void method2713(boolean var1) {
      if(this.aBool1705 != var1) {
         int var2 = this.method2701();
         this.aBool1705 = true;
         this.method2695();
         this.method2700(var2);
      }

   }

   void method2714(boolean var1) {
      if(this.aBool1705 != var1) {
         int var2 = this.method2701();
         this.aBool1705 = true;
         this.method2695();
         this.method2700(var2);
      }

   }

   boolean method2715() {
      if(this.aClass545_Sub1_1704.aBool9266) {
         int var1 = this.method2701();
         this.aClass545_Sub1_1704.method14725(this);
         OpenGL.glGenerateMipmapEXT(this.anInt1702);
         this.aBool1705 = true;
         this.method2695();
         this.method2700(var1);
         return true;
      } else {
         return false;
      }
   }

   void method2716() {
      if(this.anInt1701 > 0) {
         this.aClass545_Sub1_1704.anInt9125 -= this.method2701();
         int[] var1 = new int[]{this.anInt1701};
         OpenGL.glDeleteTextures(1, var1, 0);
         this.anInt1701 = 0;
      }

   }

   void method2717() {
      this.aClass545_Sub1_1704.method14725(this);
      if(this.aBool1706) {
         OpenGL.glTexParameteri(this.anInt1702, 10241, this.aBool1705?9987:9729);
         OpenGL.glTexParameteri(this.anInt1702, 10240, 9729);
      } else {
         OpenGL.glTexParameteri(this.anInt1702, 10241, this.aBool1705?9984:9728);
         OpenGL.glTexParameteri(this.anInt1702, 10240, 9728);
      }

   }

   public void finalize() throws Throwable {
      this.method2724();
      super.finalize();
   }

   void method2718() {
      if(this.anInt1701 > 0) {
         this.aClass545_Sub1_1704.method14614(this.anInt1701, this.method2701());
         this.anInt1701 = 0;
      }

   }

   void method2719(boolean var1) {
      if(this.aBool1705 != var1) {
         int var2 = this.method2701();
         this.aBool1705 = true;
         this.method2695();
         this.method2700(var2);
      }

   }

   void method2720(int var1) {
      this.aClass545_Sub1_1704.anInt9125 -= var1;
      this.aClass545_Sub1_1704.anInt9125 += this.method2701();
   }

   int method2721() {
      int var1 = this.aClass98_1707.anInt996 * 1946169797 * this.aClass91_1703.anInt906 * -2107221975 * this.anInt1700;
      return this.aBool1705?var1 * 4 / 3:var1;
   }

   int method2722() {
      int var1 = this.aClass98_1707.anInt996 * 1946169797 * this.aClass91_1703.anInt906 * -2107221975 * this.anInt1700;
      return this.aBool1705?var1 * 4 / 3:var1;
   }

   static void method2723(int var0, int var1, int var2, int var3, int var4, int var5, int[] var6) {
      if(var2 > 0 && !Class75.method1618(var2, 98312473)) {
         throw new IllegalArgumentException("");
      } else if(var3 > 0 && !Class75.method1618(var3, 98312473)) {
         throw new IllegalArgumentException("");
      } else if(var4 != '\u80e1') {
         throw new IllegalArgumentException("");
      } else {
         int var7 = 0;
         int var8 = var2 < var3?var2:var3;
         int var9 = var2 >> 1;
         int var10 = var3 >> 1;
         int[] var11 = var6;
         int[] var12 = new int[var9 * var10];

         while(true) {
            OpenGL.glTexImage2Di(var0, var7, var1, var2, var3, 0, var4, var5, var11, 0);
            if(var8 <= 1) {
               return;
            }

            int var13 = 0;
            int var14 = 0;
            int var15 = var14 + var2;

            for(int var16 = 0; var16 < var10; ++var16) {
               for(int var17 = 0; var17 < var9; ++var17) {
                  int var18 = var11[var14++];
                  int var19 = var11[var14++];
                  int var20 = var11[var15++];
                  int var21 = var11[var15++];
                  int var22 = var18 >> 24 & 255;
                  int var23 = var18 >> 16 & 255;
                  int var24 = var18 >> 8 & 255;
                  int var25 = var18 & 255;
                  var22 += var19 >> 24 & 255;
                  var23 += var19 >> 16 & 255;
                  var24 += var19 >> 8 & 255;
                  var25 += var19 & 255;
                  var22 += var20 >> 24 & 255;
                  var23 += var20 >> 16 & 255;
                  var24 += var20 >> 8 & 255;
                  var25 += var20 & 255;
                  var22 += var21 >> 24 & 255;
                  var23 += var21 >> 16 & 255;
                  var24 += var21 >> 8 & 255;
                  var25 += var21 & 255;
                  var12[var13++] = (var22 & 1020) << 22 | (var23 & 1020) << 14 | (var24 & 1020) << 6 | (var25 & 1020) >> 2;
               }

               var14 += var2;
               var15 += var2;
            }

            int[] var26 = var12;
            var12 = var11;
            var11 = var26;
            var2 = var9;
            var3 = var10;
            var9 >>= 1;
            var10 >>= 1;
            var8 >>= 1;
            ++var7;
         }
      }
   }

   void method2724() {
      if(this.anInt1701 > 0) {
         this.aClass545_Sub1_1704.method14614(this.anInt1701, this.method2701());
         this.anInt1701 = 0;
      }

   }

   static void method2725(int var0, int var1, int var2, int var3, Class98 var4, byte[] var5) {
      if(var2 > 0 && !Class75.method1618(var2, 98312473)) {
         throw new IllegalArgumentException("");
      } else if(var3 > 0 && !Class75.method1618(var3, 98312473)) {
         throw new IllegalArgumentException("");
      } else {
         int var6 = var4.anInt996 * 1946169797;
         int var7 = 0;
         int var8 = var2 < var3?var2:var3;
         int var9 = var2 >> 1;
         int var10 = var3 >> 1;
         byte[] var11 = var5;
         byte[] var12 = new byte[var9 * var10 * var6];

         while(true) {
            OpenGL.glTexImage2Dub(var0, var7, var1, var2, var3, 0, Class545_Sub1.method14567(var4), 5121, var11, 0);
            if(var8 <= 1) {
               return;
            }

            int var13 = var2 * var6;

            for(int var14 = 0; var14 < var6; ++var14) {
               int var15 = var14;
               int var16 = var14;
               int var17 = var14 + var13;

               for(int var18 = 0; var18 < var10; ++var18) {
                  for(int var19 = 0; var19 < var9; ++var19) {
                     byte var20 = var11[var16];
                     var16 += var6;
                     int var22 = var20 + var11[var16];
                     var16 += var6;
                     var22 += var11[var17];
                     var17 += var6;
                     var22 += var11[var17];
                     var17 += var6;
                     var12[var15] = (byte)(var22 >> 2);
                     var15 += var6;
                  }

                  var16 += var13;
                  var17 += var13;
               }
            }

            byte[] var21 = var12;
            var12 = var11;
            var11 = var21;
            var2 = var9;
            var3 = var10;
            var9 >>= 1;
            var10 >>= 1;
            var8 >>= 1;
            ++var7;
         }
      }
   }

   void method2726(boolean var1) {
      if(this.aBool1705 != var1) {
         int var2 = this.method2701();
         this.aBool1705 = true;
         this.method2695();
         this.method2700(var2);
      }

   }

   static void method2727(int var0, int var1, int var2, int var3, Class98 var4, float[] var5) {
      if(var2 > 0 && !Class75.method1618(var2, 98312473)) {
         throw new IllegalArgumentException("");
      } else if(var3 > 0 && !Class75.method1618(var3, 98312473)) {
         throw new IllegalArgumentException("");
      } else {
         int var6 = var4.anInt996 * 1946169797;
         int var7 = 0;
         int var8 = var2 < var3?var2:var3;
         int var9 = var2 >> 1;
         int var10 = var3 >> 1;
         float[] var11 = var5;
         float[] var12 = new float[var9 * var10 * var6];

         while(true) {
            OpenGL.glTexImage2Df(var0, var7, var1, var2, var3, 0, Class545_Sub1.method14567(var4), 5126, var11, 0);
            if(var8 <= 1) {
               return;
            }

            int var13 = var2 * var6;

            for(int var14 = 0; var14 < var6; ++var14) {
               int var15 = var14;
               int var16 = var14;
               int var17 = var14 + var13;

               for(int var18 = 0; var18 < var10; ++var18) {
                  for(int var19 = 0; var19 < var9; ++var19) {
                     float var20 = var11[var16];
                     var16 += var6;
                     var20 += var11[var16];
                     var16 += var6;
                     var20 += var11[var17];
                     var17 += var6;
                     var20 += var11[var17];
                     var17 += var6;
                     var12[var15] = var20 * 0.25F;
                     var15 += var6;
                  }

                  var16 += var13;
                  var17 += var13;
               }
            }

            float[] var21 = var12;
            var12 = var11;
            var11 = var21;
            var2 = var9;
            var3 = var10;
            var9 >>= 1;
            var10 >>= 1;
            var8 >>= 1;
            ++var7;
         }
      }
   }
}
