gzz.gfx.gl
Class MipzipMemoryConsumer

gzz.gfx.gl.MipzipLoader gzz.mem.MemoryConsumer gzz.mem.MemoryPartitioner gzz.gfx.gl.MipzipMemoryConsumer ../../../../gl/Mipzip.gen.html#mipziploaderThread mipziploaderThread_small
java.lang.Object
  |
  +--gzz.gfx.gl.MipzipMemoryConsumer
All Implemented Interfaces:
gzz.mem.MemoryConsumer

public class MipzipMemoryConsumer
extends java.lang.Object
implements gzz.mem.MemoryConsumer

An adapter between MipzipLoader and MemoryConsumer.


Field Summary
static boolean dbg
           
 
Constructor Summary
MipzipMemoryConsumer(gzz.mem.MemoryPartitioner pool, MipzipLoader mipzip)
           
 
Method Summary
 int getMaxBytes(float quality)
          The maximum number of bytes this object would like to consume.
 float getQuality()
          Get the quality currently used.
 int getReservation()
          Get the number of bytes currently used.
 boolean getScalable()
          Whether this object can make use of byte amounts less than getMaxBytes() returns.
 GL.Texture getTexture(float importance, float quality)
          The public API: ask for the texture at given importance and quality.
 void loadToBaseLevelSynch(int level)
           
 int setReservation(float priority, int bytes, float quality, Obs o)
          Set the amount of memory this object is allowed to consume.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbg

public static boolean dbg
Constructor Detail

MipzipMemoryConsumer

public MipzipMemoryConsumer(gzz.mem.MemoryPartitioner pool,
                            MipzipLoader mipzip)
Method Detail

getScalable

public boolean getScalable()
Description copied from interface: gzz.mem.MemoryConsumer
Whether this object can make use of byte amounts less than getMaxBytes() returns. For example, images can be scaled down but text cannot.

Specified by:
getScalable in interface gzz.mem.MemoryConsumer

getMaxBytes

public int getMaxBytes(float quality)
Description copied from interface: gzz.mem.MemoryConsumer
The maximum number of bytes this object would like to consume.

Specified by:
getMaxBytes in interface gzz.mem.MemoryConsumer
Parameters:
quality - The quality at which the maximum bytes are requested.

setReservation

public int setReservation(float priority,
                          int bytes,
                          float quality,
                          Obs o)
Description copied from interface: gzz.mem.MemoryConsumer
Set the amount of memory this object is allowed to consume. Once it's done, Obs will be called from an unspecified thread. If setReservation is called again before the Obs for a previous setReservation has been called, it is undefined whether the previous Obs will be called at all. The size, when the later Obs is called, is the new one.

This method may only be called by MemoryPartitioner.

Specified by:
setReservation in interface gzz.mem.MemoryConsumer
Parameters:
priority - The priority to use for scheduling this operation.
bytes - The maximum amount of bytes this object should reserve.
quality - Maximum quality that should be loaded (if quality is adjusted in discrete steps, the class may round upwards).
o - Observer to call (if non-null) when size has been adjusted
Returns:
The number of bytes this consumer will actually use: e.g. if sizes come in certain increments, less memory will be used than needed..

loadToBaseLevelSynch

public void loadToBaseLevelSynch(int level)

getReservation

public int getReservation()
Description copied from interface: gzz.mem.MemoryConsumer
Get the number of bytes currently used.

Specified by:
getReservation in interface gzz.mem.MemoryConsumer

getQuality

public float getQuality()
Description copied from interface: gzz.mem.MemoryConsumer
Get the quality currently used.

Specified by:
getQuality in interface gzz.mem.MemoryConsumer

getTexture

public GL.Texture getTexture(float importance,
                             float quality)
The public API: ask for the texture at given importance and quality.