package com.google.android.m4b.maps.bp;

import com.google.android.m4b.maps.ar.d;
import com.google.android.m4b.maps.bo.e;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
import javax.microedition.khronos.opengles.GL10;

public class g
  implements h
{
  protected int a = 0;
  int[] b;
  int c;
  int d;
  Buffer e;
  protected final int f;
  protected final int g;
  protected final int h;
  int i;
  protected d j;
  private boolean k;

  g()
  {
    this.f = 5132;
    this.g = 4;
    this.h = 1;
  }

  public g(int paramInt)
  {
    this(paramInt, false);
  }

  protected g(int paramInt1, int paramInt2, int paramInt3, boolean paramBoolean)
  {
    this.k = true;
    this.c = paramInt1;
    switch (paramInt2)
    {
    default:
      throw new IllegalArgumentException("glNativeType must be one of GL_FIXED, GL_SHORT or GL_BYTE");
    case 5132:
      this.g = 4;
    case 5122:
    case 5120:
    case 5121:
    }
    while (true)
    {
      this.f = paramInt2;
      this.h = paramInt3;
      d();
      return;
      this.g = 2;
      continue;
      this.g = 1;
    }
  }

  public g(int paramInt, boolean paramBoolean)
  {
    this.k = paramBoolean;
    this.c = paramInt;
    this.f = 5132;
    this.g = 4;
    this.h = 1;
    d();
  }

  private void d()
  {
    this.i = 0;
    int m;
    if (this.b == null)
    {
      m = 2 * this.c;
      if ((m < 1024) || (this.k))
        this.b = new int[m];
    }
    while (true)
    {
      this.d = 0;
      this.e = null;
      return;
      this.j = new d(m);
      a();
      continue;
      if (this.j != null)
      {
        this.j.a();
        a();
      }
    }
  }

  protected final void a()
  {
    if (this.j != null)
    {
      this.j.b(this.i);
      this.b = ((int[])this.j.c);
      this.i = this.j.d;
    }
  }

  public void a(float paramFloat1, float paramFloat2)
  {
    this.d = (1 + this.d);
    int[] arrayOfInt1 = this.b;
    int m = this.i;
    this.i = (m + 1);
    arrayOfInt1[m] = Math.round(paramFloat1 * 65536.0F);
    int[] arrayOfInt2 = this.b;
    int n = this.i;
    this.i = (n + 1);
    arrayOfInt2[n] = Math.round(paramFloat2 * 65536.0F);
    if (this.i >= 1024)
      a();
  }

  public void a(int paramInt1, int paramInt2)
  {
    this.d = (1 + this.d);
    int[] arrayOfInt1 = this.b;
    int m = this.i;
    this.i = (m + 1);
    arrayOfInt1[m] = paramInt1;
    int[] arrayOfInt2 = this.b;
    int n = this.i;
    this.i = (n + 1);
    arrayOfInt2[n] = paramInt2;
    if (this.i >= 1024)
      a();
  }

  public final void a(int paramInt1, int paramInt2, int paramInt3)
  {
    for (int m = 0; m < paramInt3; m++)
    {
      int[] arrayOfInt1 = this.b;
      int n = this.i;
      this.i = (n + 1);
      arrayOfInt1[n] = paramInt1;
      int[] arrayOfInt2 = this.b;
      int i1 = this.i;
      this.i = (i1 + 1);
      arrayOfInt2[i1] = paramInt2;
      if (this.i >= 1024)
        a();
    }
    this.d = (paramInt3 + this.d);
  }

  public void a(e parame)
  {
    b(parame);
    d();
  }

  public void a(e parame, int paramInt)
  {
    if (this.e == null)
      e(parame);
    this.e.position(paramInt * 2);
    this.a = ((this.e.limit() - paramInt) * this.g);
    parame.x().glTexCoordPointer(2, this.f, 0, this.e);
  }

  protected final void a(ByteBuffer paramByteBuffer, int paramInt)
  {
    for (int m = 0; m < paramInt; m++)
      paramByteBuffer.put((byte)(this.b[m] / this.h));
  }

  protected final void a(ShortBuffer paramShortBuffer, int paramInt)
  {
    for (int m = 0; m < paramInt; m++)
      paramShortBuffer.put((short)(this.b[m] / this.h));
  }

  public final void a(int[] paramArrayOfInt)
  {
    a(paramArrayOfInt, 0, paramArrayOfInt.length);
  }

  public void a(int[] paramArrayOfInt, int paramInt1, int paramInt2)
  {
    if ((this.j == null) || (paramInt2 + this.i < 1024))
    {
      System.arraycopy(paramArrayOfInt, paramInt1, this.b, this.i, paramInt2);
      this.i = (paramInt2 + this.i);
    }
    while (true)
    {
      this.d += paramInt2 / 2;
      return;
      int m = paramInt1 + paramInt2;
      while (paramInt1 < m)
      {
        int n = Math.min(m - paramInt1, 1024 - this.i);
        System.arraycopy(paramArrayOfInt, paramInt1, this.b, this.i, n);
        paramInt1 += n;
        this.i = (n + this.i);
        a();
      }
    }
  }

  public final int b()
  {
    return this.a;
  }

  public void b(e parame)
  {
  }

  public int c()
  {
    int m = 44;
    if (this.j != null)
      m = 44 + 4 * this.j.b();
    while (true)
    {
      if (this.e != null)
        m += this.e.capacity() * this.g;
      return m;
      if (this.b != null)
        m = 44 + (16 + 4 * this.b.length);
    }
  }

  public final void c(int paramInt)
  {
    int m;
    int n;
    if (paramInt > this.c)
    {
      m = Math.max(paramInt, 2 * this.c);
      n = m * 2;
      if (this.j != null)
        break label136;
      if ((n >= 1024) && (!this.k))
        break label81;
      int[] arrayOfInt = new int[n];
      System.arraycopy(this.b, 0, arrayOfInt, 0, this.i);
      this.b = arrayOfInt;
    }
    while (true)
    {
      this.c = m;
      return;
      label81: this.j = new d(n);
      this.j.a(this.b, this.i);
      this.b = ((int[])this.j.c);
      this.i = this.j.d;
      continue;
      label136: this.j.c(n);
    }
  }

  public final void c(e parame)
  {
    b(parame);
    if (this.j != null)
    {
      this.j.c();
      this.j = null;
    }
    this.b = null;
  }

  public void d(e parame)
  {
    if (this.e == null)
      e(parame);
    this.e.position(0);
    this.a = (this.e.limit() * this.g);
    parame.x().glTexCoordPointer(2, this.f, 0, this.e);
  }

  protected void e(e parame)
  {
    int m = 2 * this.d;
    ByteBuffer localByteBuffer = parame.l().a(m * this.g);
    localByteBuffer.order(ByteOrder.nativeOrder());
    if (this.f == 5122)
    {
      this.e = localByteBuffer.asShortBuffer();
      if (this.j == null)
        a((ShortBuffer)this.e, m);
    }
    while (true)
    {
      if (this.j != null)
      {
        this.j.c();
        this.j = null;
      }
      this.b = null;
      return;
      a();
      this.j.a((ShortBuffer)this.e, this.h);
      continue;
      if ((this.f == 5120) || (this.f == 5121))
      {
        this.e = localByteBuffer;
        if (this.j == null)
        {
          a((ByteBuffer)this.e, m);
        }
        else
        {
          a();
          this.j.a((ByteBuffer)this.e, this.h);
        }
      }
      else
      {
        this.e = localByteBuffer.asIntBuffer();
        if (this.j == null)
        {
          ((IntBuffer)this.e).put(this.b, 0, m);
        }
        else
        {
          a();
          this.j.a((IntBuffer)this.e);
        }
      }
    }
  }

  public final int g()
  {
    return this.d;
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.google.android.m4b.maps.bp.g
 * JD-Core Version:    0.6.2
 */