46 |
public static boolean dbg = false; |
public static boolean dbg = false; |
47 |
private static void pa(String s) { System.out.println(s); } |
private static void pa(String s) { System.out.println(s); } |
48 |
|
|
49 |
|
static MipzipMemoryConsumer currentlyLoaded = null; |
50 |
|
|
51 |
static MemoryPartitioner pool; |
static MemoryPartitioner pool; |
52 |
static { |
static { |
53 |
String mem_str = System.getProperty("GFX_MEM", "16"); |
String mem_str = System.getProperty("GFX_MEM", "16"); |
57 |
pool = new MemoryPartitioner(mem * 1024 * 1024); |
pool = new MemoryPartitioner(mem * 1024 * 1024); |
58 |
} |
} |
59 |
|
|
60 |
|
/** Irrevocably stop using the memorypartitioner interface |
61 |
|
* for allocating textures. |
62 |
|
*/ |
63 |
|
public static void dangerouslyOverrideMemoryPartitioner() { |
64 |
|
pool.stop(); |
65 |
|
pool = null; |
66 |
|
} |
67 |
|
|
68 |
private static class SpanSB { |
private static class SpanSB { |
69 |
PageImageScroll sb; |
PageImageScroll sb; |
70 |
SpanPage[] pages; |
SpanPage[] pages; |
111 |
* of the drawn area. |
* of the drawn area. |
112 |
*/ |
*/ |
113 |
public GL.Texture getTexture(float importance, float pixels) { |
public GL.Texture getTexture(float importance, float pixels) { |
114 |
|
if(pool == null) { |
115 |
|
if(currentlyLoaded != consumer) { |
116 |
|
currentlyLoaded.loadToBaseLevelSynch(1000); |
117 |
|
currentlyLoaded = consumer; |
118 |
|
currentlyLoaded.loadToBaseLevelSynch(0); |
119 |
|
} |
120 |
|
} |
121 |
return consumer.getTexture(importance, pixels); |
return consumer.getTexture(importance, pixels); |
122 |
} |
} |
123 |
|
|
228 |
return r; |
return r; |
229 |
} |
} |
230 |
|
|
231 |
|
public static void clearCache() { |
232 |
|
span2rect = new WeakHashMap(); |
233 |
|
sb2spansb = new WeakHashMap(); |
234 |
|
} |
235 |
|
|
236 |
|
|
237 |
} |
} |