package com.google.android.m4b.maps.bj;

import android.graphics.Bitmap;
import android.opengl.GLUtils;
import java.util.BitSet;
import javax.microedition.khronos.opengles.GL10;

final class ae extends j<s, Integer>
{
  private final BitSet b = new BitSet(17);
  private final BitSet c = new BitSet(17);
  private final int[] d = new int[17];
  private GL10 e;

  public ae(int paramInt)
  {
    super(17);
  }

  public final int a(s params)
  {
    Integer localInteger = (Integer)a(params);
    if (localInteger == null)
      return 0;
    return this.d[localInteger.intValue()];
  }

  public final void a(s params, Bitmap paramBitmap)
  {
    if (paramBitmap != null)
    {
      try
      {
        if (a(params) != null)
          throw new IllegalArgumentException("Already cached " + params);
      }
      finally
      {
        paramBitmap.recycle();
      }
      b();
      int i = this.b.nextClearBit(0);
      if (i >= this.a)
        throw new RuntimeException("Ran out of texture cache slots.");
      GL10 localGL10 = this.e;
      if (localGL10 != null)
      {
        localGL10.glBindTexture(3553, this.d[i]);
        if (!this.c.get(i))
        {
          localGL10.glTexParameterf(3553, 10241, 9728.0F);
          localGL10.glTexParameterf(3553, 10240, 9729.0F);
          localGL10.glTexParameterf(3553, 10242, 33071.0F);
          localGL10.glTexParameterf(3553, 10243, 33071.0F);
          localGL10.glTexEnvf(8960, 8704, 7681.0F);
          GLUtils.texImage2D(3553, 0, paramBitmap, 0);
          this.c.set(i);
        }
        while (true)
        {
          int j = localGL10.glGetError();
          if (j == 0)
            break;
          throw new RuntimeException("glError: " + Integer.toString(j));
          GLUtils.texImage2D(3553, 0, paramBitmap, 0);
        }
        this.b.set(i);
        b(params, Integer.valueOf(i));
      }
      paramBitmap.recycle();
    }
  }

  public final void a(GL10 paramGL10)
  {
    this.e = paramGL10;
    paramGL10.glGenTextures(this.a, this.d, 0);
  }

  public final void c()
  {
    if (this.e != null)
      this.e.glDeleteTextures(this.a, this.d, 0);
    a();
    this.c.clear();
    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.bj.ae
 * JD-Core Version:    0.6.2
 */