package com.google.android.m4b.maps.bp;

import com.google.android.m4b.maps.bo.h;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.ShortBuffer;
import javax.microedition.khronos.opengles.GL10;

public class c
  implements d
{
  protected short[] a;
  int b;
  ShortBuffer c;
  protected int d = 0;
  protected com.google.android.m4b.maps.ar.e e;
  private int f;
  private int g;
  private boolean h;

  public c(int paramInt)
  {
    this(paramInt, false);
  }

  public c(int paramInt, boolean paramBoolean)
  {
    this.h = paramBoolean;
    this.f = paramInt;
    f();
  }

  private void a(short[] paramArrayOfShort, int paramInt1, int paramInt2)
  {
    if (this.e == null)
    {
      System.arraycopy(paramArrayOfShort, paramInt1, this.a, this.g, paramInt2);
      this.g = (paramInt2 + this.g);
    }
    while (true)
    {
      this.b = (paramInt2 + this.b);
      return;
      int i = paramInt1 + paramInt2;
      while (paramInt1 < i)
      {
        int j = Math.min(i - paramInt1, 2048 - this.g);
        System.arraycopy(paramArrayOfShort, paramInt1, this.a, this.g, j);
        paramInt1 += j;
        this.g = (j + this.g);
        e();
      }
    }
  }

  private void e()
  {
    if (this.g >= 2048)
      a();
  }

  private void f()
  {
    this.g = 0;
    if (this.a == null)
      if ((this.f < 2048) || (this.h))
        this.a = new short[this.f];
    while (true)
    {
      this.b = 0;
      this.c = null;
      return;
      this.e = new com.google.android.m4b.maps.ar.e(this.f);
      a();
      continue;
      if (this.e != null)
      {
        this.e.a();
        a();
      }
    }
  }

  protected final void a()
  {
    if (this.e != null)
    {
      this.e.b(this.g);
      this.a = ((short[])this.e.c);
      this.g = this.e.d;
    }
  }

  public final void a(int paramInt1, int paramInt2, int paramInt3)
  {
    short[] arrayOfShort1 = this.a;
    int i = this.g;
    this.g = (i + 1);
    arrayOfShort1[i] = ((short)paramInt1);
    short[] arrayOfShort2 = this.a;
    int j = this.g;
    this.g = (j + 1);
    arrayOfShort2[j] = ((short)paramInt2);
    short[] arrayOfShort3 = this.a;
    int k = this.g;
    this.g = (k + 1);
    arrayOfShort3[k] = ((short)paramInt3);
    this.b = (3 + this.b);
    if (this.g >= 2048)
      a();
  }

  public final void a(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    short[] arrayOfShort1 = this.a;
    int i = this.g;
    this.g = (i + 1);
    arrayOfShort1[i] = ((short)paramInt1);
    short[] arrayOfShort2 = this.a;
    int j = this.g;
    this.g = (j + 1);
    arrayOfShort2[j] = ((short)paramInt2);
    short[] arrayOfShort3 = this.a;
    int k = this.g;
    this.g = (k + 1);
    arrayOfShort3[k] = ((short)paramInt3);
    short[] arrayOfShort4 = this.a;
    int m = this.g;
    this.g = (m + 1);
    arrayOfShort4[m] = ((short)paramInt3);
    short[] arrayOfShort5 = this.a;
    int n = this.g;
    this.g = (n + 1);
    arrayOfShort5[n] = ((short)paramInt2);
    short[] arrayOfShort6 = this.a;
    int i1 = this.g;
    this.g = (i1 + 1);
    arrayOfShort6[i1] = ((short)paramInt4);
    this.b = (6 + this.b);
    if (this.g >= 2048)
      a();
  }

  public void a(com.google.android.m4b.maps.bo.e parame)
  {
    b(parame);
    f();
  }

  public void a(com.google.android.m4b.maps.bo.e parame, int paramInt)
  {
    if (this.c == null)
      d(parame);
    this.d = (2 * this.c.limit());
    parame.x().glDrawElements(paramInt, this.b, 5123, this.c);
  }

  public final void a(c paramc, int paramInt1, int paramInt2)
  {
    int i = 1;
    int j;
    if ((paramc.e == null) || (paramc.b < 2048))
    {
      j = i;
      if ((this.e != null) && (paramInt2 + this.g > 2048))
        break label118;
      label43: if ((j == 0) || (i == 0))
        break label124;
      System.arraycopy(paramc.a, paramInt1, this.a, this.g, paramInt2);
      this.g = (paramInt2 + this.g);
      this.b = (paramInt2 + this.b);
      if ((this.g >= 2048) && (this.e != null))
        a();
    }
    while (true)
    {
      return;
      j = 0;
      break;
      label118: i = 0;
      break label43;
      label124: if (paramc.e == null)
      {
        a(paramc.a, paramInt1, paramInt2);
        return;
      }
      paramc.e();
      int k = paramInt1 >> 11;
      int m = paramInt1 & 0x7FF;
      int n = k;
      while (paramInt2 > 0)
      {
        int i1 = Math.min(2048 - m, paramInt2);
        a((short[])paramc.e.a(n), m, i1);
        int i2 = n + 1;
        paramInt2 -= i1;
        n = i2;
        m = 0;
      }
    }
  }

  public final void a(short paramShort1, short paramShort2)
  {
    short[] arrayOfShort1 = this.a;
    int i = this.g;
    this.g = (i + 1);
    arrayOfShort1[i] = paramShort1;
    short[] arrayOfShort2 = this.a;
    int j = this.g;
    this.g = (j + 1);
    arrayOfShort2[j] = paramShort2;
    this.b = (2 + this.b);
    if (this.g >= 2048)
      a();
  }

  public final void a(short paramShort1, short paramShort2, short paramShort3)
  {
    short[] arrayOfShort1 = this.a;
    int i = this.g;
    this.g = (i + 1);
    arrayOfShort1[i] = paramShort1;
    short[] arrayOfShort2 = this.a;
    int j = this.g;
    this.g = (j + 1);
    arrayOfShort2[j] = paramShort2;
    short[] arrayOfShort3 = this.a;
    int k = this.g;
    this.g = (k + 1);
    arrayOfShort3[k] = paramShort3;
    this.b = (3 + this.b);
    if (this.g >= 2048)
      a();
  }

  public final int b()
  {
    return this.b;
  }

  public final void b(int paramInt)
  {
    int i;
    if (paramInt > this.f)
    {
      i = Math.max(paramInt, 2 * this.f);
      if (this.e != null)
        break label132;
      if ((i >= 2048) && (!this.h))
        break label77;
      short[] arrayOfShort = new short[i];
      System.arraycopy(this.a, 0, arrayOfShort, 0, this.g);
      this.a = arrayOfShort;
    }
    while (true)
    {
      this.f = i;
      return;
      label77: this.e = new com.google.android.m4b.maps.ar.e(i);
      this.e.a(this.a, this.g);
      this.a = ((short[])this.e.c);
      this.g = this.e.d;
      continue;
      label132: this.e.c(i);
    }
  }

  public void b(com.google.android.m4b.maps.bo.e parame)
  {
  }

  public final int c()
  {
    return this.d;
  }

  public final void c(com.google.android.m4b.maps.bo.e parame)
  {
    b(parame);
    if (this.e != null)
    {
      this.e.c();
      this.e = null;
    }
    this.a = null;
  }

  public int d()
  {
    int i = 32;
    if (this.e != null)
      i = 32 + 2 * this.e.b();
    while (true)
    {
      if (this.c != null)
        i += 2 * this.c.capacity();
      return i;
      if (this.a != null)
        i = 32 + (16 + 2 * this.a.length);
    }
  }

  public final void d(int paramInt)
  {
    short[] arrayOfShort = this.a;
    int i = this.g;
    this.g = (i + 1);
    arrayOfShort[i] = ((short)paramInt);
    this.b = (1 + this.b);
    if (this.g >= 2048)
      a();
  }

  protected void d(com.google.android.m4b.maps.bo.e parame)
  {
    ByteBuffer localByteBuffer = parame.l().a(2 * this.b);
    localByteBuffer.order(ByteOrder.nativeOrder());
    this.c = localByteBuffer.asShortBuffer();
    if (this.e == null)
      this.c.put(this.a, 0, this.b);
    while (true)
    {
      this.c.position(0);
      this.a = null;
      return;
      a();
      this.e.a(this.c);
      this.e.c();
      this.e = null;
    }
  }
}

/* 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.c
 * JD-Core Version:    0.6.2
 */