public native void finalize();
// FIXME: try to use os acceleration
- public void fillJSTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int argb) {
+ public void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int argb) {
if (x1 == x3 && x2 == x4) {
fillRect(x1, y1, x4, y2, argb);
} else for(int y=y1; y<y2; y++) {
int height = 0;
byte[] data = null;
File cacheFile = null;
+ /*
try {
String key = glyph.font.res.getCacheKey() + ":" + glyph.c;
key = new String(Base64.encode(key.getBytes()));
} catch (Res.NotCacheableException e) {
Log.log(Freetype.class, "note: glyph not cacheable");
}
-
+ */
if (cacheFile != null && cacheFile.exists()) {
DataInputStream dis = new DataInputStream(new FileInputStream(cacheFile));
width = dis.readInt();
if (width != 0 && height != 0) dis.readFully(data);
} else try {
- System.out.println("cache miss!");
+ //System.out.println("cache miss!");
if (loadedStream != glyph.font.res) loadFontByteStream(glyph.font.res);
vm.setUserInfo(2, (int)glyph.c);
vm.setUserInfo(3, (int)glyph.c);
data = new byte[width * height];
int addr = vm.getUserInfo(5);
vm.copyin(addr,data,width*height);
- File tmp = new File(cacheFile.getCanonicalPath() + ".tmp");
- DataOutputStream dis = new DataOutputStream(new FileOutputStream(tmp));
- dis.writeInt(width);
- dis.writeInt(height);
- dis.writeInt(glyph.font.max_ascent);
- dis.writeInt(glyph.font.max_descent);
- dis.writeInt(glyph.baseline);
- dis.writeInt(glyph.advance);
- if (width != 0 && height != 0) dis.write(data, 0, data.length);
- dis.close();
- tmp.renameTo(cacheFile);
+ if (cacheFile != null) {
+ File tmp = new File(cacheFile.getCanonicalPath() + ".tmp");
+ DataOutputStream dis = new DataOutputStream(new FileOutputStream(tmp));
+ dis.writeInt(width);
+ dis.writeInt(height);
+ dis.writeInt(glyph.font.max_ascent);
+ dis.writeInt(glyph.font.max_descent);
+ dis.writeInt(glyph.baseline);
+ dis.writeInt(glyph.advance);
+ if (width != 0 && height != 0) dis.write(data, 0, data.length);
+ dis.close();
+ tmp.renameTo(cacheFile);
+ }
} catch (Exception e) {
Log.log(this, e);
while(trimmed.charAt(trimmed.length() - 1) == '\\') {
String s2 = in.readLine().trim();
if (s2.startsWith("//")) s2 = s2.substring(2).trim();
- trimmed += s2;
+ trimmed = trimmed.substring(0, trimmed.length() - 1) + " " + s2;
out.println(); // preserve line numbers
}
StringTokenizer st = new StringTokenizer(trimmed, " ");